Skip to content

Commit

Permalink
Merge pull request #22 from r-multiverse/test
Browse files Browse the repository at this point in the history
Rename internals
  • Loading branch information
wlandau authored Mar 21, 2024
2 parents 0e03642 + 466bdaa commit afa0ca4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 26 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.1.0
Version: 0.1.1
License: MIT + file LICENSE
URL: https://github.com/r-multiverse/multiverse.internals
BugReports: https://github.com/r-multiverse/multiverse.internals/issues
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(aggregate_listings)
export(aggregate_contributions)
export(assert_cran_url)
export(assert_package)
export(assert_release_exists)
Expand Down
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.1.1

* Rename internal functions and arguments.

# multiverse.internals 0.1.0

* Rename the package to `multiverse.internals`.
Expand Down
18 changes: 9 additions & 9 deletions R/aggregate_listings.R → R/aggregate_contributions.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#' text file listings of R releases.
#' @param output Character of length 1, file path where the
#' R-universe `packages.json` file will be written.
#' @param release_exceptions Character vector of URLs of GitHub owners
#' @param owner_exceptions Character vector of URLs of GitHub owners
#' where `"branch": "*release"` should be omitted. Example:
#' `"https://github.com/cran"`.
aggregate_listings <- function(
aggregate_contributions <- function(
input = getwd(),
output = "packages.json",
release_exceptions = character(0L)
owner_exceptions = character(0L)
) {
assert_character_scalar(input, "invalid input")
assert_character_scalar(output, "invalid output")
Expand All @@ -25,7 +25,7 @@ aggregate_listings <- function(
listings <- lapply(
X = packages,
FUN = read_package_listing,
release_exceptions = release_exceptions
owner_exceptions = owner_exceptions
)
message("Aggregating ", length(listings), " package listings.")
aggregated <- do.call(what = vctrs::vec_rbind, args = listings)
Expand All @@ -37,7 +37,7 @@ aggregate_listings <- function(
invisible()
}

read_package_listing <- function(package, release_exceptions) {
read_package_listing <- function(package, owner_exceptions) {
message("Processing package listing ", package)
name <- trimws(basename(package))
lines <- readLines(con = package, warn = FALSE)
Expand All @@ -47,9 +47,9 @@ read_package_listing <- function(package, release_exceptions) {
} else {
json <- package_listing_json(name = name, json = json)
}
decide_release_exceptions(
decide_owner_exceptions(
json = json,
release_exceptions = release_exceptions
owner_exceptions = owner_exceptions
)
}

Expand Down Expand Up @@ -114,8 +114,8 @@ package_listing_json <- function(name, json) {
as.data.frame(json)
}

decide_release_exceptions <- function(json, release_exceptions) {
if (dirname(trim_url(json$url)) %in% trim_url(release_exceptions)) {
decide_owner_exceptions <- function(json, owner_exceptions) {
if (dirname(trim_url(json$url)) %in% trim_url(owner_exceptions)) {
json$branch <- NULL
}
json
Expand Down
12 changes: 6 additions & 6 deletions man/aggregate_listings.Rd → man/aggregate_contributions.Rd

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

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test_that("ordinary URLs can be written", {
)
universe <- file.path(tempfile(), "out")
suppressMessages(
aggregate_listings(
aggregate_contributions(
input = packages,
output = universe
)
Expand Down Expand Up @@ -49,10 +49,10 @@ test_that("\"branch\": \"release\" in certain defined cases", {
)
universe <- file.path(tempfile(), "out")
suppressMessages(
aggregate_listings(
aggregate_contributions(
input = packages,
output = universe,
release_exceptions = c(
owner_exceptions = c(
"https://github.com/cran",
"https://github.com/wlandau"
)
Expand Down Expand Up @@ -95,7 +95,7 @@ test_that("one URL is malformed", {
universe <- file.path(tempfile(), "out")
out <- try(
suppressMessages(
aggregate_listings(
aggregate_contributions(
input = packages,
output = universe
)
Expand Down Expand Up @@ -124,7 +124,7 @@ test_that("acceptable custom JSON", {
)
universe <- file.path(tempfile(), "out")
suppressMessages(
aggregate_listings(
aggregate_contributions(
input = packages,
output = universe
)
Expand Down Expand Up @@ -166,7 +166,7 @@ test_that("malformed URL in JSON", {
universe <- file.path(tempfile(), "out")
out <- try(
suppressMessages(
aggregate_listings(
aggregate_contributions(
input = packages,
output = universe
)
Expand Down Expand Up @@ -200,7 +200,7 @@ test_that("missing branch field", {
universe <- file.path(tempfile(), "out")
out <- try(
suppressMessages(
aggregate_listings(
aggregate_contributions(
input = packages,
output = universe
)
Expand Down Expand Up @@ -244,7 +244,7 @@ test_that("disagreeing package field", {
universe <- file.path(tempfile(), "out")
out <- try(
suppressMessages(
aggregate_listings(
aggregate_contributions(
input = packages,
output = universe
)
Expand Down Expand Up @@ -281,7 +281,7 @@ test_that("bad branch field", {
universe <- file.path(tempfile(), "out")
out <- try(
suppressMessages(
aggregate_listings(
aggregate_contributions(
input = packages,
output = universe
)
Expand Down

0 comments on commit afa0ca4

Please sign in to comment.