Skip to content

Commit

Permalink
Merge pull request #27 from r-multiverse/dev
Browse files Browse the repository at this point in the history
Make meta functions robust to URL trailing slash
  • Loading branch information
wlandau committed Jun 12, 2024
2 parents 1cd24e5 + 4b9abf4 commit 9df94df
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: multiverse.internals
Title: Internal Infrastructure for R-multiverse
Description: R-multiverse requires this internal internal infrastructure
package to automate contribution reviews and populate universes.
Version: 0.2.2
Version: 0.2.2.9000
License: MIT + file LICENSE
URL: https://github.com/r-multiverse/multiverse.internals
BugReports: https://github.com/r-multiverse/multiverse.internals/issues
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@ importFrom(nanonext,status_code)
importFrom(pkgsearch,cran_package)
importFrom(utils,available.packages)
importFrom(utils,compareVersion)
importFrom(utils,contrib.url)
importFrom(vctrs,vec_rbind)
importFrom(vctrs,vec_slice)
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# multiverse.internals 0.2.2.9000 (development)

* Makes `meta_checks()` and `meta_packages()` robust to trailing slashes in the supplied URL.

# multiverse.internals 0.2.2

* Add `issues_dependencies()`.
Expand Down
2 changes: 1 addition & 1 deletion R/meta_checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ meta_checks <- function(repo = "https://multiverse.r-multiverse.org") {
"_status"
)
listing <- file.path(
repo,
trim_url(repo),
"api",
paste0("packages?stream=true&fields=", paste(fields, collapse = ","))
)
Expand Down
4 changes: 3 additions & 1 deletion R/meta_packages.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
meta_packages <- function(repo = "https://multiverse.r-multiverse.org") {
fields <- c("Version", "Remotes", "RemoteSha")
listing <- file.path(
contrib.url(repos = repo, type = "source"),
trim_url(repo),
"src",
"contrib",
paste0("PACKAGES.json?fields=", paste(fields, collapse = ","))
)
out <- jsonlite::stream_in(
Expand Down
2 changes: 1 addition & 1 deletion R/package.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
#' @importFrom jsonlite parse_json read_json stream_in write_json
#' @importFrom nanonext ncurl parse_url status_code
#' @importFrom pkgsearch cran_package
#' @importFrom utils available.packages compareVersion contrib.url
#' @importFrom utils available.packages compareVersion
#' @importFrom vctrs vec_rbind vec_slice
NULL
6 changes: 3 additions & 3 deletions tests/testthat/helper-mock.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# parse(text = deparse(meta_checks(repo = "https://multiverse.r-multiverse.org"))) # nolint
# dput(meta_checks(repo = "https://multiverse.r-multiverse.org")) # nolint
mock_meta_checks <- structure(
list(
package = c(
Expand Down Expand Up @@ -108,7 +108,7 @@ mock_meta_checks <- structure(
row.names = c(NA, 21L)
)

# parse(text = deparse(meta_packages(repo = "https://multiverse.r-multiverse.org"))) # nolint
# dput(meta_packages(repo = "https://multiverse.r-multiverse.org")) # nolint
mock_meta_packages <- structure(
list(
"_id" = c(
Expand Down Expand Up @@ -590,7 +590,7 @@ mock_meta_packages <- structure(
row.names = c(NA, 20L)
)

# parse(text = deparse(meta_packages(repo = "https://wlandau.r-universe.dev"))) # nolint
# dput(meta_packages(repo = "https://wlandau.r-universe.dev")) # nolint
mock_meta_packages_graph <- structure(
list(
"_id" = c(
Expand Down

0 comments on commit 9df94df

Please sign in to comment.