Skip to content
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

Fix split of os and os-release in system_requirements, and add unit test #609

Merged
merged 5 commits into from
Jun 2, 2021
Merged
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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# remotes (development version)

* `system_requirements()` now works as intended if only the `os` argument is used (@mdneuzerling, #609)

* skip tests for `download.file(method = "internal")`, on R > 4.1, since that method is now defunct on those versions.

* Re-license as MIT. (#551)
Expand Down
2 changes: 1 addition & 1 deletion R/system_requirements.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DEFAULT_RSPM <- "https://packagemanager.rstudio.com"
#' @export
system_requirements <- function(os, os_release = NULL, path = ".", package = NULL, curl = Sys.which("curl")) {
if (is.null(os_release)) {
os_release <- strsplit(os_release, "-", fixed = TRUE)[[1]]
os_release <- strsplit(os, "-", fixed = TRUE)[[1]]
if (length(os_release) != 2) {
stop("If os_release is missing, os must consist of name and release.", call. = FALSE)
}
Expand Down
2 changes: 1 addition & 1 deletion inst/install-github.R

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

2 changes: 1 addition & 1 deletion install-github.R

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

13 changes: 13 additions & 0 deletions tests/testthat/test-system_requirements.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,16 @@ test_that("system_requirements work with package arguments", {
)
)
})

test_that("system_requirements allow specifying os_release within os", {
skip_on_cran()
skip_if_offline()

expect_equal(
system_requirements("ubuntu-16.04", package = "curl"),
c("apt-get install -y libcurl4-openssl-dev",
"apt-get install -y libssl-dev"
)
)
})