Title: | Simplify Project Scaffolding and Common 'renv' Related Tasks |
---|---|
Description: | Opionionated {renv} helper package by cynkra GmbH. |
Authors: | Patrick Schratz [aut, cre] , Kirill Müller [aut] |
Maintainer: | Patrick Schratz <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.4 |
Built: | 2024-11-20 11:22:40 UTC |
Source: | https://github.com/cynkra/cynkrathis |
Builds and deploys a local package to a git repository in a CRAN like structure.
The resulting git repository can then be served via RStudio Connect and accessed as an
additional repository next to the main CRAN repository (by setting it via
options(repos = )
).
RStudio Connect can crawl the repository in a defined internal when deploying
the git repository via "Import from git".
Changes (i.e. new package versions) are picked up automatically.
This is an alternative to hosting and using a private instance of RStudio Package Manager.
The function executes the following tasks:
Build a tarball of the package via pkgbuild::build()
.
Add the built package in a CRAN like structure to a temporary git clone of the upstream git repository via drat. “
Render (and create if missing) the drat package website.
Commit and push the changes to the git repository.
deploy_minicran_package(drat_repo, commit_message = NULL, dry_run = FALSE)
deploy_minicran_package(drat_repo, commit_message = NULL, dry_run = FALSE)
drat_repo |
|
commit_message |
|
dry_run |
|
## Not run: deploy_minicran_package(drat_repo = "https://github.com/myuser/mydratrepo.git") ## End(Not run)
## Not run: deploy_minicran_package(drat_repo = "https://github.com/myuser/mydratrepo.git") ## End(Not run)
A list of curated cynkra RStudio Package Manager snapshot IDs and their metadata.
get_snapshots()
get_snapshots()
By making use of the gitignore.io API.
init_gitignore(commit = TRUE)
init_gitignore(commit = TRUE)
commit |
|
Use precommit with that project
init_precommit(commit = TRUE)
init_precommit(commit = TRUE)
commit |
|
Initializes renv setup by setting a predefined RStudio Package
Manager (RSPM) snapshot.
Custom RSPM Snapshots can be configured via snapshot_date
.
init_renv(snapshot_date = NULL, exclude = NULL, convenience_pkgs = FALSE)
init_renv(snapshot_date = NULL, exclude = NULL, convenience_pkgs = FALSE)
snapshot_date |
|
exclude |
|
convenience_pkgs |
|
During the process, the latest CRAN version of renv will be installed, regardless of the chosen snapshot ID.
The heuristic for setting the correct RSPM binary repo currently only supports Windows, macOS and Ubuntu 20.04.
The initialization mostly runs in clean vanilla sessions started with
callr::r_vanilla()
.
## Not run: init_renv() ## End(Not run)
## Not run: init_renv() ## End(Not run)
Initialize tic CI structure
init_tic(commit = TRUE)
init_tic(commit = TRUE)
commit |
|
This functions aims to be used within a "snapshot-centered project
workflow" and can be used to downgrade all packages to an RSPM snapshot listed in
renv.lock
.
While the main purpose is downgrade packages which exist in a higher version, this function can also be used to restore a clean state of the project library outside of a downgrade scenario. Be aware of the handling of packages installed from remote sources (see section "Downgrading behavior").
Under the hood, it records all packages installed in the renv
project
library and restores these with the RSPM snapshot found in Line 7 of
renv.lock
.
renv_downgrade()
renv_downgrade()
Called for its side-effect.
There are important differences to be aware of when downgrading packages with respect to their installation source:
If a package is not available on CRAN, renv_downgrade()
will restore the
version from the remote source just fine.
If a package is available on CRAN and a remote snapshot (e.g. from GitHub)
was referenced in renv.lock
, renv_downgrade()
will downgrade this package
to its CRAN version of the respective snapshot and not keep the remote
snapshot version.
renv_switch_r_version()
## Not run: renv_downgrade() ## End(Not run)
## Not run: renv_downgrade() ## End(Not run)
This is a wrapper around pkgbuild::build()
and renv::install()
to more
easily make local packages available within renv projects.
The following steps are performed:
Building the package found at argument path
via pkgbuild::build()
.
Moving the built source into the renv cache. The cache location is
determined by Sys.getenv("RENV_PATHS_LOCAL")
.
Installing the package from the cache location via renv::install()
.
renv_install_local(path = ".", quiet = FALSE, ...)
renv_install_local(path = ".", quiet = FALSE, ...)
path |
|
quiet |
|
... |
|
This function switches between R versions in renv projects which follow the 'cynkra RSPM snapshot' logic. This means that each R version is tied to a specific RSPM snapshot.
The function executes the following tasks:
Replace the R Version in renv.lock
.
Replace the RSPM snapshot in renv.lock
with the one associated with the
selected R Version.
(optional) execution of renv::update()
.
(optional) execution of renv::snapshot()
.
renv_switch_r_version(version = NULL)
renv_switch_r_version(version = NULL)
version |
|
TRUE (invisibly)
get_snapshots
## Not run: renv_switch_r_version("4.0.4") ## End(Not run)
## Not run: renv_switch_r_version("4.0.4") ## End(Not run)
Aviator is a GitHub app that provides a merge queue. Compared to GitHub's native merge queue, it does not require branch protection.
This function:
installs the Aviator app for a repository (FIXME)
creates a default configuraton and pushes it to the main branch
use_aviator()
use_aviator()