Skip to content

Commit

Permalink
Advance/move another deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
jennybc committed Jul 28, 2024
1 parent 97d1218 commit a1da375
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 50 deletions.
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
20 changes: 18 additions & 2 deletions R/usethis-deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,31 @@
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' * `git_branch_default()` has been replaced by [git_default_branch()].
#' `git_branch_default()` has been replaced by [git_default_branch()].
#'
#' @keywords internal
#' @export
git_branch_default <- function() {
lifecycle::deprecate_soft("2.1.0", "git_branch_default()", "git_default_branch()")
lifecycle::deprecate_warn("2.1.0", "git_branch_default()", "git_default_branch()")
git_default_branch()
}

#' Deprecated badge function
#'
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' `use_rscloud_badge()` has been replaced by [use_posit_cloud_badge()].
#'
#' @keywords internal
#' @export
use_rscloud_badge <- function(url) {
lifecycle::deprecate_stop(
"2.2.0", "use_rscloud_badge()",
"use_posit_cloud_badge()"
)
}

#' Deprecated tidyverse functions
#'
#' @description
Expand Down
3 changes: 0 additions & 3 deletions man/badges.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions man/git_branch_default.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions man/use_rscloud_badge.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 1 addition & 17 deletions tests/testthat/_snaps/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
! `stage` must be one of "experimental", "stable", "superseded", or "deprecated", not "eperimental".
i Did you mean "experimental"?

# use_rscloud_badge() handles bad and good input
# use_posit_cloud_badge() handles bad and good input

Code
use_posit_cloud_badge()
Expand All @@ -31,19 +31,3 @@
Error in `use_posit_cloud_badge()`:
x `usethis::use_posit_cloud_badge()` requires a link to an existing Posit Cloud project of the form "https://posit.cloud/content/<project-id>" or "https://posit.cloud/spaces/<space-id>/content/<project-id>".

---

Code
use_rscloud_badge("https://rstudio.cloud/content/123")
Condition
Error in `use_posit_cloud_badge()`:
x `usethis::use_posit_cloud_badge()` requires a link to an existing Posit Cloud project of the form "https://posit.cloud/content/<project-id>" or "https://posit.cloud/spaces/<space-id>/content/<project-id>".

---

Code
use_rscloud_badge("https://posit.cloud/project/123")
Condition
Error in `use_posit_cloud_badge()`:
x `usethis::use_posit_cloud_badge()` requires a link to an existing Posit Cloud project of the form "https://posit.cloud/content/<project-id>" or "https://posit.cloud/spaces/<space-id>/content/<project-id>".

16 changes: 1 addition & 15 deletions tests/testthat/test-badge.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,13 @@ test_that("use_binder_badge() needs a github repository", {
expect_error(use_binder_badge(), class = "usethis_error_bad_github_remote_config")
})

test_that("use_rscloud_badge() handles bad and good input", {
test_that("use_posit_cloud_badge() handles bad and good input", {
create_local_project()
expect_snapshot(use_posit_cloud_badge(), error = TRUE)
expect_snapshot(use_posit_cloud_badge(123), error = TRUE)
expect_snapshot(use_posit_cloud_badge("http://posit.cloud/123"), error = TRUE)
expect_no_error(use_posit_cloud_badge("https://posit.cloud/content/123"))
expect_no_error(use_posit_cloud_badge("https://posit.cloud/spaces/123/content/123"))

lifecycle::expect_deprecated(
use_rscloud_badge("https://posit.cloud/spaces/123/content/123")
)

withr::local_options(lifecycle_verbosity = "quiet")
expect_snapshot(
use_rscloud_badge("https://rstudio.cloud/content/123"),
error = TRUE
)
expect_snapshot(
use_rscloud_badge("https://posit.cloud/project/123"),
error = TRUE
)
})

test_that("use_badge() does nothing if badge seems to pre-exist", {
Expand Down

0 comments on commit a1da375

Please sign in to comment.