-
Notifications
You must be signed in to change notification settings - Fork 763
Actually drop superseded usethis functions #2662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hadley
wants to merge
3
commits into
main
Choose a base branch
from
drop-superseded-ui
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,7 +66,7 @@ check_for_rstudio_updates <- function( | |
| sprintf( | ||
| "%s.\nDownload at: %s", | ||
| result[["update-message"]], | ||
| ui_field(result[["update-url"]]) | ||
| result[["update-url"]] | ||
| ) | ||
| ) | ||
| } | ||
|
|
@@ -93,7 +93,6 @@ r_release <- memoise::memoise(.r_release) | |
| #' everything should be ready for package development. | ||
| #' | ||
| #' @return A named list, with S3 class `dev_sitrep` (for printing purposes). | ||
| #' @importFrom usethis ui_code ui_field ui_todo ui_value ui_done ui_path | ||
| #' @export | ||
| #' @examples | ||
| #' \dontrun{ | ||
|
|
@@ -104,21 +103,52 @@ dev_sitrep <- function(pkg = ".", debug = FALSE) { | |
|
|
||
| has_build_tools <- !is_windows || pkgbuild::has_build_tools(debug = debug) | ||
|
|
||
| new_dev_sitrep( | ||
| pkg = pkg, | ||
| r_version = getRversion(), | ||
| r_path = path_real(R.home()), | ||
| r_release_version = r_release(), | ||
| is_windows = is_windows, | ||
| has_build_tools = has_build_tools, | ||
| rtools_path = if (has_build_tools) pkgbuild::rtools_path(), | ||
| devtools_version = packageVersion("devtools"), | ||
| devtools_deps = remotes::package_deps("devtools", dependencies = NA), | ||
| pkg_deps = if (!is.null(pkg)) { | ||
| remotes::dev_package_deps(pkg$path, dependencies = TRUE) | ||
| }, | ||
| rstudio_version = if (is_rstudio_running()) rstudioapi::getVersion(), | ||
| rstudio_msg = if (!is_positron()) check_for_rstudio_updates() | ||
| ) | ||
| } | ||
|
|
||
| new_dev_sitrep <- function( | ||
| pkg = NULL, | ||
| r_version = getRversion(), | ||
| r_path = path_real(R.home()), | ||
| r_release_version = r_version, | ||
| is_windows = FALSE, | ||
| has_build_tools = TRUE, | ||
| rtools_path = NULL, | ||
| devtools_version = packageVersion("devtools"), | ||
| devtools_deps = data.frame(package = character(), diff = numeric()), | ||
| pkg_deps = NULL, | ||
| rstudio_version = NULL, | ||
| rstudio_msg = NULL | ||
| ) { | ||
| structure( | ||
| list( | ||
| pkg = pkg, | ||
| r_version = getRversion(), | ||
| r_path = path_real(R.home()), | ||
| r_release_version = r_release(), | ||
| r_version = r_version, | ||
| r_path = r_path, | ||
| r_release_version = r_release_version, | ||
| is_windows = is_windows, | ||
| has_build_tools = has_build_tools, | ||
| rtools_path = if (has_build_tools) pkgbuild::rtools_path(), | ||
| devtools_version = packageVersion("devtools"), | ||
| devtools_deps = remotes::package_deps("devtools", dependencies = NA), | ||
| pkg_deps = if (!is.null(pkg)) { | ||
| remotes::dev_package_deps(pkg$path, dependencies = TRUE) | ||
| }, | ||
| rstudio_version = if (is_rstudio_running()) rstudioapi::getVersion(), | ||
| rstudio_msg = if (!is_positron()) check_for_rstudio_updates() | ||
| rtools_path = rtools_path, | ||
| devtools_version = devtools_version, | ||
| devtools_deps = devtools_deps, | ||
| pkg_deps = pkg_deps, | ||
| rstudio_version = rstudio_version, | ||
| rstudio_msg = rstudio_msg | ||
| ), | ||
| class = "dev_sitrep" | ||
| ) | ||
|
|
@@ -128,80 +158,68 @@ dev_sitrep <- function(pkg = ".", debug = FALSE) { | |
| print.dev_sitrep <- function(x, ...) { | ||
| all_ok <- TRUE | ||
|
|
||
| hd_line("R") | ||
| cli::cli_rule("R") | ||
| kv_line("version", x$r_version) | ||
| kv_line("path", x$r_path, path = TRUE) | ||
| if (x$r_version < x$r_release_version) { | ||
| ui_todo( | ||
| ' | ||
| {ui_field("R")} is out of date ({ui_value(x$r_version)} vs {ui_value(x$r_release_version)}) | ||
| ' | ||
| ) | ||
| cli::cli_bullets(c( | ||
| "!" = "{.field R} is out of date ({.val {x$r_version}} vs {.val {x$r_release_version}})" | ||
| )) | ||
| all_ok <- FALSE | ||
| } | ||
|
|
||
| if (is_windows) { | ||
| hd_line("Rtools") | ||
| if (x$is_windows) { | ||
| cli::cli_rule("Rtools") | ||
| if (x$has_build_tools) { | ||
| kv_line("path", x$rtools_path, path = TRUE) | ||
| } else { | ||
| ui_todo( | ||
| ' | ||
| {ui_field("RTools")} is not installed: | ||
| Download and install it from: {ui_field("https://cloud.r-project.org/bin/windows/Rtools/")} | ||
| ' | ||
| ) | ||
| cli::cli_bullets(c( | ||
| "!" = "{.field RTools} is not installed.", | ||
| " " = "Download and install it from: {.url https://cloud.r-project.org/bin/windows/Rtools/}" | ||
| )) | ||
| } | ||
| all_ok <- FALSE | ||
| } | ||
|
|
||
| if (!is.null(x$rstudio_version)) { | ||
| hd_line(if (is_positron()) "Positron" else "RStudio") | ||
| cli::cli_rule(if (is_positron()) "Positron" else "RStudio") | ||
| kv_line("version", x$rstudio_version) | ||
|
|
||
| if (!is.null(x$rstudio_msg)) { | ||
| ui_todo(x$rstudio_msg) | ||
| cli::cli_bullets(c("!" = "{x$rstudio_msg}")) | ||
| all_ok <- FALSE | ||
| } | ||
| } | ||
|
|
||
| hd_line("devtools") | ||
| cli::cli_rule("devtools") | ||
| kv_line("version", x$devtools_version) | ||
|
|
||
| devtools_deps_old <- x$devtools_deps$diff < 0 | ||
| if (any(devtools_deps_old)) { | ||
| ui_todo( | ||
| ' | ||
| {ui_field("devtools")} or its dependencies out of date: | ||
| {paste(ui_value(x$devtools_deps$package[devtools_deps_old]), collapse = ", ")} | ||
| Update them with {ui_code("devtools::update_packages(\\"devtools\\")")} | ||
| ' | ||
| ) | ||
| cli::cli_bullets(c( | ||
| "!" = "{.field devtools} or its dependencies out of date:", | ||
| " " = "{.val {x$devtools_deps$package[devtools_deps_old]}}", | ||
| " " = "Update them with {.code devtools::update_packages(\"devtools\")}" | ||
| )) | ||
| all_ok <- FALSE | ||
| } | ||
|
|
||
| hd_line("dev package") | ||
| cli::cli_rule("dev package") | ||
| kv_line("package", x$pkg$package) | ||
| kv_line("path", x$pkg$path, path = TRUE) | ||
|
|
||
| pkg_deps_old <- x$pkg_deps$diff < 0 | ||
| if (any(pkg_deps_old)) { | ||
| ui_todo( | ||
| ' | ||
| {ui_field(x$pkg$package)} dependencies out of date: | ||
| {paste(ui_value(x$pkg_deps$package[pkg_deps_old]), collapse = ", ")} | ||
| Update them with {ui_code("devtools::install_dev_deps()")} | ||
| ' | ||
| ) | ||
| cli::cli_bullets(c( | ||
| "!" = "{.field {x$pkg$package}} dependencies out of date:", | ||
| " " = "{.val {x$pkg_deps$package[pkg_deps_old]}}", | ||
| " " = "Update them with {.code devtools::install_dev_deps()}" | ||
| )) | ||
| all_ok <- FALSE | ||
| } | ||
|
|
||
| if (all_ok) { | ||
| ui_done( | ||
| " | ||
| All checks passed | ||
| " | ||
| ) | ||
| cli::cli_bullets(c("v" = "All checks passed")) | ||
| } | ||
|
|
||
| invisible(x) | ||
|
|
@@ -210,19 +228,12 @@ print.dev_sitrep <- function(x, ...) { | |
|
|
||
| # Helpers ----------------------------------------------------------------- | ||
|
|
||
| hd_line <- function(name) { | ||
| cat_rule(cli::style_bold(name)) | ||
| } | ||
|
|
||
| kv_line <- function(key, value, path = FALSE) { | ||
| if (is.null(value)) { | ||
| value <- cli::col_silver("<unset>") | ||
| cli::cli_inform(c("*" = "{key}: {.silver <unset>}")) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also changed this to ensure that all of the output is now "message", not "output". |
||
| } else if (path) { | ||
| cli::cli_inform(c("*" = "{key}: {.path {value}}")) | ||
| } else { | ||
| if (path) { | ||
| value <- ui_path(value, base = NA) | ||
| } else { | ||
| value <- ui_value(value) | ||
| } | ||
| cli::cli_inform(c("*" = "{key}: {.val {value}}")) | ||
| } | ||
| cli::cat_line(cli::symbol$bullet, " ", key, ": ", value) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minimal surgery to make this testable since I didn't want to accidentally break it all.