| 1 |
|
| 2 |
#' @param project The project directory. If `NULL`, then the active project will |
| 3 |
#' be used. If no project is currently active, then the current working |
| 4 |
#' directory is used instead. |
| 5 |
#' |
| 6 |
#' @param type The type of package to install ("source" or "binary"). Defaults |
| 7 |
#' to the value of `getOption("pkgType")`. |
| 8 |
#' |
| 9 |
#' @param lockfile Path to a lockfile. When `NULL` (the default), the |
| 10 |
#' `renv.lock` located in the root of the current project will be used. |
| 11 |
#' |
| 12 |
#' @param library The \R library to be used. When `NULL`, the active project |
| 13 |
#' library will be used instead. |
| 14 |
#' |
| 15 |
#' @param prompt Boolean; prompt the user before taking any action? For backwards |
| 16 |
#' compatibility, `confirm` is accepted as an alias for `prompt`. |
| 17 |
#' |
| 18 |
#' @param ... Unused arguments, reserved for future expansion. If any arguments |
| 19 |
#' are matched to `...`, renv will signal an error. |
| 20 |
#' |
| 21 |
#' @param clean Boolean; remove packages not recorded in the lockfile from |
| 22 |
#' the target library? Use `clean = TRUE` if you'd like the library state |
| 23 |
#' to exactly reflect the lockfile contents after `restore()`. |
| 24 |
#' |
| 25 |
#' @param rebuild Force packages to be rebuilt, thereby bypassing any installed |
| 26 |
#' versions of the package available in the cache? This can either be a |
| 27 |
#' boolean (indicating that all installed packages should be rebuilt), or a |
| 28 |
#' vector of package names indicating which packages should be rebuilt. |
| 29 |
#' |
| 30 |
#' @param repos The repositories to use when restoring packages installed |
| 31 |
#' from CRAN or a CRAN-like repository. By default, the repositories recorded |
| 32 |
#' in the lockfile will be used, ensuring that (e.g.) CRAN packages are |
| 33 |
#' re-installed from the same CRAN mirror. |
| 34 |
#' |
| 35 |
#' Use `repos = getOption("repos")` to override with the repositories set |
| 36 |
#' in the current session, or see the `repos.override` option in [config] for |
| 37 |
#' an alternate way override. |
| 38 |
#' |
| 39 |
#' @param profile The profile to be activated. See |
| 40 |
#' `vignette("profiles", package = "renv")` for more information. |
| 41 |
#' When `NULL` (the default), the profile is not changed. Use |
| 42 |
#' `profile = "default"` to revert to the default `renv` profile. |
| 43 |
#' |
| 44 |
#' @param dependencies A vector of DESCRIPTION field names that should be used |
| 45 |
#' for package dependency resolution. When `NULL` (the default), the value |
| 46 |
#' of `renv::settings$package.dependency.fields` is used. The aliases |
| 47 |
#' "strong", "most", and "all" are also supported. |
| 48 |
#' See [tools::package_dependencies()] for more details. |
| 49 |
#' |
| 50 |
#' @param packages Either `NULL` (the default) to install all packages required |
| 51 |
#' by the project, or a character vector of packages to install. renv |
| 52 |
#' supports a subset of the remotes syntax used for package installation, |
| 53 |
#' e.g: |
| 54 |
#' |
| 55 |
#' * `pkg`: install latest version of `pkg` from CRAN. |
| 56 |
#' * `pkg@version`: install specified version of `pkg` from CRAN. |
| 57 |
#' * `username/repo`: install package from GitHub. |
| 58 |
#' * `username/repo@ref`: install from a specific git ref (branch, tag, or SHA). |
| 59 |
#' * `username/repo:subdir`: install from a subdirectory of a GitHub repo. |
| 60 |
#' * `bioc::pkg`: install `pkg` from Bioconductor. |
| 61 |
#' |
| 62 |
#' See <https://remotes.r-lib.org/articles/dependencies.html> and the examples |
| 63 |
#' below for more details. |
| 64 |
#' |
| 65 |
#' Note that renv deviates from the remotes spec in one important way: |
| 66 |
#' subdirectories are separated from the repository specification with a `:` |
| 67 |
#' rather than `/`. For example, to install from the `subdir` subdirectory |
| 68 |
#' of GitHub package `username/repo`, you would use: |
| 69 |
#' |
| 70 |
#' ``` |
| 71 |
#' renv::install("username/repo:subdir") |
| 72 |
#' ``` |
| 73 |
#' |
| 74 |
#' @return The project directory, invisibly. Note that this function is normally |
| 75 |
#' called for its side effects. |
| 76 |
#' |
| 77 |
#' @name renv-params |
| 78 |
NULL |
| 79 |
|
| 80 |
renv_roxygen_config_section <- function() { |
| 81 |
|
| 82 |
# read config |
| 83 |
config <- yaml::read_yaml("inst/config.yml") |
| 84 |
|
| 85 |
# generate items |
| 86 |
items <- map_chr(config, function(entry) { |
| 87 |
|
| 88 |
# extract fields |
| 89 |
name <- entry$name |
| 90 |
type <- entry$type |
| 91 |
default <- entry$default |
| 92 |
description <- entry$description |
| 93 |
|
| 94 |
# deparse default value |
| 95 |
default <- case( |
| 96 |
identical(default, list()) ~ "NULL", |
| 97 |
TRUE ~ deparse(default) |
| 98 |
) |
| 99 |
|
| 100 |
# generate table row |
| 101 |
fmt <- "\\subsection{renv.config.%s}{%s Defaults to \\code{%s}.}" |
| 102 |
sprintf(fmt, name, description, default) |
| 103 |
|
| 104 |
}) |
| 105 |
|
| 106 |
c( |
| 107 |
"@section Configuration:", |
| 108 |
"", |
| 109 |
"The following renv configuration options are available:", |
| 110 |
"", |
| 111 |
items, |
| 112 |
"" |
| 113 |
) |
| 114 |
|
| 115 |
} |