Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_tidy_dependencies #2503

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 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
31 changes: 16 additions & 15 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Authors@R: c(
person("Winston", "Chang", role = "aut"),
person("Jennifer", "Bryan", , "jenny@posit.co", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-6983-2759")),
person(given = "Posit, PBC", role = c("cph", "fnd"))
person(given = "Posit Software, PBC", role = c("cph", "fnd"))
)
Description: Collection of package development tools.
License: MIT + file LICENSE
Expand All @@ -17,48 +17,49 @@ Depends:
R (>= 3.0.2),
usethis (>= 2.1.6)
Imports:
cli (>= 3.3.0),
desc (>= 1.4.1),
callr (>= 3.7.3),
cli (>= 3.6.0),
desc (>= 1.4.2),
ellipsis (>= 0.3.2),
fs (>= 1.5.2),
lifecycle (>= 1.0.1),
fs (>= 1.6.1),
glue (>= 1.6.2),
httr (>= 1.4.5),
lifecycle (>= 1.0.3),
memoise (>= 2.0.1),
miniUI (>= 0.1.1.1),
pkgbuild (>= 1.3.1),
pkgdown (>= 2.0.6),
pkgload (>= 1.3.0),
pkgbuild (>= 1.4.0),
pkgdown (>= 2.0.7),
pkgload (>= 1.3.2),
profvis (>= 0.3.7),
rcmdcheck (>= 1.4.0),
remotes (>= 2.4.2),
rlang (>= 1.0.4),
roxygen2 (>= 7.2.1),
rversions (>= 2.1.1),
rlang (>= 1.0.6),
roxygen2 (>= 7.2.3),
rstudioapi (>= 0.14),
rversions (>= 2.1.2),
sessioninfo (>= 1.2.2),
stats,
testthat (>= 3.1.5),
testthat (>= 3.1.6),
tools,
urlchecker (>= 1.0.1),
utils,
withr (>= 2.5.0)
Suggests:
BiocManager (>= 1.30.18),
callr (>= 3.7.1),
covr (>= 3.5.1),
curl (>= 4.3.2),
digest (>= 0.6.29),
DT (>= 0.23),
foghorn (>= 1.4.2),
gh (>= 1.3.0),
gmailr (>= 1.0.1),
httr (>= 1.4.3),
knitr (>= 1.39),
lintr (>= 3.0.0),
MASS,
mockery (>= 0.4.3),
pingr (>= 2.0.1),
rhub (>= 1.1.1),
rmarkdown (>= 2.14),
rstudioapi (>= 0.13),
spelling (>= 2.2)
VignetteBuilder:
knitr
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ export(uses_testthat)
export(wd)
export(with_debug)
import(fs)
import(rlang)
ateucher marked this conversation as resolved.
Show resolved Hide resolved
importFrom(cli,cat_bullet)
importFrom(cli,cat_rule)
importFrom(ellipsis,check_dots_used)
importFrom(glue,glue)
importFrom(lifecycle,deprecated)
importFrom(memoise,memoise)
importFrom(miniUI,miniPage)
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# devtools (development version)

* Copyright holder is now "Posit Software, PBC".

* We have updated the Contributor Code of Conduct and changed the contact
email to codeofconduct@posit.co.

* Internally we are now using glue and purrr-like functionality from
`usethis::use_standalone("r-lib/rlang", "purrr")` for consistency.
ateucher marked this conversation as resolved.
Show resolved Hide resolved

# devtools 2.4.5

* `check(cleanup =)` was deprecated in devtools v1.11.0 (2016-04-12) and was
Expand Down
2 changes: 1 addition & 1 deletion R/active.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ find_test_file <- function(path, call = parent.frame()) {
}

is_test <- type == "test"
path[!is_test] <- paste0("tests/testthat/test-", name_source(path[!is_test]), ".R")
path[!is_test] <- glue("tests/testthat/test-{name_source(path[!is_test])}.R")
path <- unique(path[file_exists(path)])

if (length(path) == 0) {
Expand Down
4 changes: 2 additions & 2 deletions R/build-manual.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
build_manual <- function(pkg = ".", path = NULL) {
pkg <- as.package(pkg)
path <- path %||% path_dir(pkg$path)
name <- paste0(pkg$package, "_", pkg$version, ".pdf", collapse = " ")
name <- glue("{pkg$package}_{pkg$version}.pdf")
tryCatch(msg <- callr::rcmd("Rd2pdf", cmdargs = c(
"--force",
paste0("--output=", path, "/", name),
glue("--output={path}/{name}"),
pkg$path
), fail_on_status = TRUE, stderr = "2>&1", spinner = FALSE),
error = function(e) {
Expand Down
4 changes: 2 additions & 2 deletions R/build-readme.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build_rmd <- function(files, path = ".", output_options = list(), ..., quiet = T

pkg <- as.package(path)

rlang::check_installed("rmarkdown")
check_installed("rmarkdown")
save_all()

paths <- files
Expand Down Expand Up @@ -53,7 +53,7 @@ build_rmd <- function(files, path = ".", output_options = list(), ..., quiet = T
build_readme <- function(path = ".", quiet = TRUE, ...) {
pkg <- as.package(path)

regexp <- paste0(path_file(pkg$path), "/(inst/)?readme[.]rmd")
regexp <- glue("{path_file(pkg$path)}/(inst/)?readme[.]rmd")
readme_path <- path_abs(dir_ls(pkg$path, ignore.case = TRUE, regexp = regexp, recurse = 1, type = "file"))

if (length(readme_path) == 0) {
Expand Down
2 changes: 1 addition & 1 deletion R/build-site.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @return NULL
#' @export
build_site <- function(path = ".", quiet = TRUE, ...) {
rlang::check_installed("pkgdown")
check_installed("pkgdown")

save_all()

Expand Down
14 changes: 7 additions & 7 deletions R/check-devtools.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @export
release_checks <- function(pkg = ".", built_path = NULL) {
pkg <- as.package(pkg)
cat_rule(paste0("Running additional devtools checks for ", pkg$package))
cat_rule(glue("Running additional devtools checks for {pkg$package}"))

check_version(pkg)
check_dev_versions(pkg)
Expand All @@ -23,13 +23,13 @@ check_dev_versions <- function(pkg = ".") {
pkg <- as.package(pkg)

dep_list <- pkg[tolower(remotes::standardise_dep(TRUE))]
deps <- do.call("rbind", unname(compact(lapply(dep_list, parse_deps))))
deps <- do.call("rbind", unname(compact(map(dep_list, parse_deps))))
deps <- deps[!is.na(deps$version), , drop = FALSE]

parsed <- lapply(deps$version, function(x) unlist(numeric_version(x)))
parsed <- map(deps$version, function(x) unlist(numeric_version(x)))

lengths <- vapply(parsed, length, integer(1))
last_ver <- vapply(parsed, function(x) x[[length(x)]], integer(1))
lengths <- map_int(parsed, length)
last_ver <- map_int(parsed, function(x) x[[length(x)]])

is_dev <- lengths == 4 & last_ver >= 9000

Expand All @@ -52,7 +52,7 @@ check_version <- function(pkg = ".") {
check_status(
length(ver) == 3,
"version number has three components",
paste0("version (", pkg$version, ") should have exactly three components")
glue("version ({pkg$version}) should have exactly three components")
)
}

Expand All @@ -66,7 +66,7 @@ check_vignette_titles <- function(pkg = ".") {
any(grepl("Vignette Title", h))
}
v <- stats::setNames(vigns$docs, path_file(vigns$docs))
has_vt <- vapply(v, has_vignette_title, logical(1), n = 30)
has_vt <- map_lgl(v, has_vignette_title, n = 30)

check_status(
!any(has_vt),
Expand Down
2 changes: 1 addition & 1 deletion R/check-git.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @keywords internal
git_checks <- function(pkg = ".") {
pkg <- as.package(pkg)
cat_rule(paste0("Running Git checks for ", pkg$package))
cat_rule(glue("Running Git checks for {pkg$package}"))

git_report_branch(pkg)
git_check_uncommitted(pkg)
Expand Down
2 changes: 1 addition & 1 deletion R/check-mac.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, ma
body <- list(pkgfile = httr::upload_file(built_path))

if (length(dep_built_paths) > 0) {
uploads <- lapply(dep_built_paths, httr::upload_file)
uploads <- map(dep_built_paths, httr::upload_file)
names(uploads) <- rep("depfiles", length(uploads))
body <- append(body, uploads)
}
Expand Down
11 changes: 5 additions & 6 deletions R/check-win.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ check_win <- function(pkg = ".", version = c("R-devel", "R-release", "R-oldrelea
)
on.exit(file_delete(built_path), add = TRUE)

url <- paste0(
"ftp://win-builder.r-project.org/", version, "/",
path_file(built_path)
url <- glue(
"ftp://win-builder.r-project.org/{version}/{path_file(built_path)}"
)
lapply(url, upload_ftp, file = built_path)
map(url, upload_ftp, file = built_path)

if (!quiet) {
time <- strftime(Sys.time() + 30 * 60, "%I:%M %p")
Expand Down Expand Up @@ -127,15 +126,15 @@ change_maintainer_email <- function(path, email, call = parent.frame()) {
if (!is.list(roles)) {
roles <- list(roles)
}
is_maintainer <- vapply(roles, function(r) all("cre" %in% r), logical(1))
is_maintainer <- map_lgl(roles, function(r) all("cre" %in% r))
aut[is_maintainer]$email <- email
desc$set_authors(aut)

desc$write()
}

upload_ftp <- function(file, url, verbose = FALSE) {
rlang::check_installed("curl")
check_installed("curl")

stopifnot(file_exists(file))
stopifnot(is.character(url))
Expand Down
2 changes: 1 addition & 1 deletion R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,5 @@ aspell_env_var <- function() {

show_env_vars <- function(env_vars) {
cli::cat_line("Setting env vars:", col = "darkgrey")
cat_bullet(paste0(format(names(env_vars)), ": ", unname(env_vars)), col = "darkgrey")
cat_bullet(glue("{format(names(env_vars))}: {unname(env_vars)}"), col = "darkgrey")
}
2 changes: 1 addition & 1 deletion R/dev-mode.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ is_library <- function(path) {
dirs <- dir_ls(path, type = "directory")

has_pkg_dir <- function(path) length(dir_ls(path, regexp = "Meta")) > 0
help_dirs <- vapply(dirs, has_pkg_dir, logical(1))
help_dirs <- map_lgl(dirs, has_pkg_dir)

all(help_dirs)
}
2 changes: 2 additions & 0 deletions R/devtools-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"_PACKAGE"

## usethis namespace: start
#' @import rlang
#' @importFrom glue glue
#' @importFrom lifecycle deprecated
#' @importFrom miniUI miniPage
#' @importFrom profvis profvis
Expand Down
Loading