| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/record.R |
| 3 |
\name{record} |
| 4 |
\alias{record} |
| 5 |
\title{Update package records in a lockfile} |
| 6 |
\usage{ |
| 7 |
record(records, lockfile = NULL, project = NULL, enrich = TRUE) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{records}{A list of named records, mapping package names to a definition |
| 11 |
of their source. See \strong{Records} for more details.} |
| 12 |
|
| 13 |
\item{lockfile}{Path to a lockfile. When \code{NULL} (the default), the |
| 14 |
\code{renv.lock} located in the root of the current project will be used.} |
| 15 |
|
| 16 |
\item{project}{The project directory. If \code{NULL}, then the active project will |
| 17 |
be used. If no project is currently active, then the current working |
| 18 |
directory is used instead.} |
| 19 |
|
| 20 |
\item{enrich}{Should resolved records be enriched with the DESCRIPTION |
| 21 |
fields that \code{snapshot()} would write (\code{Depends}, \code{Imports}, \code{Suggests}, |
| 22 |
\code{LinkingTo}, \code{License}, etc.)? Defaults to \code{TRUE}. When \code{TRUE}, |
| 23 |
\code{record()} consults the active package repositories (and crandb, when |
| 24 |
enabled, for CRAN packages) to fill in the additional fields, erroring |
| 25 |
if the remote source is unreachable. The \code{Hash} field is not computed |
| 26 |
for enriched records. Additional DESCRIPTION-only fields (\code{Title}, |
| 27 |
\code{Description}, \code{Author}, \code{Maintainer}) are only included when the |
| 28 |
source can supply them -- typically when crandb is reachable for CRAN |
| 29 |
packages, or when the source is a Git host (GitHub, GitLab, Bitbucket). |
| 30 |
Set to \code{FALSE} to keep the minimal record (\code{Package}, \code{Version}, |
| 31 |
\code{Source}, \code{Repository}) produced by remote resolution.} |
| 32 |
} |
| 33 |
\description{ |
| 34 |
Use \code{record()} to record a new entry within an existing renv lockfile. |
| 35 |
} |
| 36 |
\details{ |
| 37 |
This function can be useful when you need to change one or more of the |
| 38 |
package records within an renv lockfile -- for example, because a recorded |
| 39 |
package cannot be restored in a particular environment, and you know of a |
| 40 |
suitable alternative. |
| 41 |
} |
| 42 |
\section{Records}{ |
| 43 |
Records can be provided either using the \strong{remotes} short-hand syntax, |
| 44 |
or by using an \R list of entries to record within the lockfile. See |
| 45 |
\code{?lockfiles} for more information on the structure of a package record. |
| 46 |
} |
| 47 |
|
| 48 |
\examples{ |
| 49 |
|
| 50 |
\dontrun{ |
| 51 |
|
| 52 |
# use digest 0.6.22 from package repositories -- different ways |
| 53 |
# of specifying the remote. use whichever is most natural |
| 54 |
renv::record("[email protected]") |
| 55 |
renv::record(list(digest = "0.6.22")) |
| 56 |
renv::record(list(digest = "[email protected]")) |
| 57 |
|
| 58 |
# alternatively, provide a full record as a list |
| 59 |
digest_record <- list( |
| 60 |
Package = "digest", |
| 61 |
Version = "0.6.22", |
| 62 |
Source = "Repository", |
| 63 |
Repository = "CRAN" |
| 64 |
) |
| 65 |
|
| 66 |
renv::record(list(digest = digest_record)) |
| 67 |
|
| 68 |
} |
| 69 |
} |