Skip to content

Commit

Permalink
Ignore whitespace after Additional_repositories
Browse files Browse the repository at this point in the history
Fixes #251
  • Loading branch information
tmelliott authored and jimhester committed Apr 10, 2019
1 parent 2c5c036 commit 91c64b3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
* remotes now understands the "standard" remote type, as produced by packages
installed from CRAN using `pak` (#309)

* Fix parsing of Additional_Repositories which have a leading newline
(@tmelliott, #251).

* Fix return type of `install_remote()` when there is a circular dependency (#225)

* `remote_package_name.github_remote()` now works properly on Windows (#248)
Expand Down
3 changes: 2 additions & 1 deletion R/deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ has_additional_repositories <- function(pkg) {

parse_additional_repositories <- function(pkg) {
if (has_additional_repositories(pkg)) {
strsplit(pkg[["additional_repositories"]], "[,[:space:]]+")[[1]]

strsplit(trim_ws(pkg[["additional_repositories"]]), "[,[:space:]]+")[[1]]
}
}

Expand Down
3 changes: 2 additions & 1 deletion inst/install-github.R
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,8 @@ has_additional_repositories <- function(pkg) {

parse_additional_repositories <- function(pkg) {
if (has_additional_repositories(pkg)) {
strsplit(pkg[["additional_repositories"]], "[,[:space:]]+")[[1]]

strsplit(trim_ws(pkg[["additional_repositories"]]), "[,[:space:]]+")[[1]]
}
}

Expand Down
3 changes: 2 additions & 1 deletion install-github.R
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,8 @@ has_additional_repositories <- function(pkg) {

parse_additional_repositories <- function(pkg) {
if (has_additional_repositories(pkg)) {
strsplit(pkg[["additional_repositories"]], "[,[:space:]]+")[[1]]

strsplit(trim_ws(pkg[["additional_repositories"]]), "[,[:space:]]+")[[1]]
}
}

Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test-deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ test_that("Additional_repositories field", {
parse_additional_repositories(pkg),
c("http://packages.ropensci.org", "http://foo.bar.com")
)

pkg <- list(
additional_repositories =
"\n http://packages.ropensci.org, \nhttp://foo.bar.com"
)

expect_equal(
parse_additional_repositories(pkg),
c("http://packages.ropensci.org", "http://foo.bar.com")
)

})

test_that("update.package_deps", {
Expand Down

0 comments on commit 91c64b3

Please sign in to comment.