Framework for R

Project Management

bootstrap()

Prepare a Cloned Project

Gets a project ready to work in after git clone, on a new machine or a cluster. Every step is safe to repeat, and none contacts Framework Cloud:

Usage

bootstrap(path = ".", interactive = base::interactive(), packages = TRUE)

Arguments

Name Default Description
path "."

The project folder (default: the current directory).

interactive base::interactive()

If TRUE, ask for the values of empty .env variables. If FALSE, never prompt and list them as to-dos instead.

packages TRUE

If FALSE, skip package installation.

Value

Invisibly, a list with root, done (the steps that changed something), and todo (things left to do by hand).

Details

  1. Make sure .gitignore ignores .env.
  2. Create .env from .env.example when it is missing, and list the variables that are still empty.
  3. Create the project folders, which git does not carry when they are empty or ignored. Absolute paths (shared drives) are left alone.
  4. Create framework.db, or add the tables a newer version needs.
  5. Install packages: renv::restore() when the project has renv.lock, otherwise the packages listed in settings.yml.
  6. Install the git hooks enabled in settings.yml.

The Python package and fw bootstrap follow the same contract. From a shell: Rscript -e 'framework::bootstrap(interactive = FALSE)', which exits with status 0 when the project is ready (even with to-dos left) and 1 when a step failed.

Examples

Not run

if (FALSE) {
# After cloning a project
framework::bootstrap()
# In a job script on a cluster
framework::bootstrap(interactive = FALSE)
}

Related reference