Skip to content

Commit

Permalink
fix: fixes impending cran-ban of git2r
Browse files Browse the repository at this point in the history
  • Loading branch information
kapsner committed Oct 15, 2024
1 parent 3e3190a commit c9b7046
Show file tree
Hide file tree
Showing 10 changed files with 521 additions and 679 deletions.
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
^NEWS\.md$
^README\.md$
^docs$
^Meta$
^doc$
^CRAN-SUBMISSION$
^autonewsmd-manual\.tex$
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: autonewsmd
Title: Auto-Generate Changelog using Conventional Commits
Version: 0.0.8.9002
Version: 0.0.9
Authors@R:
person("Lorenz A.", "Kapsner", , "[email protected]", role = c("cre", "aut", "cph"),
comment = c(ORCID = "0000-0003-1866-860X"))
Expand All @@ -14,19 +14,19 @@ Depends:
R (>= 3.6)
Imports:
data.table,
git2r,
magrittr,
quarto,
R6,
utils
Suggests:
git2r,
lintr,
testthat (>= 3.0.1)
VignetteBuilder:
quarto
Config/testthat/edition: 3
Config/testthat/parallel: false
Date/Publication: 2024-07-11 11:13:28.869177 UTC
Date/Publication: 2024-10-15 09:18:54.725856 UTC
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
SystemRequirements: Quarto command line tools
Expand Down
27 changes: 24 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

# autonewsmd NEWS

## Unreleased (2024-05-29)
## Unreleased (2024-07-11)

#### Bug fixes

- first try to fix issues with quarto vignette on macosx cran runners
([3e3190a](https://github.com/kapsner/autonewsmd/tree/3e3190a8cf831ffcf8bbc95d11c77efad953553f))

#### Other changes

Expand All @@ -13,7 +18,7 @@
([610e7b5](https://github.com/kapsner/autonewsmd/tree/610e7b5f14b3d69063b4b204ae3e23842be766d2))

Full set of changes:
[`v0.0.8...d9fc76a`](https://github.com/kapsner/autonewsmd/compare/v0.0.8...d9fc76a)
[`v0.0.8...3e3190a`](https://github.com/kapsner/autonewsmd/compare/v0.0.8...3e3190a)

## v0.0.8 (2024-05-29)

Expand Down Expand Up @@ -72,10 +77,26 @@ Full set of changes:
([77dc1d9](https://github.com/kapsner/autonewsmd/tree/77dc1d9d64b821d036e50f0c565c9c9abf91bf4e))
- updated news.md to v0.0.6
([a5f4da2](https://github.com/kapsner/autonewsmd/tree/a5f4da2cc998e36ee5dfd4fa7635ec9d0364067e))

Full set of changes:
[`v0.0.6...v0.0.7`](https://github.com/kapsner/autonewsmd/compare/v0.0.6...v0.0.7)

## v0.0.6 (2023-04-13)

#### Other changes

- more informative error messages
([04f115a](https://github.com/kapsner/autonewsmd/tree/04f115aad0cb53c517e0e04cce08b8e53f07b939))
- added pkg to readme
([c84e5ec](https://github.com/kapsner/autonewsmd/tree/c84e5ecec14804c9775ef512822dd4aeb6b977d6))

Full set of changes:
[`v0.0.5...v0.0.6`](https://github.com/kapsner/autonewsmd/compare/v0.0.5...v0.0.6)

## v0.0.5 (2023-01-21)

#### Other changes

- merged yihuis patch
([851b893](https://github.com/kapsner/autonewsmd/tree/851b893cd39bd7fee18249bcf5a1a7b4e5f4e803))
- updated readme, news.md
Expand All @@ -92,7 +113,7 @@ Full set of changes:
([5decf24](https://github.com/kapsner/autonewsmd/tree/5decf248ec4b12bcdc54baeedf631075657fad5a))

Full set of changes:
[`v0.0.4...v0.0.7`](https://github.com/kapsner/autonewsmd/compare/v0.0.4...v0.0.7)
[`v0.0.4...v0.0.5`](https://github.com/kapsner/autonewsmd/compare/v0.0.4...v0.0.5)

## v0.0.4 (2022-10-31)

Expand Down
214 changes: 113 additions & 101 deletions R/autonewsmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,42 @@
#' ## Initialize a repository
#' path <- file.path(tempdir(), "autonewsmd")
#' dir.create(path)
#'
#' if (requireNamespace("git2r", quietly = TRUE)) {
#' repo <- git2r::init(path)
#'
#' ## Config user
#' git2r::config(repo, user.name = "Alice", user.email = "[email protected]")
#' git2r::remote_set_url(repo, "foobar", "https://example.org/git2r/foobar")
#' ## Config user
#' git2r::config(repo, user.name = "Alice", user.email = "[email protected]")
#' git2r::remote_set_url(repo, "foobar", "https://example.org/git2r/foobar")
#'
#'
#' ## Write to a file and commit
#' lines <- "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do"
#' writeLines(lines, file.path(path, "example.txt"))
#' ## Write to a file and commit
#' lines <- "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do"
#' writeLines(lines, file.path(path, "example.txt"))
#'
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "feat: new file")
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "feat: new file")
#'
#' ## Write again to a file and commit
#' lines2 <- paste0(
#' "eiusmod tempor incididunt ut labore et dolore magna aliqua. ",
#' "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris ",
#' "nisi ut aliquip ex ea commodo consequat."
#' )
#' write(lines2, file.path(path, "example.txt"), append = TRUE)
#' ## Write again to a file and commit
#' lines2 <- paste0(
#' "eiusmod tempor incididunt ut labore et dolore magna aliqua. ",
#' "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris ",
#' "nisi ut aliquip ex ea commodo consequat."
#' )
#' write(lines2, file.path(path, "example.txt"), append = TRUE)
#'
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "refactor: added second phrase")
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "refactor: added second phrase")
#'
#' ## now construct a new autonewsmd object
#' an <- autonewsmd$new(repo_name = "TestRepo", repo_path = path)
#' ## now construct a new autonewsmd object
#' an <- autonewsmd$new(repo_name = "TestRepo", repo_path = path)
#'
#' ## generate the news and write them to the repo
#' an$generate()
#' ## generate the news and write them to the repo
#' an$generate()
#'
#' if (interactive()) {
#' an$write()
#' if (interactive()) {
#' an$write()
#' }
#' }
#'
#' @export
Expand Down Expand Up @@ -112,37 +115,40 @@ autonewsmd <- R6::R6Class(
#' ## Initialize a repository
#' path <- file.path(tempdir(), "autonewsmd")
#' dir.create(path)
#' repo <- git2r::init(path)
#'
#' ## Config user
#' git2r::config(
#' repo, user.name = "Alice", user.email = "[email protected]"
#' )
#' git2r::remote_set_url(repo, "foobar", "https://example.org/git2r/foobar")
#' if (requireNamespace("git2r", quietly = TRUE)) {
#' repo <- git2r::init(path)
#'
#' ## Config user
#' git2r::config(
#' repo, user.name = "Alice", user.email = "[email protected]"
#' )
#' git2r::remote_set_url(repo, "foobar", "https://example.org/git2r/foobar")
#'
#'
#' ## Write to a file and commit
#' lines <- paste0(
#' "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do"
#' )
#' writeLines(lines, file.path(path, "example.txt"))
#' ## Write to a file and commit
#' lines <- paste0(
#' "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do"
#' )
#' writeLines(lines, file.path(path, "example.txt"))
#'
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "feat: new file")
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "feat: new file")
#'
#' ## Write again to a file and commit
#' lines2 <- paste0(
#' "eiusmod tempor incididunt ut labore et dolore magna aliqua. ",
#' "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris ",
#' "nisi ut aliquip ex ea commodo consequat."
#' )
#' write(lines2, file.path(path, "example.txt"), append = TRUE)
#' ## Write again to a file and commit
#' lines2 <- paste0(
#' "eiusmod tempor incididunt ut labore et dolore magna aliqua. ",
#' "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris ",
#' "nisi ut aliquip ex ea commodo consequat."
#' )
#' write(lines2, file.path(path, "example.txt"), append = TRUE)
#'
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "refactor: added second phrase")
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "refactor: added second phrase")
#'
#' ## now construct a new autonewsmd object
#' an <- autonewsmd$new(repo_name = "TestRepo", repo_path = path)
#' ## now construct a new autonewsmd object
#' an <- autonewsmd$new(repo_name = "TestRepo", repo_path = path)
#' }
#'
initialize = function(
repo_name,
Expand All @@ -166,40 +172,43 @@ autonewsmd <- R6::R6Class(
#' ## Initialize a repository
#' path <- file.path(tempdir(), "autonewsmd")
#' dir.create(path)
#' repo <- git2r::init(path)
#'
#' ## Config user
#' git2r::config(
#' repo, user.name = "Alice", user.email = "[email protected]"
#' )
#' git2r::remote_set_url(repo, "foobar", "https://example.org/git2r/foobar")
#' if (requireNamespace("git2r", quietly = TRUE)) {
#' repo <- git2r::init(path)
#'
#' ## Config user
#' git2r::config(
#' repo, user.name = "Alice", user.email = "[email protected]"
#' )
#' git2r::remote_set_url(repo, "foobar", "https://example.org/git2r/foobar")
#'
#' ## Write to a file and commit
#' lines <- paste0(
#' "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do"
#' )
#' writeLines(lines, file.path(path, "example.txt"))
#'
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "feat: new file")
#' ## Write to a file and commit
#' lines <- paste0(
#' "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do"
#' )
#' writeLines(lines, file.path(path, "example.txt"))
#'
#' ## Write again to a file and commit
#' lines2 <- paste0(
#' "eiusmod tempor incididunt ut labore et dolore magna aliqua. ",
#' "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris ",
#' "nisi ut aliquip ex ea commodo consequat."
#' )
#' write(lines2, file.path(path, "example.txt"), append = TRUE)
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "feat: new file")
#'
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "refactor: added second phrase")
#' ## Write again to a file and commit
#' lines2 <- paste0(
#' "eiusmod tempor incididunt ut labore et dolore magna aliqua. ",
#' "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris ",
#' "nisi ut aliquip ex ea commodo consequat."
#' )
#' write(lines2, file.path(path, "example.txt"), append = TRUE)
#'
#' ## now construct a new autonewsmd object
#' an <- autonewsmd$new(repo_name = "TestRepo", repo_path = path)
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "refactor: added second phrase")
#'
#' ## generate the news and write them to the repo
#' an$generate()
#' ## now construct a new autonewsmd object
#' an <- autonewsmd$new(repo_name = "TestRepo", repo_path = path)
#'
#' ## generate the news and write them to the repo
#' an$generate()
#' }
#'
generate = function() {
generate_autonewsmd(self, private)
Expand All @@ -223,43 +232,46 @@ autonewsmd <- R6::R6Class(
#' # (Example is based on the public examples from the `git2r` R package)
#' ## Initialize a repository
#' path <- tempdir()
#' repo <- git2r::init(path)
#'
#' ## Config user
#' git2r::config(
#' repo, user.name = "Alice", user.email = "[email protected]"
#' )
#' git2r::remote_set_url(repo, "foobar", "https://example.org/git2r/foobar")
#' if (requireNamespace("git2r", quietly = TRUE)) {
#' repo <- git2r::init(path)
#'
#' ## Config user
#' git2r::config(
#' repo, user.name = "Alice", user.email = "[email protected]"
#' )
#' git2r::remote_set_url(repo, "foobar", "https://example.org/git2r/foobar")
#'
#'
#' ## Write to a file and commit
#' lines <- paste0(
#' "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do"
#' )
#' writeLines(lines, file.path(path, "example.txt"))
#' ## Write to a file and commit
#' lines <- paste0(
#' "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do"
#' )
#' writeLines(lines, file.path(path, "example.txt"))
#'
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "feat: new file")
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "feat: new file")
#'
#' ## Write again to a file and commit
#' lines2 <- paste0(
#' "eiusmod tempor incididunt ut labore et dolore magna aliqua. ",
#' "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris ",
#' "nisi ut aliquip ex ea commodo consequat."
#' )
#' write(lines2, file.path(path, "example.txt"), append = TRUE)
#' ## Write again to a file and commit
#' lines2 <- paste0(
#' "eiusmod tempor incididunt ut labore et dolore magna aliqua. ",
#' "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris ",
#' "nisi ut aliquip ex ea commodo consequat."
#' )
#' write(lines2, file.path(path, "example.txt"), append = TRUE)
#'
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "refactor: added second phrase")
#' git2r::add(repo, "example.txt")
#' git2r::commit(repo, "refactor: added second phrase")
#'
#' ## now construct a new autonewsmd object
#' an <- autonewsmd$new(repo_name = "TestRepo", repo_path = path)
#' ## now construct a new autonewsmd object
#' an <- autonewsmd$new(repo_name = "TestRepo", repo_path = path)
#'
#' ## generate the news and write them to the repo
#' an$generate()
#' ## generate the news and write them to the repo
#' an$generate()
#'
#' if (interactive()) {
#' an$write()
#' if (interactive()) {
#' an$write()
#' }
#' }
#'
write = function(force = FALSE, con = NULL) {
Expand Down
10 changes: 10 additions & 0 deletions R/init_autonewsmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

init_autonewsmd <- function(self, private, repo_name, repo_path, repo_remotes) {
if (!requireNamespace("git2r", quietly = TRUE)) {
stop(
paste0(
"Package \"git2r\" must be installed to use ",
"\"autonewsmd\"."
),
call. = FALSE
)
}

stopifnot(
"`repo_name` must be a character string" = is.character(repo_name),
"`repo_remotes` must be a character string" = ifelse(
Expand Down
2 changes: 2 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## R CMD check results

0 errors | 0 warnings | 0 notes

Addresses the impending ban of git2r from cran.
Loading

0 comments on commit c9b7046

Please sign in to comment.