Skip to content

Commit

Permalink
Merge branch 'r-lib:main' into challenge-uncommited-tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy authored Aug 5, 2024
2 parents 5958d4a + 1047825 commit 87cd0e9
Show file tree
Hide file tree
Showing 75 changed files with 1,125 additions and 1,127 deletions.
2 changes: 1 addition & 1 deletion .covrignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
R/deprec-*.R
R/compat-*.R
R/usethis-defunct.R
R/usethis-deprecated.R
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: usethis
Title: Automate Package and Project Setup
Version: 2.2.3.9000
Version: 3.0.0.9000
Authors@R: c(
person("Hadley", "Wickham", , "[email protected]", role = "aut",
comment = c(ORCID = "0000-0003-4757-117X")),
Expand Down
11 changes: 1 addition & 10 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export(browse_github_issues)
export(browse_github_pulls)
export(browse_package)
export(browse_project)
export(browse_travis)
export(create_download_url)
export(create_from_github)
export(create_github_token)
Expand All @@ -34,7 +33,6 @@ export(edit_rstudio_snippets)
export(edit_template)
export(gh_token_help)
export(git_branch_default)
export(git_credentials)
export(git_default_branch)
export(git_default_branch_configure)
export(git_default_branch_rediscover)
Expand Down Expand Up @@ -87,8 +85,6 @@ export(use_agpl3_license)
export(use_agpl_license)
export(use_apache_license)
export(use_apl2_license)
export(use_appveyor)
export(use_appveyor_badge)
export(use_article)
export(use_author)
export(use_badge)
Expand Down Expand Up @@ -121,7 +117,6 @@ export(use_devtools)
export(use_directory)
export(use_git)
export(use_git_config)
export(use_git_credentials)
export(use_git_hook)
export(use_git_ignore)
export(use_git_protocol)
Expand Down Expand Up @@ -159,7 +154,6 @@ export(use_partial_warnings)
export(use_pipe)
export(use_pkgdown)
export(use_pkgdown_github_pages)
export(use_pkgdown_travis)
export(use_posit_cloud_badge)
export(use_proprietary_license)
export(use_r)
Expand All @@ -180,9 +174,9 @@ export(use_spell_check)
export(use_standalone)
export(use_template)
export(use_test)
export(use_test_helper)
export(use_testthat)
export(use_tibble)
export(use_tidy_ci)
export(use_tidy_coc)
export(use_tidy_contributing)
export(use_tidy_dependencies)
Expand All @@ -192,14 +186,11 @@ export(use_tidy_github)
export(use_tidy_github_actions)
export(use_tidy_github_labels)
export(use_tidy_issue_template)
export(use_tidy_labels)
export(use_tidy_logo)
export(use_tidy_style)
export(use_tidy_support)
export(use_tidy_thanks)
export(use_tidy_upkeep_issue)
export(use_travis)
export(use_travis_badge)
export(use_tutorial)
export(use_upkeep_issue)
export(use_usethis)
Expand Down
102 changes: 75 additions & 27 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,79 @@
# usethis (development version)

* `browse_github_token()`, `browse_github_pat()`, and `github_token()` have been removed after being deprecated in usethis 2.0.0. `create_github_token()`, `gh::gh_token()`, and `gh_token_help()` should be used instead.
# usethis 3.0.0

* `pr_pull_upstream()` and `pr_sync()` have been removed after being deprecated in usethis 2.0.0. `pr_merge_main()` and `pr_push()` should be used instead.
## Transition to cli package for UI

* `pr_merge_main()` now offers the choice to not open the files with merge conflicts (@olivroy, #1720).
* The `ui_*()` functions have been marked as
[superseded](https://lifecycle.r-lib.org/articles/stages.html#superseded).
External users of these functions are encouraged to use the
[cli package](https://cli.r-lib.org/) instead.
The cli package did not have the required functionality when the
`usethis::ui_*()` functions were first created, but it does now and it's the
superior option.
There is a cli vignette about how to make this transition:
`vignette("usethis-ui", package = "cli")`.
usethis no longer uses the `ui_*()` functions internally, in favor of new
cli-based helpers that are not exported.

## Deprecated function and argument removal

We are removing functions and arguments that were deprecated as of usethis
v2.0.0, which was released in December 2020.

These changes have been in place for a long time now:

* Switch from git2r to gert (+ credentials).
* Use of git config and the gh package to infer, e.g., the target repo spec.
* Pivot towards GitHub Actions and away from Travis and AppVeyor.

Functions that are removed and, where applicable, what to use instead:

* `git_credentials()`
* `use_git_credentials()`
* `browse_github_token()` (do `create_github_token()`)
* `browse_github_pat()` (do `create_github_token()`)
* `github_token()` (do `gh_token_help()` or `gh::gh_token()`)
* `pr_pull_upstream()` (do `pr_merge_main()`)
* `pr_sync()` (do `pr_merge_main(); pr_push()`)
* `use_appveyor()`
* `use_appveyor_badge()`
* `use_travis()`
* `use_travis_badge()`
* `browse_travis()`
* `use_pkgdown_travis()`
* `use_tidy_ci()` *deprecated in v2.1.0* (do `use_tidy_github_actions()`)
* `use_tidy_labels()` *deprecated in v2.1.0* (do `use_tidy_github_labels()`)

Function arguments that are removed:

* `create_from_github(auth_token =, credentials =)`
* `use_github(auth_token =, credentials =)`
* `use_github_labels(repo_spec =, host =, auth_token =)`
* `use_github_links(auth_token =, host =)`
* `use_github_release(host =, auth_token =)`

## Other changes

* `use_zip()` and `use_course()` are equipped to handle a ZIP where the parent
folder is implicit (@burnsal, #1961).

* `use_test_helper()` is a new function to create a test helper file
(@olivroy, #1822).

* `use_cpp11()` makes it easier to update `NAMESPACE` (@pachadotdev, #1921).

* `pr_merge_main()` now offers the choice to not open the files with merge
conflicts (@olivroy, #1720).

* `edit_rstudio_snippets()` now accepts yaml snippets (@olivroy, #1941).

* `use_standalone()` inserts an improved header that includes the code needed to
update the standalone file (@krlmlr, #1903).

* `use_release_issue()` and `use_upkeep()` behave better when the user has a
fork. The user is asked just once to choose between `origin` and `upstream` as
the target repo (#2023).
* `use_release_issue()` and `use_upkeep_issue()` behave better when the user has
a fork. The user is asked just once to choose between `origin` and `upstream`
as the target repo (#2023).

* The README templates now recommend [pak](https://pak.r-lib.org) instead of
devtools for package installation (@olivroy, #1723).
Expand All @@ -23,25 +83,13 @@

* `use_git()` no longer asks if you want to restart RStudio when using Positron.

* `use_test()` and `use_r()` now work when you are in `tests/testthat/_snaps/{foo}.md` (@olivroy, #1988).
* `use_test()` and `use_r()` now work when you are in
`tests/testthat/_snaps/{foo}.md` (@olivroy, #1988).

* The URLs baked into the badge generated by `use_coverage(type = "codecov")`
no longer specify a branch (#2008).

* The `ui_*()` functions have been marked as
[superseded](https://lifecycle.r-lib.org/articles/stages.html#superseded).
External users of these functions are encouraged to use the
[cli package](https://cli.r-lib.org/) instead.
The cli package did not have the required functionality when the
`usethis::ui_*()` functions were first created, but it does now and it's the
superior option.
There is a cli vignette about how to make this transition:
`vignette("usethis-ui", package = "cli")`.

usethis no longer uses the `ui_*()` functions internally, in favor of new
cli-based helpers that are not exported.
are updated and no longer specify a branch(#2008).

* `usethis::use_version()` now tolerates empty / blank lines preceding the
* `usethis::use_version()` now tolerates empty lines preceding the
first section title in the package NEWS file. (#1976)

# usethis 2.2.3
Expand Down Expand Up @@ -206,14 +254,14 @@
* `use_tidy_logo()` is a new function that calls `use_logo()` on the appropriate
hex sticker PNG file at <https://github.com/rstudio/hex-stickers> (#1871).

## Defunct functions
## Deprecated functions

* `use_tidy_eval()` is now defunct because it imports and re-exports a large
* `use_tidy_eval()` is now deprecated because it imports and re-exports a large
number of functions that are no longer needed in order to do tidy
evaluation (#1656).

* `use_travis()`, `use_pkgdown_travis()`, `browse_travis()`, and `use_appveyor()`
are now defunct because we no longer recommend Travis or Appveyor. We
are now deprecated because we no longer recommend Travis or Appveyor. We
recommend GitHub actions instead (#1517).

# usethis 2.1.6
Expand Down Expand Up @@ -531,7 +579,7 @@ GitHub Actions is the preferred platform for continuous integration, because tha

`use_tidy_pkgdown()` implements the complete pkgdown configuration used by the tidyverse team (#224).

`pr_sync()` is defunct and can be replicated by calling `pr_pull()`, `pr_merge_main()`, then `pr_push()`.
`pr_sync()` is deprecated and can be replicated by calling `pr_pull()`, `pr_merge_main()`, then `pr_push()`.

## Licensing improvements

Expand Down Expand Up @@ -1183,7 +1231,7 @@ build paths within it (#415, #425).

* `create_from_github()`: the `repo` argument is renamed to `repo_spec`, since it takes input of the form "OWNER/REPO" (#376).

* `use_depsy_badge()` is defunct. The Depsy project has officially concluded and is no longer being maintained (#354).
* `use_depsy_badge()` is deprecated. The Depsy project has officially concluded and is no longer being maintained (#354).

* `use_github()` fails earlier, with a more informative message, in the absence of a GitHub personal access token (PAT). Also looks for the PAT more proactively in the usual environment variables (i.e., GITHUB_PAT, GITHUB_TOKEN) (#320, #340, @cderv).

Expand Down
10 changes: 0 additions & 10 deletions R/badge.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,6 @@ use_posit_cloud_badge <- function(url) {
invisible(TRUE)
}

#' @rdname badges
#' @export
use_rscloud_badge <- function(url) {
lifecycle::deprecate_warn(
"2.2.0", "use_rscloud_badge()",
"use_posit_cloud_badge()"
)
use_posit_cloud_badge(url)
}

has_badge <- function(href) {
readme_path <- proj_path("README.md")
if (!file_exists(readme_path)) {
Expand Down
3 changes: 0 additions & 3 deletions R/browse.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#' DESCRIPTION file is sought first in the local package library and then
#' on CRAN.
#' * Fixed templates:
#' - Travis CI: `https://travis-ci.{EXT}/{OWNER}/{PACKAGE}`
#' - Circle CI: `https://circleci.com/gh/{OWNER}/{PACKAGE}`
#' - CRAN landing page: `https://cran.r-project.org/package={PACKAGE}`
#' - GitHub mirror of a CRAN package: `https://github.com/cran/{PACKAGE}`
Expand All @@ -29,8 +28,6 @@
#' issue.
#' * `browse_github_pulls()`: Visits the GitHub Pull Request index or one
#' specific pull request.
#' * `browse_travis()`: Visits the project's page on
#' [Travis CI](https://www.travis-ci.com/).
#' * `browse_circleci()`: Visits the project's page on
#' [Circle CI](https://circleci.com).
#' * `browse_cran()`: Visits the package on CRAN, via the canonical URL.
Expand Down
48 changes: 25 additions & 23 deletions R/course.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
#' @param url Link to a ZIP file containing the materials. To reduce the chance
#' of typos in live settings, these shorter forms are accepted:
#'
#' * GitHub repo spec: "OWNER/REPO". Equivalent to
#' `https://github.com/OWNER/REPO/DEFAULT_BRANCH.zip`.
#' * bit.ly or rstd.io shortlinks: "bit.ly/xxx-yyy-zzz" or "rstd.io/foofy".
#' The instructor must then arrange for the shortlink to point to a valid
#' download URL for the target ZIP file. The helper
#' [create_download_url()] helps to create such URLs for GitHub, DropBox,
#' and Google Drive.
#' * GitHub repo spec: "OWNER/REPO". Equivalent to
#' `https://github.com/OWNER/REPO/DEFAULT_BRANCH.zip`.
#' * bit.ly or rstd.io shortlinks: "bit.ly/xxx-yyy-zzz" or "rstd.io/foofy".
#' The instructor must then arrange for the shortlink to point to a valid
#' download URL for the target ZIP file. The helper
#' [create_download_url()] helps to create such URLs for GitHub, DropBox,
#' and Google Drive.
#' @param destdir Destination for the new folder. Defaults to the location
#' stored in the global option `usethis.destdir`, if defined, or to the user's
#' Desktop or similarly conspicuous place otherwise.
Expand Down Expand Up @@ -360,15 +360,15 @@ tidy_unzip <- function(zipfile, cleanup = FALSE) {
## DropBox ZIP files often include lots of hidden R, RStudio, and Git files
filenames <- filenames[keep_lgl(filenames)]

td <- top_directory(filenames)
loose_parts <- is.na(td)

if (loose_parts) {
parents <- path_before_slash(filenames)
unique_parents <- unique(parents)
if (length(unique_parents) == 1 && unique_parents != "") {
target <- path(base_path, unique_parents)
utils::unzip(zipfile, files = filenames, exdir = base_path)
} else {
# there is no parent; archive contains loose parts
target <- path_ext_remove(zipfile)
utils::unzip(zipfile, files = filenames, exdir = target)
} else {
target <- path(base_path, td)
utils::unzip(zipfile, files = filenames, exdir = base_path)
}
ui_bullets(c(
"v" = "Unpacking ZIP file into {.path {pth(target, base_path)}}
Expand Down Expand Up @@ -398,7 +398,7 @@ tidy_unzip <- function(zipfile, cleanup = FALSE) {
}
}

invisible(target)
invisible(unclass(target))
}

#' @rdname use_course_details
Expand Down Expand Up @@ -525,15 +525,17 @@ keep_lgl <- function(file,
!grepl(ignores, file, perl = TRUE)
}

top_directory <- function(filenames) {
in_top <- path_dir(filenames) == "."
unique_top <- unique(filenames[in_top])
is_directory <- grepl("/$", unique_top)
if (length(unique_top) > 1 || !is_directory) {
NA_character_
} else {
unique_top
path_before_slash <- function(filepath) {
f <- function(x) {
parts <- strsplit(x, "/", fixed = TRUE)[[1]]
if (length(parts) > 1 || grepl("/", x)) {
parts[1]
} else {
""
}
}
purrr::map_chr(filepath, f)

}

content_type <- function(h) {
Expand Down
2 changes: 1 addition & 1 deletion R/coverage.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use_covr_ignore <- function(files) {
}

use_codecov_badge <- function(repo_spec) {
url <- glue("https://codecov.io/gh/{repo_spec}")
url <- glue("https://app.codecov.io/gh/{repo_spec}")
img <- glue("https://codecov.io/gh/{repo_spec}/graph/badge.svg")
use_badge("Codecov test coverage", url, img)
}
Expand Down
1 change: 1 addition & 0 deletions R/cpp11.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use_cpp11 <- function() {
check_is_package("use_cpp11()")
check_installed("cpp11")
check_uses_roxygen("use_cpp11()")
check_has_package_doc("use_cpp11()")
use_src()

use_dependency("cpp11", "LinkingTo")
Expand Down
10 changes: 1 addition & 9 deletions R/create.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,7 @@ create_from_github <- function(repo_spec,
rstudio = NULL,
open = rlang::is_interactive(),
protocol = git_protocol(),
host = NULL,
auth_token = deprecated(),
credentials = deprecated()) {
if (lifecycle::is_present(auth_token)) {
deprecate_warn_auth_token("create_from_github")
}
if (lifecycle::is_present(credentials)) {
deprecate_warn_credentials("create_from_github")
}
host = NULL) {
check_protocol(protocol)

parsed_repo_spec <- parse_repo_url(repo_spec)
Expand Down
Loading

0 comments on commit 87cd0e9

Please sign in to comment.