Skip to contents

Preview or create a client-owned R/zzz.R with .onLoad() and .onAttach() stubs, and the helper file they call. Specmill remains a development dependency.

Usage

configure_lifecycle(root, mode = c("plan", "apply"))

Arguments

root

Existing client package directory containing DESCRIPTION.

mode

Preview by default; apply writes the files.

Value

A list containing proposed text in files, changes with file/action/before/after, and collisions with .onLoad() or .onAttach() definitions outside R/zzz.R.

Details

R/zzz.R is written once and belongs to the client: an existing file is reported as kept and never changed, and regeneration and pruning leave it alone. R/client_lifecycle.R holds three helpers and stays specmill's: running this function again updates it to the current template, and refuses if it was edited by hand. prune = 'all' keeps the helper file while R/zzz.R exists, because your code there may call it; delete R/zzz.R first to remove both.

The helpers set option defaults without replacing values the session already set, emit a startup message through packageStartupMessage() (silent under suppressPackageStartupMessages() and devtools::load_all()), and report which credential environment variables are set without returning their values. Nothing here makes an HTTP call. The stubs do nothing until you uncomment or add code.

.onLoad() or .onAttach() defined in another R file blocks application.

See also

configure_hooks, initialize_client

Examples

if (FALSE) { # \dontrun{
configure_lifecycle('path/to/client')$changes
configure_lifecycle('path/to/client', mode = 'apply')
} # }