-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into system-requirements
- Loading branch information
Showing
37 changed files
with
978 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
S3method("[",pak_search_result) | ||
S3method(print,pak_search_result) | ||
S3method(print,pkg_install_result) | ||
export(cache_clean) | ||
export(cache_delete) | ||
export(cache_list) | ||
export(cache_summary) | ||
export(lib_status) | ||
export(local_install) | ||
export(local_install_deps) | ||
export(local_install_dev_deps) | ||
export(local_system_requirements) | ||
export(meta_clean) | ||
export(meta_list) | ||
export(meta_summary) | ||
export(meta_update) | ||
export(pak_cleanup) | ||
export(pak_setup) | ||
export(pak_sitrep) | ||
export(pkg_deps) | ||
export(pkg_download) | ||
export(pkg_install) | ||
export(pkg_list) | ||
export(pkg_remove) | ||
export(pkg_search) | ||
export(pkg_status) | ||
importFrom(utils,head) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,244 @@ | ||
|
||
#' Package cache utilities | ||
#' | ||
#' @description | ||
#' Various utilities to inspect and clean the package cache. | ||
#' See the pkgcache package if you need for control over the package cache. | ||
#' | ||
#' @details`cache_summary()` returns a summary of the package cache. | ||
#' | ||
#' @return `cache_summary()` returns a list with elements: | ||
#' * `cachepath`: absolute path to the package cache | ||
#' * `files`: number of files (packages) in the cache | ||
#' * `size`: total size of package cache in bytes | ||
#' | ||
#' @export | ||
#' @rdname cache | ||
#' @examplesIf FALSE | ||
#' # Summary | ||
#' cache_summary() | ||
|
||
cache_summary <- function() { | ||
remote( | ||
function(...) { | ||
get("cache_summary_internal", asNamespace("pak"))(...) | ||
}, | ||
list() | ||
) | ||
} | ||
|
||
cache_summary_internal <- function() { | ||
pkgcache::pkg_cache_summary() | ||
} | ||
|
||
#' @details `cache_list()` lists all (by default), or a subset of | ||
#' packages in the package cache. | ||
#' | ||
#' @param ... For `cache_list()` and `cache_delete()`, `...` may contain | ||
#' filters, where the argument name is the column name. E.g. `package`, | ||
#' `version`, etc. Call `cache_list()` without arguments to see the | ||
#' available column names. If you call `cache_delete()` without arguments, | ||
#' it will delete all cached files. | ||
#' | ||
#' @return `cache_list()` returns a tibble with the data about the cache. | ||
#' | ||
#' @rdname cache | ||
#' @export | ||
#' @examplesIf FALSE | ||
#' # List packages | ||
#' cache_list() | ||
#' cache_list(package = "recipes") | ||
#' cache_list(platform = "source") | ||
|
||
cache_list <- function(...) { | ||
remote( | ||
function(...) { | ||
get("cache_list_internal", asNamespace("pak"))(...) | ||
}, | ||
list(...) | ||
) | ||
} | ||
|
||
cache_list_internal <- function(...) { | ||
pkgcache::pkg_cache_find(...) | ||
} | ||
|
||
#' @details `cache_delete()` deletes files from the cache. | ||
#' | ||
#' @return `cache_delete()` returns nothing. | ||
#' @export | ||
#' @rdname cache | ||
#' @examplesIf FALSE | ||
#' # Delete packages | ||
#' cache_delete(package = "knitr") | ||
#' cache_delete(platform = "macos") | ||
|
||
cache_delete <- function(...) { | ||
remote( | ||
function(...) { | ||
get("cache_delete_internal", asNamespace("pak"))(...) | ||
}, | ||
list(...) | ||
) | ||
invisible() | ||
} | ||
|
||
cache_delete_internal <- function(...) { | ||
pkgcache::pkg_cache_delete_files(...) | ||
} | ||
|
||
#' @details `cache_clean()` deletes all files from the cache. | ||
#' | ||
#' @return `cache_clean()` returns nothing. | ||
#' | ||
#' @export | ||
#' @rdname cache | ||
#' @examplesIf FALSE | ||
#' cache_clean() | ||
|
||
cache_clean <- function() { | ||
remote( | ||
function(...) { | ||
get("cache_clean_internal", asNamespace("pak"))(...) | ||
}, | ||
list() | ||
) | ||
invisible() | ||
} | ||
|
||
cache_clean_internal <- function() { | ||
pkgcache::pkg_cache_delete_files() | ||
} | ||
|
||
#' Metadata cache utilities | ||
#' | ||
#' @description | ||
#' Various utilities to inspect, update and clean the metadata cache. | ||
#' See the pkgcache package if you need for control over the metadata cache. | ||
#' | ||
#' @details `meta_summary()` returns a summary of the metadata cache. | ||
#' | ||
#' @return `meta_summary()` returns a list with entries: | ||
#' * `cachepath`: absolute path of the metadata cache. | ||
#' * `current_db`: the file that contains the current metadata database. | ||
#' It is currently an RDS file, but this might change in the future. | ||
#' * `raw_files`: the files that are the downloaded `PACKAGES*` files. | ||
#' * `db_files`: all metadata database files. | ||
#' * `size`: total size of the metadata cache. | ||
#' | ||
#' @export | ||
#' @rdname metadata | ||
#' @examplesIf FALSE | ||
#' # Metadata cache summary | ||
#' meta_cummary() | ||
|
||
meta_summary <- function() { | ||
remote( | ||
function(...) { | ||
get("meta_summary_internal", asNamespace("pak"))(...) | ||
}, | ||
list() | ||
) | ||
} | ||
|
||
meta_summary_internal <- function() { | ||
ret <- pkgcache::meta_cache_summary() | ||
list( | ||
cachepath = ret$cachepath, | ||
current_db = ret$current_rds, | ||
raw_files = ret$raw_files, | ||
db_files = ret$rds_files, | ||
size = ret$size | ||
) | ||
} | ||
|
||
#' @details `meta_list()` lists all (or some) packages in the metadata | ||
#' database. | ||
#' | ||
#' @param pkg Package names, if specified then only entries for `pkg` | ||
#' are returned. | ||
#' @return `meta_list()` returns a data frame (tibble) of all available | ||
#' packages in the configured repositories. | ||
#' | ||
#' @export | ||
#' @rdname metadata | ||
#' @examplesIf FALSE | ||
#' # The current metadata DB | ||
#' meta_list() | ||
#' # Selected packages only | ||
#' meta_list(pkg = c("shiny", "htmlwidgets")) | ||
|
||
meta_list <- function(pkg = NULL) { | ||
remote( | ||
function(...) { | ||
get("meta_list_internal", asNamespace("pak"))(...) | ||
}, | ||
list(pkg = pkg) | ||
) | ||
} | ||
|
||
meta_list_internal <- function(pkg) { | ||
pkgcache::meta_cache_list(packages = pkg) | ||
} | ||
|
||
#' @details `meta_update()` updates the metadata database. You don't | ||
#' normally need to call this function manually, because all pak functions | ||
#' (e.g. [pkg_install()], [pkg_download()], etc.) call it automatically, | ||
#' to make sure that they use the latest available metadata. | ||
#' | ||
#' @return `meta_update()` returns nothing. | ||
#' | ||
#' @export | ||
#' @rdname metadata | ||
#' @examplesIf FALSE | ||
#' # Update the metadata DB | ||
#' meta_update() | ||
|
||
meta_update <- function() { | ||
remote( | ||
function(...) { | ||
get("meta_update_internal", asNamespace("pak"))(...) | ||
}, | ||
list() | ||
) | ||
invisible() | ||
} | ||
|
||
meta_update_internal <- function() { | ||
pkgcache::meta_cache_update() | ||
} | ||
|
||
#' @details `meta_clean()` deletes the whole metadata DB. | ||
#' | ||
#' @param force If `FALSE`, then pak will ask for confirmation. | ||
#' @return `meta_clean()` returns nothing | ||
#' | ||
#' @export | ||
#' @rdname metadata | ||
#' @examplesIf FALSE | ||
#' # Delete the metadata DB | ||
#' meta_clean() | ||
|
||
meta_clean <- function(force = FALSE) { | ||
if (!force) { | ||
force <- get_confirmation2( | ||
"? Do you want to delete all package metadata (Y/n) " | ||
) | ||
} | ||
if (!force) { | ||
msg("x Metadata cleanup aborted") | ||
return(invisible()) | ||
} | ||
|
||
remote( | ||
function(...) { | ||
get("meta_clean_internal", asNamespace("pak"))(...) | ||
}, | ||
list() | ||
) | ||
invisible() | ||
} | ||
|
||
meta_clean_internal <- function() { | ||
pkgcache::meta_cache_cleanup(force = TRUE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.