Skip to content

Commit

Permalink
Add CRAN-RELEASE reminder file
Browse files Browse the repository at this point in the history
Fixes #1198
  • Loading branch information
hadley committed Aug 2, 2017
1 parent b05576d commit b05bd25
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# devtools 1.13.3.9000

* If you use git `release()` now generates a file called `CRAN-RELEASE`
that reminds you to tag the commit that you submitted to CRAN (#1198).

* `release()` once again looks for additional release questions in the
correct environment (#1434).

Expand Down
24 changes: 21 additions & 3 deletions R/release.r
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,8 @@ release <- function(pkg = ".", check = TRUE, args = NULL, spelling = "en_US") {

submit_cran(pkg, args = args)

if (uses_git(pkg$path)) {
message("Don't forget to tag the release when the package is accepted!")
}
flag_release(pkg)

invisible(TRUE)
}

Expand Down Expand Up @@ -322,3 +321,22 @@ upload_cran <- function(pkg, built_path) {
}

as.object_size <- function(x) structure(x, class = "object_size")

flag_release <- function(pkg = ".") {
pkg <- as.package(pkg)
if (!uses_git(pkg$path)) {
return(invisible())
}

message("Don't forget to tag this release once accepted by CRAN")

date <- Sys.Date()
commit <- git2r::commits(git2r::init(pkg$path), n = 1)[[1]]
sha <- substr(commit@sha, 1, 10)

msg <- paste0(
"This package was submitted to CRAN on ", date, ".\n",
"Once it is accepted, delete this file and tag the release (commit ", sha, ")."
)
writeLines(msg, file.path(pkg$path, "CRAN-RELEASE"))
}

0 comments on commit b05bd25

Please # to comment.