Skip to content

Commit

Permalink
Merge pull request #46 from insightsengineering/fix_bioc
Browse files Browse the repository at this point in the history
fix get_release_date for bioc packages
  • Loading branch information
pawelru authored May 31, 2024
2 parents 5ee21e1 + 5b70c46 commit ca6e4bf
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 10 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ S3method(get_ref_min,remote_ref_standard)
S3method(get_ref_min_incl_cran,remote_ref)
S3method(get_ref_min_incl_cran,remote_ref_github)
S3method(get_release_date,remote_ref)
S3method(get_release_date,remote_ref_bioc)
S3method(get_release_date,remote_ref_cran)
S3method(get_release_date,remote_ref_github)
S3method(get_release_date,remote_ref_standard)
Expand Down
35 changes: 27 additions & 8 deletions R/get_ref.R
Original file line number Diff line number Diff line change
Expand Up @@ -439,22 +439,41 @@ get_release_date.remote_ref_github <- function(remote_ref) {
#' @export
#'
#' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != ""
#' remote_ref <- pkgdepends::parse_pkg_ref("dplyr@1.1.0")
#' get_release_date.remote_ref_cran(remote_ref)
#' get_release_date(pkgdepends::parse_pkg_ref("dplyr@1.1.0"))
get_release_date.remote_ref_cran <- function(remote_ref) {
result <- subset(
get_release_data(remote_ref$package),
package_version(version, strict = FALSE) == package_version(remote_ref$version, strict = FALSE),
select = "mtime"
)[[1]][1]
as.Date(result)
rel_data <- get_release_data(remote_ref$package)

if (remote_ref$atleast != "") {
idx <- do.call(
remote_ref$atleast,
list(
package_version(rel_data$version, strict = FALSE),
package_version(remote_ref$version, strict = FALSE)
)
)
as.Date(tail(rel_data[idx, "mtime"], 1))
} else {
as.Date(tail(rel_data$mtime, 1))
}
}

#' @rdname get_release_date
#' @export
#' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != ""
#' get_release_date(pkgdepends::parse_pkg_ref("dplyr"))
get_release_date.remote_ref_standard <- function(remote_ref) {
get_release_date.remote_ref_cran(remote_ref)
}

#' @rdname get_release_date
#' @export
#' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != ""
#' get_release_date(pkgdepends::parse_pkg_ref("MultiAssayExperiment"))
get_release_date.remote_ref_bioc <- function(remote_ref) {
get_release_date.remote_ref_cran(remote_ref)
}

#' @rdname get_release_date
#' @export
get_release_date.remote_ref <- function(remote_ref) {
as.Date(NA_real_)
Expand Down
18 changes: 16 additions & 2 deletions man/get_release_date.Rd

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

0 comments on commit ca6e4bf

Please sign in to comment.