Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* New `check_mac_devel()` function to check a package using the macOS builder at https://mac.r-project.org/macbuilder/submit.html (@nfrerebeau, #2507)
* `is_loading()` is now re-exported from pkgload (#2556).
* `load_all()` now errors if called recursively, i.e. if you accidentally include a `load_all()` call in one of your R source files (#2617).
* `release()` is deprecated in favour of `usethis::use_release_issue()`.
* `show_news()` now looks for NEWS files in the same locations as `utils::news()`: `inst/NEWS.Rd`, `NEWS.md`, `NEWS`, and `inst/NEWS` (@arcresu, #2499).

# devtools 2.4.6
Expand Down
36 changes: 19 additions & 17 deletions R/release.R
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
#' Release package to CRAN.
#'
#' Run automated and manual tests, then post package to CRAN.
#'
#' The package release process will:
#'
#' * Confirm that the package passes `R CMD check` on relevant platforms
#' * Confirm that important files are up-to-date
#' * Build the package
#' * Submit the package to CRAN, using comments in "cran-comments.md"
#'
#' You can add arbitrary extra questions by defining an (un-exported) function
#' called `release_questions()` that returns a character vector
#' of additional questions to ask.
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' You also need to read the CRAN repository policy at
#' 'https://cran.r-project.org/web/packages/policies.html' and make
#' sure you're in line with the policies. `release` tries to automate as
#' many of polices as possible, but it's impossible to be completely
#' comprehensive, and they do change in between releases of devtools.
#' `release()` is deprecated in favour of [usethis::use_release_issue()].
#' We no longer feel confident recommrding `release()` because we don't use it
#' ourselves, so there's no guarantee that it will track best practices as
#' they evolve over time.
#'
#' @template devtools
#' @param check if `TRUE`, run checking, otherwise omit it. This
Expand All @@ -29,6 +18,15 @@
#' tasks that you can use in addition to or in place of `release`.
#' @export
release <- function(pkg = ".", check = FALSE, args = NULL) {
lifecycle::deprecate_warn(
"2.5.0",
"release()",
"usethis::use_release_issue()"
)
if (!rlang::is_interactive()) {
cli::cli_abort("Interactive session required.")
}

pkg <- as.package(pkg)
# Figure out if this is a new package
cran_version <- cran_pkg_version(pkg$package)
Expand Down Expand Up @@ -159,6 +157,10 @@ find_release_questions <- function(pkg = ".") {
}

yesno <- function(msg, .envir = parent.frame()) {
if (!rlang::is_interactive()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimal fix to make this testable interactively. Already an error in real non-interactive contexts because menu() will error.

cli::cli_abort("Called from non-interactive context.")
}

yeses <- c(
"Yes",
"Definitely",
Expand Down
5 changes: 4 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ reference:
- document
- load_all
- reload
- release
- spell_check
- test
- title: Package Installation
Expand All @@ -49,6 +48,10 @@ reference:
- wd
- save_all

- title: Deprecated functions
contents:
- release

news:
releases:
- text: "Version 2.2.1"
Expand Down
24 changes: 5 additions & 19 deletions man/release.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions tests/testthat/_snaps/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# release() is deprecated

Code
. <- release()
Condition
Warning:
`release()` was deprecated in devtools 2.5.0.
i Please use `usethis::use_release_issue()` instead.
Error in `release()`:
! Interactive session required.

3 changes: 3 additions & 0 deletions tests/testthat/test-release.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test_that("release() is deprecated", {
expect_snapshot(. <- release(), error = TRUE)
})