diff --git a/NEWS.md b/NEWS.md index 3d9740ba0..c0744185e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # devtools (development version) +* `bash()`, `create()`, `missing_s3()`, `reload()`, `show_news()`, and `wd()` are now deprecated. These functions are all historical parts of our workflow that we no longer use or recommend. `create()` is superseded by `usethis::create_package()`. * `build_manual()` reports more details on failure (#2586). * 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). diff --git a/R/bash.R b/R/bash.R index eb216c26a..58dbb25fd 100644 --- a/R/bash.R +++ b/R/bash.R @@ -1,8 +1,15 @@ -#' Open bash shell in package directory. +#' Open bash shell in package directory +#' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `bash()` is deprecated because we no longer use or recommend this workflow. #' #' @template devtools #' @export +#' @keywords internal bash <- function(pkg = ".") { + lifecycle::deprecate_warn("2.5.0", "bash()") pkg <- as.package(pkg) withr::with_dir(pkg$path, system("bash")) diff --git a/R/create.R b/R/create.R index 8d1196332..977e95b25 100644 --- a/R/create.R +++ b/R/create.R @@ -1,11 +1,19 @@ #' Create a package #' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `create()` is deprecated. Please use [usethis::create_package()] directly +#' instead. +#' #' @param path A path. If it exists, it is used. If it does not exist, it is #' created, provided that the parent path exists. #' @param ... Additional arguments passed to [usethis::create_package()] #' @inheritParams usethis::create_package #' @return The path to the created package, invisibly. #' @export +#' @keywords internal create <- function(path, ..., open = FALSE) { + lifecycle::deprecate_warn("2.5.0", "create()", "usethis::create_package()") usethis::create_package(path, ..., open = open) } diff --git a/R/missing-s3.R b/R/missing-s3.R index beb9d8bca..9bb5cc9f7 100644 --- a/R/missing-s3.R +++ b/R/missing-s3.R @@ -1,10 +1,17 @@ -#' Find missing s3 exports. +#' Find missing s3 exports #' -#' The method is heuristic - looking for objs with a period in their name. +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `missing_s3()` is deprecated because roxygen2 now provides the same +#' functionality. Run `devtools::document()` and look for +#' `"Missing documentation for S3 method"` warnings. #' #' @template devtools #' @export +#' @keywords internal missing_s3 <- function(pkg = ".") { + lifecycle::deprecate_warn("2.5.0", "missing_s3()") pkg <- as.package(pkg) loaded <- load_all(pkg$path) diff --git a/R/reload.R b/R/reload.R index 5624e79be..dc7ef2b11 100644 --- a/R/reload.R +++ b/R/reload.R @@ -1,28 +1,19 @@ -#' Unload and reload package. +#' Unload and reload package #' -#' This attempts to unload and reload an _installed_ package. If the package is -#' not loaded already, it does nothing. It's not always possible to cleanly -#' unload a package: see the caveats in [unload()] for some of the potential -#' failure points. If in doubt, restart R and reload the package with -#' [library()]. +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `reload()` is deprecated because we no longer use or recommend this +#' workflow. Instead, we recommend [load_all()] to load a package for +#' interactive development. #' #' @template devtools #' @param quiet if `TRUE` suppresses output from this function. #' @seealso [load_all()] to load a package for interactive development. -#' @examples -#' \dontrun{ -#' # Reload package that is in current directory -#' reload(".") -#' -#' # Reload package that is in ./ggplot2/ -#' reload("ggplot2/") -#' -#' # Can use inst() to find the package path -#' # This will reload the installed ggplot2 package -#' reload(pkgload::inst("ggplot2")) -#' } #' @export +#' @keywords internal reload <- function(pkg = ".", quiet = FALSE) { + lifecycle::deprecate_warn("2.5.0", "reload()", "load_all()") pkg <- as.package(pkg) if (is_attached(pkg)) { diff --git a/R/show-news.R b/R/show-news.R index 15cbc6411..0b5af0616 100644 --- a/R/show-news.R +++ b/R/show-news.R @@ -1,11 +1,19 @@ #' Show package news #' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `show_news()` is deprecated because we no longer use or recommend this +#' workflow. +#' #' @template devtools #' @param latest if `TRUE`, only show the news for the most recent #' version. #' @param ... other arguments passed on to `news` #' @export +#' @keywords internal show_news <- function(pkg = ".", latest = TRUE, ...) { + lifecycle::deprecate_warn("2.5.0", "show_news()") pkg <- as.package(pkg) news_path <- find_news(pkg$path) diff --git a/R/wd.R b/R/wd.R index 0b3be83f3..502a4bef8 100644 --- a/R/wd.R +++ b/R/wd.R @@ -1,10 +1,17 @@ -#' Set working directory. +#' Set working directory +#' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `wd()` is deprecated because we no longer use or recommend this workflow. #' #' @template devtools #' @param path path within package. Leave empty to change working directory #' to package directory. #' @export +#' @keywords internal wd <- function(pkg = ".", path = "") { + lifecycle::deprecate_warn("2.5.0", "wd()") pkg <- as.package(pkg) path <- path(pkg$path, path) diff --git a/_pkgdown.yml b/_pkgdown.yml index 2cb2f760c..df9a8fa7f 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -22,10 +22,8 @@ reference: - starts_with("build_") - starts_with("check_") - check - - create - document - load_all - - reload - release - spell_check - test @@ -35,19 +33,24 @@ reference: - uninstall - title: Utilities contents: - - bash - clean_vignettes - dev_sitrep - github_pull - lint - - missing_s3 - run_examples - session_info - - show_news - starts_with("source_") - update_packages - - wd - save_all +- title: Deprecated + contents: + - bash + - create + - dev_mode + - missing_s3 + - reload + - show_news + - wd news: releases: diff --git a/man/bash.Rd b/man/bash.Rd index 316e37533..cb2654bc1 100644 --- a/man/bash.Rd +++ b/man/bash.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/bash.R \name{bash} \alias{bash} -\title{Open bash shell in package directory.} +\title{Open bash shell in package directory} \usage{ bash(pkg = ".") } @@ -11,5 +11,8 @@ bash(pkg = ".") package object. See \code{\link[=as.package]{as.package()}} for more information.} } \description{ -Open bash shell in package directory. +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +\code{bash()} is deprecated because we no longer use or recommend this workflow. } +\keyword{internal} diff --git a/man/create.Rd b/man/create.Rd index 168416b87..a77490fd7 100644 --- a/man/create.Rd +++ b/man/create.Rd @@ -25,5 +25,9 @@ session are changed to the new project. The path to the created package, invisibly. } \description{ -Create a package +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +\code{create()} is deprecated. Please use \code{\link[usethis:create_package]{usethis::create_package()}} directly +instead. } +\keyword{internal} diff --git a/man/missing_s3.Rd b/man/missing_s3.Rd index 8ad6fcf1b..bbeb2ccb8 100644 --- a/man/missing_s3.Rd +++ b/man/missing_s3.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/missing-s3.R \name{missing_s3} \alias{missing_s3} -\title{Find missing s3 exports.} +\title{Find missing s3 exports} \usage{ missing_s3(pkg = ".") } @@ -11,5 +11,10 @@ missing_s3(pkg = ".") package object. See \code{\link[=as.package]{as.package()}} for more information.} } \description{ -The method is heuristic - looking for objs with a period in their name. +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +\code{missing_s3()} is deprecated because roxygen2 now provides the same +functionality. Run \code{devtools::document()} and look for +\code{"Missing documentation for S3 method"} warnings. } +\keyword{internal} diff --git a/man/reload.Rd b/man/reload.Rd index 33dd5aa0f..91d922d41 100644 --- a/man/reload.Rd +++ b/man/reload.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/reload.R \name{reload} \alias{reload} -\title{Unload and reload package.} +\title{Unload and reload package} \usage{ reload(pkg = ".", quiet = FALSE) } @@ -13,25 +13,13 @@ package object. See \code{\link[=as.package]{as.package()}} for more informatio \item{quiet}{if \code{TRUE} suppresses output from this function.} } \description{ -This attempts to unload and reload an \emph{installed} package. If the package is -not loaded already, it does nothing. It's not always possible to cleanly -unload a package: see the caveats in \code{\link[=unload]{unload()}} for some of the potential -failure points. If in doubt, restart R and reload the package with -\code{\link[=library]{library()}}. -} -\examples{ -\dontrun{ -# Reload package that is in current directory -reload(".") - -# Reload package that is in ./ggplot2/ -reload("ggplot2/") +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} -# Can use inst() to find the package path -# This will reload the installed ggplot2 package -reload(pkgload::inst("ggplot2")) -} +\code{reload()} is deprecated because we no longer use or recommend this +workflow. Instead, we recommend \code{\link[=load_all]{load_all()}} to load a package for +interactive development. } \seealso{ \code{\link[=load_all]{load_all()}} to load a package for interactive development. } +\keyword{internal} diff --git a/man/show_news.Rd b/man/show_news.Rd index a5b925597..464e16af3 100644 --- a/man/show_news.Rd +++ b/man/show_news.Rd @@ -16,5 +16,9 @@ version.} \item{...}{other arguments passed on to \code{news}} } \description{ -Show package news +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +\code{show_news()} is deprecated because we no longer use or recommend this +workflow. } +\keyword{internal} diff --git a/man/wd.Rd b/man/wd.Rd index 19204993a..a551376d0 100644 --- a/man/wd.Rd +++ b/man/wd.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/wd.R \name{wd} \alias{wd} -\title{Set working directory.} +\title{Set working directory} \usage{ wd(pkg = ".", path = "") } @@ -14,5 +14,8 @@ package object. See \code{\link[=as.package]{as.package()}} for more informatio to package directory.} } \description{ -Set working directory. +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +\code{wd()} is deprecated because we no longer use or recommend this workflow. } +\keyword{internal} diff --git a/tests/testthat/test-reload.R b/tests/testthat/test-reload.R index 002f309c3..e4079436f 100644 --- a/tests/testthat/test-reload.R +++ b/tests/testthat/test-reload.R @@ -1,4 +1,5 @@ test_that("reload works", { + withr::local_options(lifecycle_verbosity = "quiet") withr::local_temp_libpaths() pkg <- as.package(test_path("testTest")) diff --git a/tests/testthat/test-show-news.R b/tests/testthat/test-show-news.R index 3691da53f..5e013cee7 100644 --- a/tests/testthat/test-show-news.R +++ b/tests/testthat/test-show-news.R @@ -16,6 +16,7 @@ test_that("find_news() finds NEWS in all expected locations", { }) test_that("fails when NEWS is missing or improperly formatted", { + withr::local_options(lifecycle_verbosity = "quiet") skip_on_cran() skip_unless_r(">= 4.2.0") # different error message