Skip to content

Commit 87cd0e9

Browse files
authored
Merge branch 'r-lib:main' into challenge-uncommited-tweaks
2 parents 5958d4a + 1047825 commit 87cd0e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1125
-1127
lines changed

.covrignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
R/deprec-*.R
22
R/compat-*.R
3-
R/usethis-defunct.R
3+
R/usethis-deprecated.R

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: usethis
22
Title: Automate Package and Project Setup
3-
Version: 2.2.3.9000
3+
Version: 3.0.0.9000
44
Authors@R: c(
55
person("Hadley", "Wickham", , "[email protected]", role = "aut",
66
comment = c(ORCID = "0000-0003-4757-117X")),

NAMESPACE

+1-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export(browse_github_issues)
1414
export(browse_github_pulls)
1515
export(browse_package)
1616
export(browse_project)
17-
export(browse_travis)
1817
export(create_download_url)
1918
export(create_from_github)
2019
export(create_github_token)
@@ -34,7 +33,6 @@ export(edit_rstudio_snippets)
3433
export(edit_template)
3534
export(gh_token_help)
3635
export(git_branch_default)
37-
export(git_credentials)
3836
export(git_default_branch)
3937
export(git_default_branch_configure)
4038
export(git_default_branch_rediscover)
@@ -87,8 +85,6 @@ export(use_agpl3_license)
8785
export(use_agpl_license)
8886
export(use_apache_license)
8987
export(use_apl2_license)
90-
export(use_appveyor)
91-
export(use_appveyor_badge)
9288
export(use_article)
9389
export(use_author)
9490
export(use_badge)
@@ -121,7 +117,6 @@ export(use_devtools)
121117
export(use_directory)
122118
export(use_git)
123119
export(use_git_config)
124-
export(use_git_credentials)
125120
export(use_git_hook)
126121
export(use_git_ignore)
127122
export(use_git_protocol)
@@ -159,7 +154,6 @@ export(use_partial_warnings)
159154
export(use_pipe)
160155
export(use_pkgdown)
161156
export(use_pkgdown_github_pages)
162-
export(use_pkgdown_travis)
163157
export(use_posit_cloud_badge)
164158
export(use_proprietary_license)
165159
export(use_r)
@@ -180,9 +174,9 @@ export(use_spell_check)
180174
export(use_standalone)
181175
export(use_template)
182176
export(use_test)
177+
export(use_test_helper)
183178
export(use_testthat)
184179
export(use_tibble)
185-
export(use_tidy_ci)
186180
export(use_tidy_coc)
187181
export(use_tidy_contributing)
188182
export(use_tidy_dependencies)
@@ -192,14 +186,11 @@ export(use_tidy_github)
192186
export(use_tidy_github_actions)
193187
export(use_tidy_github_labels)
194188
export(use_tidy_issue_template)
195-
export(use_tidy_labels)
196189
export(use_tidy_logo)
197190
export(use_tidy_style)
198191
export(use_tidy_support)
199192
export(use_tidy_thanks)
200193
export(use_tidy_upkeep_issue)
201-
export(use_travis)
202-
export(use_travis_badge)
203194
export(use_tutorial)
204195
export(use_upkeep_issue)
205196
export(use_usethis)

NEWS.md

+75-27
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,79 @@
11
# usethis (development version)
22

3-
* `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.
3+
# usethis 3.0.0
44

5-
* `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.
5+
## Transition to cli package for UI
66

7-
* `pr_merge_main()` now offers the choice to not open the files with merge conflicts (@olivroy, #1720).
7+
* The `ui_*()` functions have been marked as
8+
[superseded](https://lifecycle.r-lib.org/articles/stages.html#superseded).
9+
External users of these functions are encouraged to use the
10+
[cli package](https://cli.r-lib.org/) instead.
11+
The cli package did not have the required functionality when the
12+
`usethis::ui_*()` functions were first created, but it does now and it's the
13+
superior option.
14+
There is a cli vignette about how to make this transition:
15+
`vignette("usethis-ui", package = "cli")`.
16+
usethis no longer uses the `ui_*()` functions internally, in favor of new
17+
cli-based helpers that are not exported.
18+
19+
## Deprecated function and argument removal
20+
21+
We are removing functions and arguments that were deprecated as of usethis
22+
v2.0.0, which was released in December 2020.
23+
24+
These changes have been in place for a long time now:
25+
26+
* Switch from git2r to gert (+ credentials).
27+
* Use of git config and the gh package to infer, e.g., the target repo spec.
28+
* Pivot towards GitHub Actions and away from Travis and AppVeyor.
29+
30+
Functions that are removed and, where applicable, what to use instead:
31+
32+
* `git_credentials()`
33+
* `use_git_credentials()`
34+
* `browse_github_token()` (do `create_github_token()`)
35+
* `browse_github_pat()` (do `create_github_token()`)
36+
* `github_token()` (do `gh_token_help()` or `gh::gh_token()`)
37+
* `pr_pull_upstream()` (do `pr_merge_main()`)
38+
* `pr_sync()` (do `pr_merge_main(); pr_push()`)
39+
* `use_appveyor()`
40+
* `use_appveyor_badge()`
41+
* `use_travis()`
42+
* `use_travis_badge()`
43+
* `browse_travis()`
44+
* `use_pkgdown_travis()`
45+
* `use_tidy_ci()` *deprecated in v2.1.0* (do `use_tidy_github_actions()`)
46+
* `use_tidy_labels()` *deprecated in v2.1.0* (do `use_tidy_github_labels()`)
47+
48+
Function arguments that are removed:
49+
50+
* `create_from_github(auth_token =, credentials =)`
51+
* `use_github(auth_token =, credentials =)`
52+
* `use_github_labels(repo_spec =, host =, auth_token =)`
53+
* `use_github_links(auth_token =, host =)`
54+
* `use_github_release(host =, auth_token =)`
55+
56+
## Other changes
57+
58+
* `use_zip()` and `use_course()` are equipped to handle a ZIP where the parent
59+
folder is implicit (@burnsal, #1961).
60+
61+
* `use_test_helper()` is a new function to create a test helper file
62+
(@olivroy, #1822).
63+
64+
* `use_cpp11()` makes it easier to update `NAMESPACE` (@pachadotdev, #1921).
65+
66+
* `pr_merge_main()` now offers the choice to not open the files with merge
67+
conflicts (@olivroy, #1720).
868

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

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

14-
* `use_release_issue()` and `use_upkeep()` behave better when the user has a
15-
fork. The user is asked just once to choose between `origin` and `upstream` as
16-
the target repo (#2023).
74+
* `use_release_issue()` and `use_upkeep_issue()` behave better when the user has
75+
a fork. The user is asked just once to choose between `origin` and `upstream`
76+
as the target repo (#2023).
1777

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

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

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

2889
* The URLs baked into the badge generated by `use_coverage(type = "codecov")`
29-
no longer specify a branch (#2008).
30-
31-
* The `ui_*()` functions have been marked as
32-
[superseded](https://lifecycle.r-lib.org/articles/stages.html#superseded).
33-
External users of these functions are encouraged to use the
34-
[cli package](https://cli.r-lib.org/) instead.
35-
The cli package did not have the required functionality when the
36-
`usethis::ui_*()` functions were first created, but it does now and it's the
37-
superior option.
38-
There is a cli vignette about how to make this transition:
39-
`vignette("usethis-ui", package = "cli")`.
40-
41-
usethis no longer uses the `ui_*()` functions internally, in favor of new
42-
cli-based helpers that are not exported.
90+
are updated and no longer specify a branch(#2008).
4391

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

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

209-
## Defunct functions
257+
## Deprecated functions
210258

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

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

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

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

534-
`pr_sync()` is defunct and can be replicated by calling `pr_pull()`, `pr_merge_main()`, then `pr_push()`.
582+
`pr_sync()` is deprecated and can be replicated by calling `pr_pull()`, `pr_merge_main()`, then `pr_push()`.
535583

536584
## Licensing improvements
537585

@@ -1183,7 +1231,7 @@ build paths within it (#415, #425).
11831231
11841232
* `create_from_github()`: the `repo` argument is renamed to `repo_spec`, since it takes input of the form "OWNER/REPO" (#376).
11851233
1186-
* `use_depsy_badge()` is defunct. The Depsy project has officially concluded and is no longer being maintained (#354).
1234+
* `use_depsy_badge()` is deprecated. The Depsy project has officially concluded and is no longer being maintained (#354).
11871235
11881236
* `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).
11891237

R/badge.R

-10
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,6 @@ use_posit_cloud_badge <- function(url) {
165165
invisible(TRUE)
166166
}
167167

168-
#' @rdname badges
169-
#' @export
170-
use_rscloud_badge <- function(url) {
171-
lifecycle::deprecate_warn(
172-
"2.2.0", "use_rscloud_badge()",
173-
"use_posit_cloud_badge()"
174-
)
175-
use_posit_cloud_badge(url)
176-
}
177-
178168
has_badge <- function(href) {
179169
readme_path <- proj_path("README.md")
180170
if (!file_exists(readme_path)) {

R/browse.R

-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#' DESCRIPTION file is sought first in the local package library and then
1010
#' on CRAN.
1111
#' * Fixed templates:
12-
#' - Travis CI: `https://travis-ci.{EXT}/{OWNER}/{PACKAGE}`
1312
#' - Circle CI: `https://circleci.com/gh/{OWNER}/{PACKAGE}`
1413
#' - CRAN landing page: `https://cran.r-project.org/package={PACKAGE}`
1514
#' - GitHub mirror of a CRAN package: `https://github.com/cran/{PACKAGE}`
@@ -29,8 +28,6 @@
2928
#' issue.
3029
#' * `browse_github_pulls()`: Visits the GitHub Pull Request index or one
3130
#' specific pull request.
32-
#' * `browse_travis()`: Visits the project's page on
33-
#' [Travis CI](https://www.travis-ci.com/).
3431
#' * `browse_circleci()`: Visits the project's page on
3532
#' [Circle CI](https://circleci.com).
3633
#' * `browse_cran()`: Visits the package on CRAN, via the canonical URL.

R/course.R

+25-23
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
#' @param url Link to a ZIP file containing the materials. To reduce the chance
1212
#' of typos in live settings, these shorter forms are accepted:
1313
#'
14-
#' * GitHub repo spec: "OWNER/REPO". Equivalent to
15-
#' `https://github.com/OWNER/REPO/DEFAULT_BRANCH.zip`.
16-
#' * bit.ly or rstd.io shortlinks: "bit.ly/xxx-yyy-zzz" or "rstd.io/foofy".
17-
#' The instructor must then arrange for the shortlink to point to a valid
18-
#' download URL for the target ZIP file. The helper
19-
#' [create_download_url()] helps to create such URLs for GitHub, DropBox,
20-
#' and Google Drive.
14+
#' * GitHub repo spec: "OWNER/REPO". Equivalent to
15+
#' `https://github.com/OWNER/REPO/DEFAULT_BRANCH.zip`.
16+
#' * bit.ly or rstd.io shortlinks: "bit.ly/xxx-yyy-zzz" or "rstd.io/foofy".
17+
#' The instructor must then arrange for the shortlink to point to a valid
18+
#' download URL for the target ZIP file. The helper
19+
#' [create_download_url()] helps to create such URLs for GitHub, DropBox,
20+
#' and Google Drive.
2121
#' @param destdir Destination for the new folder. Defaults to the location
2222
#' stored in the global option `usethis.destdir`, if defined, or to the user's
2323
#' Desktop or similarly conspicuous place otherwise.
@@ -360,15 +360,15 @@ tidy_unzip <- function(zipfile, cleanup = FALSE) {
360360
## DropBox ZIP files often include lots of hidden R, RStudio, and Git files
361361
filenames <- filenames[keep_lgl(filenames)]
362362

363-
td <- top_directory(filenames)
364-
loose_parts <- is.na(td)
365-
366-
if (loose_parts) {
363+
parents <- path_before_slash(filenames)
364+
unique_parents <- unique(parents)
365+
if (length(unique_parents) == 1 && unique_parents != "") {
366+
target <- path(base_path, unique_parents)
367+
utils::unzip(zipfile, files = filenames, exdir = base_path)
368+
} else {
369+
# there is no parent; archive contains loose parts
367370
target <- path_ext_remove(zipfile)
368371
utils::unzip(zipfile, files = filenames, exdir = target)
369-
} else {
370-
target <- path(base_path, td)
371-
utils::unzip(zipfile, files = filenames, exdir = base_path)
372372
}
373373
ui_bullets(c(
374374
"v" = "Unpacking ZIP file into {.path {pth(target, base_path)}}
@@ -398,7 +398,7 @@ tidy_unzip <- function(zipfile, cleanup = FALSE) {
398398
}
399399
}
400400

401-
invisible(target)
401+
invisible(unclass(target))
402402
}
403403

404404
#' @rdname use_course_details
@@ -525,15 +525,17 @@ keep_lgl <- function(file,
525525
!grepl(ignores, file, perl = TRUE)
526526
}
527527

528-
top_directory <- function(filenames) {
529-
in_top <- path_dir(filenames) == "."
530-
unique_top <- unique(filenames[in_top])
531-
is_directory <- grepl("/$", unique_top)
532-
if (length(unique_top) > 1 || !is_directory) {
533-
NA_character_
534-
} else {
535-
unique_top
528+
path_before_slash <- function(filepath) {
529+
f <- function(x) {
530+
parts <- strsplit(x, "/", fixed = TRUE)[[1]]
531+
if (length(parts) > 1 || grepl("/", x)) {
532+
parts[1]
533+
} else {
534+
""
535+
}
536536
}
537+
purrr::map_chr(filepath, f)
538+
537539
}
538540

539541
content_type <- function(h) {

R/coverage.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use_covr_ignore <- function(files) {
4444
}
4545

4646
use_codecov_badge <- function(repo_spec) {
47-
url <- glue("https://codecov.io/gh/{repo_spec}")
47+
url <- glue("https://app.codecov.io/gh/{repo_spec}")
4848
img <- glue("https://codecov.io/gh/{repo_spec}/graph/badge.svg")
4949
use_badge("Codecov test coverage", url, img)
5050
}

R/cpp11.R

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use_cpp11 <- function() {
1212
check_is_package("use_cpp11()")
1313
check_installed("cpp11")
1414
check_uses_roxygen("use_cpp11()")
15+
check_has_package_doc("use_cpp11()")
1516
use_src()
1617

1718
use_dependency("cpp11", "LinkingTo")

R/create.R

+1-9
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,7 @@ create_from_github <- function(repo_spec,
188188
rstudio = NULL,
189189
open = rlang::is_interactive(),
190190
protocol = git_protocol(),
191-
host = NULL,
192-
auth_token = deprecated(),
193-
credentials = deprecated()) {
194-
if (lifecycle::is_present(auth_token)) {
195-
deprecate_warn_auth_token("create_from_github")
196-
}
197-
if (lifecycle::is_present(credentials)) {
198-
deprecate_warn_credentials("create_from_github")
199-
}
191+
host = NULL) {
200192
check_protocol(protocol)
201193

202194
parsed_repo_spec <- parse_repo_url(repo_spec)

0 commit comments

Comments
 (0)