sandbox: Run actions in a sandbox

View source: R/sandbox.R

sandboxR Documentation

Run actions in a sandbox

Description

If you want to test the effects of roxy.package, archive.packages or debianize, you can activate a sandbox with this function.

Usage

sandbox(
  active = FALSE,
  sandbox.dir = file.path(tempdir(), "roxyPackge", "sandbox"),
  pck.source.dir = TRUE,
  R.libs = TRUE,
  repo.root = TRUE,
  archive = repo.root,
  clean = FALSE
)

Arguments

active

Logical, whether sandboxing should be active or not

sandbox.dir

Character string, full path to the sandbox root directory to use. Will be created if necessary (at first use, not when setting this here!).

pck.source.dir

Logical, whether to sandbox the package sources. If TRUE the full package sources will be copied to file.path(sandbox.dir, "src") (at first use, not when setting this here!).

R.libs

Logical, whether to sandbox the R library directory, that is, the directory to install the package to. Since this needs also to provide all package dependencies, those packages will be copied to file.path(sandbox.dir, "R") (at first use, not when setting this here!).

repo.root

Logical, whether to sandbox the repository. This repository will be set up in file.path(sandbox.dir, "repo") (at first use, not when setting this here!).

archive

Logical, whether to sandbox the repository archive. The archive will be set up in file.path(sandbox.dir, "repo_archive") (at first use, not when setting this here!).

clean

Logical, whether to always clean the defined sandbox.dir completely before any other action is taken. Be aware that this will wipe everything that resides in the current sandbox! Ignored if active=FALSE.

Details

Sandboxing means that you are able to specify which groups of actions should only be run in a separate environment. This can be useful if you don't want to make changes to your actual package code, but inspect the result first.

With this function, you can turn sandboxing on and off. This setting has effects only in the currently running R session. By default, sandboxing is off.

Value

Settings are stored in an internal environment, so there is no actual return value.

Note

When using sandboxing for your source code, be aware that changes to the original code will not be updated in the sandbox automatically. For example, if you run roxy.package to check your package, fix an issue in the original source location and run roxy.package again, your changes will not have affected the code in the sandbox directory. For those cases, it might be advisable to use the clean=TRUE option.

See Also

sandbox.status to see the current settings.

Examples

## Not run: 
# turn sandboxing on
sandbox(active=TRUE)

## End(Not run)

unDocUMeantIt/roxyPackage documentation built on July 26, 2024, 5:57 p.m.