Skip to content

Commit

Permalink
NA repository for unknown and Local package source
Browse files Browse the repository at this point in the history
fixes #1004
  • Loading branch information
aronatkins committed Sep 27, 2023
1 parent 003ef4c commit 8856765
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 3 additions & 2 deletions R/bundlePackageRenv.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ standardizeRenvPackage <- function(pkg,
# Try packages defined from default bioC repos
pkg$Repository <- findRepoUrl(pkg$Package, biocPackages)
}
} else if (pkg$Source == "unknown") {
pkg$Source <- NA_character_
} else if (pkg$Source %in% c("Bitbucket", "GitHub", "GitLab")) {
pkg$Source <- tolower(pkg$Source)
} else if (pkg$Source %in% c("Local", "unknown")) {
pkg$Source <- NA_character_
pkg$Repository <- NA_character_
}

# Remove Remote fields that pak adds for "standard" installs from CRAN
Expand Down
14 changes: 11 additions & 3 deletions tests/testthat/test-bundlePackageRenv.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,18 @@ test_that("packages installed from other repos get correctly named", {
)
})

test_that("source packages get NA source", {
source <- list(Package = "pkg", Source = "unknown")
test_that("source packages get NA source + repository", {
source <- list(Package = "pkg", Source = "unknown", Repository = "useless")
expect_equal(
standardizeRenvPackage(source),
list(Package = "pkg", Source = NA_character_)
list(Package = "pkg", Source = NA_character_, Repository = NA_character_)
)
})

test_that("Local packages get NA source + repository", {
source <- list(Package = "pkg", Source = "Local", Repository = "useless")
expect_equal(
standardizeRenvPackage(source),
list(Package = "pkg", Source = NA_character_, Repository = NA_character_)
)
})

0 comments on commit 8856765

Please sign in to comment.