Skip to content

Commit 54e13c1

Browse files
committed
Merged upstream/main into olivroy-challenge-uncommited-tweaks
2 parents 9841741 + 00552db commit 54e13c1

File tree

7 files changed

+73
-5
lines changed

7 files changed

+73
-5
lines changed

DESCRIPTION

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Imports:
3939
rprojroot (>= 1.2),
4040
rstudioapi,
4141
stats,
42+
tools,
4243
utils,
4344
whisker,
4445
withr (>= 2.3.0),

NEWS.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# usethis (development version)
22

3+
* Reverse dependency checks are only suggested if they exist
4+
(#1817, @seankross).
5+
36
# usethis 3.0.0
47

58
## Transition to cli package for UI

R/course.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#'
1414
#' * GitHub repo spec: "OWNER/REPO". Equivalent to
1515
#' `https://github.com/OWNER/REPO/DEFAULT_BRANCH.zip`.
16-
#' * bit.ly or rstd.io shortlinks: "bit.ly/xxx-yyy-zzz" or "rstd.io/foofy".
16+
#' * bit.ly, pos.it, or rstd.io shortlinks: "bit.ly/xxx-yyy-zzz", "pos.it/foofy" or "rstd.io/foofy".
1717
#' The instructor must then arrange for the shortlink to point to a valid
1818
#' download URL for the target ZIP file. The helper
1919
#' [create_download_url()] helps to create such URLs for GitHub, DropBox,
@@ -492,7 +492,7 @@ normalize_url <- function(url) {
492492
}
493493

494494
is_shortlink <- function(url) {
495-
shortlink_hosts <- c("rstd\\.io", "bit\\.ly")
495+
shortlink_hosts <- c("rstd\\.io", "bit\\.ly", "pos\\.it")
496496
any(map_lgl(shortlink_hosts, grepl, x = url))
497497
}
498498

R/release.R

+7-1
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,14 @@ gh_milestone_number <- function(target_repo, version, state = "open") {
147147
numbers[match(paste0("v", version), titles)]
148148
}
149149

150+
# Get revdeps for current package
151+
get_revdeps <- function() {
152+
pkg <- proj_desc()$get_field("Package")
153+
tools::package_dependencies(pkg, which = "all", reverse = TRUE)[[pkg]]
154+
}
155+
150156
release_revdepcheck <- function(on_cran = TRUE, is_posit_pkg = TRUE, env = NULL) {
151-
if (!on_cran) {
157+
if (!on_cran || length(get_revdeps()) == 0) {
152158
return()
153159
}
154160

man/zip-utils.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/_snaps/release.md

+35
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,38 @@
164164
* [ ] `usethis::use_news_md()`
165165
* [ ] Share on social media
166166

167+
# no revdep release bullets when there are no revdeps
168+
169+
Code
170+
writeLines(release_checklist("1.0.0", on_cran = TRUE))
171+
Output
172+
Prepare for release:
173+
174+
* [ ] `git pull`
175+
* [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_{TESTPKG}.html)
176+
* [ ] `usethis::use_news_md()`
177+
* [ ] [Polish NEWS](https://style.tidyverse.org/news.html#news-release)
178+
* [ ] `usethis::use_github_links()`
179+
* [ ] `urlchecker::url_check()`
180+
* [ ] `devtools::check(remote = TRUE, manual = TRUE)`
181+
* [ ] `devtools::check_win_devel()`
182+
* [ ] Update `cran-comments.md`
183+
* [ ] `git push`
184+
* [ ] Draft blog post
185+
186+
Submit to CRAN:
187+
188+
* [ ] `usethis::use_version('major')`
189+
* [ ] `devtools::submit_cran()`
190+
* [ ] Approve email
191+
192+
Wait for CRAN...
193+
194+
* [ ] Accepted :tada:
195+
* [ ] Finish & publish blog post
196+
* [ ] Add link to blog post in pkgdown news menu
197+
* [ ] `usethis::use_github_release()`
198+
* [ ] `usethis::use_dev_version(push = TRUE)`
199+
* [ ] `usethis::use_news_md()`
200+
* [ ] Share on social media
201+

tests/testthat/test-release.R

+24-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ test_that("release bullets don't change accidentally", {
55
withr::local_options(usethis.description = NULL)
66
create_local_package()
77

8+
local_mocked_bindings(
9+
get_revdeps = function() "usethis"
10+
)
11+
812
# First release
913
expect_snapshot(
1014
writeLines(release_checklist("0.1.0", on_cran = FALSE)),
@@ -52,6 +56,10 @@ test_that("construct correct revdep bullet", {
5256
create_local_package()
5357
env <- env(release_extra_revdeps = function() c("waldo", "testthat"))
5458

59+
local_mocked_bindings(
60+
get_revdeps = function() "usethis"
61+
)
62+
5563
expect_snapshot({
5664
release_revdepcheck(on_cran = FALSE)
5765
release_revdepcheck(on_cran = TRUE, is_posit_pkg = FALSE)
@@ -64,7 +72,8 @@ test_that("RStudio-ness detection works", {
6472
withr::local_options(usethis.description = NULL)
6573
create_local_package()
6674
local_mocked_bindings(
67-
tidy_minimum_r_version = function() numeric_version("3.6")
75+
tidy_minimum_r_version = function() numeric_version("3.6"),
76+
get_revdeps = function() "usethis"
6877
)
6978

7079
expect_false(is_posit_pkg())
@@ -245,3 +254,17 @@ test_that("default_cran_mirror() is respects set value but falls back to cloud",
245254
withr::local_options(repos = c())
246255
expect_equal(default_cran_mirror(), c(CRAN = "https://cloud.r-project.org"))
247256
})
257+
258+
test_that("no revdep release bullets when there are no revdeps", {
259+
withr::local_options(usethis.description = NULL)
260+
create_local_package()
261+
262+
local_mocked_bindings(
263+
get_revdeps = function() NULL
264+
)
265+
266+
expect_snapshot(
267+
writeLines(release_checklist("1.0.0", on_cran = TRUE)),
268+
transform = scrub_testpkg
269+
)
270+
})

0 commit comments

Comments
 (0)