Skip to content

Commit

Permalink
memoise piggyback remote list for #54
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Nov 7, 2024
1 parent b2a9f62 commit 7c6c6a5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: pkgmatch
Title: Find R Packages Matching Either Descriptions or Other R Packages
Version: 0.4.1.056
Version: 0.4.1.057
Authors@R: c(
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265")),
Expand Down
8 changes: 8 additions & 0 deletions R/cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ load_data_internal <- function (what, corpus, fns, raw) {
}
m_load_data_internal <- memoise::memoise (load_data_internal)

m_list_remote_files <- function () {
piggyback::pb_list (
repo = "ropensci-review-tools/pkgmatch",
tag = RELEASE_TAG
)

Check warning on line 60 in R/cache.R

View check run for this annotation

Codecov / codecov/patch

R/cache.R#L57-L60

Added lines #L57 - L60 were not covered by tests
}
list_remote_files <- memoise::memoise (m_list_remote_files)

get_cache_file_name <- function (what, corpus, fns, raw) {

corpus <- match.arg (tolower (corpus), c ("ropensci", "cran"))
Expand Down
5 changes: 1 addition & 4 deletions R/data-update-cran.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,7 @@ list_new_cran_updates <- function (flist) {
# Only include packages published since last update:
index <- which (!cran_tarball %in% pkgs)
published <- as.Date (cran_db$Published [index])
flist_remote <- piggyback::pb_list (
repo = "ropensci-review-tools/pkgmatch",
tag = RELEASE_TAG
)
flist_remote <- list_remote_files ()
i <- which (flist_remote$file_name == basename (f))
embeddings_date <- as.Date (flist_remote$timestamp [i])
dt <- difftime (embeddings_date, published, units = "days")
Expand Down
6 changes: 1 addition & 5 deletions R/data-update-ropensci.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ pkgmatch_update_ropensci <- function () {
results_path <- fs::dir_create (fs::path (fs::path_temp (), "pkgmatch-results"))
flist <- dl_prev_data (results_path)

flist_remote <- piggyback::pb_list (
repo = "ropensci-review-tools/pkgmatch",
tag = RELEASE_TAG
)
pkgmatch_date <- min (flist_remote$timestamp)
pkgmatch_date <- min (list_remote_files ()$timestamp)
reg <- ros_registry ()
reg_today <- registry_daily_chunk (reg)

Expand Down
4 changes: 2 additions & 2 deletions R/data-update.R
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ append_data_to_fn_calls <- function (res, flist, cran = TRUE) {
# nocov start
dl_prev_data <- function (results_path) {

files <- piggyback::pb_list (tag = RELEASE_TAG)
file_names <- files$file_name
flist_remote <- list_remote_files ()
file_names <- flist_remote$file_name
file_names_done <- file_names [which (file_names %in% list.files (results_path))]

dl_data <- piggyback::pb_download (
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/ropensci-review-tools/pkgmatch",
"issueTracker": "https://github.com/ropensci-review-tools/pkgmatch/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.4.1.056",
"version": "0.4.1.057",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down

0 comments on commit 7c6c6a5

Please sign in to comment.