From a245dba70d4ba56a392957c201aa5773e1f3ad0e Mon Sep 17 00:00:00 2001 From: wlandau Date: Wed, 28 Feb 2024 05:30:48 -0500 Subject: [PATCH] trim whitespace --- NEWS.md | 4 ++-- R/assert_package.R | 3 ++- R/build_universe.R | 4 ++-- inst/WORDLIST | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 73cc961..a69d920 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ -# r.releases.utils 0.0.1.9000 (development) - +# r.releases.utils 0.0.2 +* Trim white space when processing URLs. # r.releases.utils 0.0.1 diff --git a/R/assert_package.R b/R/assert_package.R index 09d29e4..dd842a4 100644 --- a/R/assert_package.R +++ b/R/assert_package.R @@ -11,7 +11,7 @@ assert_package <- function(path) { if (!file.exists(path)) { stop(paste("file", shQuote(path), "does not exist")) } - name <- basename(path) + name <- trimws(basename(path)) url <- try(readLines(path, warn = FALSE), silent = TRUE) if (inherits(url, "try-error")) { stop(paste("Problem reading file", shQuote(path))) @@ -30,6 +30,7 @@ assert_package_contents <- function(name, url) { if (!is_character_scalar(url)) { stop("Invalid package URL") } + url <- trimws(url) good_url <- grepl( pattern = "^https?://[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,3}(/\\S*)?$", x = url diff --git a/R/build_universe.R b/R/build_universe.R index 25b8344..ab2a461 100644 --- a/R/build_universe.R +++ b/R/build_universe.R @@ -22,8 +22,8 @@ build_universe <- function(input = getwd(), output = "packages.json") { warn = FALSE ) out <- data.frame( - package = basename(packages), - url = urls, + package = trimws(basename(packages)), + url = trimws(urls), branch = "*release" ) if (!file.exists(dirname(output))) { diff --git a/inst/WORDLIST b/inst/WORDLIST index dd39bca..d6f5876 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -2,3 +2,4 @@ GitLab JSON json repo +pkgdown