Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .posit/assistant/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sandbox": {
"enabled": false
},
"model.webSearch": true
}
Empty file added AGENTS.md
Empty file.
57 changes: 57 additions & 0 deletions R/getPkgZips.R
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,60 @@ suppPackages <- function() {
)
) # xfun already exists in lockfile, if override_lock = TRUE, should get v0.57 from R v4.4
}

packageList <- function(
lockfile_path,
type = "github"
) {
requireInstall("jsonvalidate")
is_lockfile <- renv::lockfile_validate(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renv::lockfile_validate() returns FALSE when running with mocklock(). Returns TRUE when it is run with a an actual existing renv.lock.

Loading the mocklock() with renv::lockfile_read() works fine, but never gets to that step because of FALSE status. A quick glance of the structure of the mock lock file doesn't reveal anything glaring, but perhaps there is a typo or something else that needs to replicated to be interpreted as an actual lockfile.

lockfile = lockfile_path
)
if (isTRUE(is_lockfile)) {
lockfile_data <- renv::lockfile_read(
file = lockfile_path
)
cli::cli_alert_success(
"{lockfile_path} read successfully"
)
} else {
cli::cli_abort(
"{lockfile_path} is not a valid renv.lock file"
)
}
checkmate::assertChoice(
type,
c("github", "all")
)
if (type == "github") {
return(extractGithubList(lockfile_data$Packages))
}
}

extractGithubList <- function(lockfile_data) {
lockfile_data |>
lapply(
FUN = function(x) {
if (x$Source == "GitHub") {
if (x$RemoteType == "github") {
return(x$Version)
}
}
}
) |>
Filter(
Negate(is.null),
x = _
)
}

requireInstall <- function(package) {
if (!requireNamespace(package, quietly = TRUE)) {
cli::cli_abort(
glue::glue(
"'{package}' must be installed to use this function."
)
)
}
return(invisible())
}
Loading
Loading