Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* `pr_pull()`, `pr_push()` and friends now give more informative errors if usethis can't retrieve details about a remote (#1929, #2229).
* `pr_resume()` (without a specific `branch`) and `pr_fetch()` (without a specific `number`) no longer error when a branch name contains curly braces (#2107, @jonthegeek).
* `use_claude_code()` is an experimental helper to set up Claude Code in an R package in the same way as the tidyverse team (#2195).
* `use_course()`, `use_zip()`, and `use_github_action()` no longer emit download or pagination progress when the `usethis.quiet` option is `TRUE`.
* `use_import_from()` works in packages using `roxygen2` 8.0.0 (#2226, report by @jonthegeek; fix by @JesseAlderliesten in #2234).
* `use_pipe()` is now deprecated (@math-mcshane, #2124).
* `use_readme_qmd()` creates a starter `README.qmd` with Quarto-flavored YAML frontmatter, analogous to `use_readme_rmd()` (#1671). Thanks @VisruthSK for getting the ball rolling.
Expand Down
18 changes: 14 additions & 4 deletions R/course.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ tidy_download <- function(url, destdir = getwd()) {
tmp <- file_temp("tidy-download-")

h <- download_url(url, destfile = tmp)
cli::cat_line()
if (!is_quiet()) {
cli::cat_line()
}

cd <- content_disposition(h)
base_name <- make_filename(cd, fallback = path_file(url))
Expand All @@ -286,8 +288,10 @@ download_url <- function(
n_tries = 3,
retry_connecttimeout = 40L
) {
handle_options <- list(noprogress = FALSE, progressfunction = progress_fun)
curl::handle_setopt(handle, .list = handle_options)
if (!is_quiet()) {
handle_options <- list(noprogress = FALSE, progressfunction = progress_fun)
curl::handle_setopt(handle, .list = handle_options)
}

we_should_retry <- function(i, n_tries, status) {
if (i >= n_tries) {
Expand Down Expand Up @@ -346,7 +350,13 @@ download_url <- function(
invisible(handle)
}

try_download <- function(url, destfile, quiet = FALSE, mode = "wb", handle) {
try_download <- function(
url,
destfile,
quiet = is_quiet(),
mode = "wb",
handle
) {
tryCatch(
curl::curl_download(
url = url,
Expand Down
3 changes: 2 additions & 1 deletion R/github-actions.R
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ latest_release <- function(repo_spec = "https://github.com/r-lib/actions") {
owner = spec_owner(parsed$repo_spec),
repo = spec_repo(parsed$repo_spec),
.api_url = parsed$host,
.limit = Inf
.limit = Inf,
.progress = !is_quiet()
)
tag_names <- purrr::discard(
map_chr(raw_releases, "tag_name"),
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-badge.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ test_that("use_binder_badge() needs a github repository", {
test_that("use_r_universe_badge() needs to know the owner", {
skip_if_no_git_user()
local_interactive(FALSE)
withr::local_options(usethis.quiet = FALSE)
create_local_package()
withr::local_options(usethis.quiet = FALSE)

expect_snapshot(
error = TRUE,
Expand All @@ -47,7 +47,7 @@ test_that("use_r_universe_badge() needs to know the owner", {
transform = scrub_testpkg
)

use_git()
ui_silence(use_git())
use_git_remote("origin", "https://github.com/OWNER_ORIGIN/SCRUBBED.git")
expect_snapshot(
use_r_universe_badge(),
Expand Down
4 changes: 1 addition & 3 deletions tests/testthat/test-course.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ test_that("tidy_download() works", {
gh_url <- "https://github.com/r-lib/rematch2/archive/main.zip"
expected <- fs::path(tmp, "rematch2-main.zip")

capture.output(
out <- tidy_download(gh_url, destdir = tmp)
)
out <- tidy_download(gh_url, destdir = tmp)
expect_true(fs::file_exists(expected))
expect_identical(out, expected, ignore_attr = TRUE)
expect_identical(attr(out, "content-type"), "application/zip")
Expand Down
Loading