Learn R Programming

pkgmaker (version 0.10.1)

packageExtraHandler: Install/Run Extra Things After Standard Package Installation

Description

These functions define a framework to register actions for which default sets of arguments can be defined when (lazy-)loading a package, and run later on, e.g., after the package is installed using dedicated commands.

packageExtra registers extra actions for a given handler.

packageExtraRunner defines a function to run all or some of the actions registered for a given handler in a given package. For example, the function install.extrapackages is the runner defined for the extra handler 'install' via packageExtraRunner('install').

install.extras runs all extra actions registered for a given package.

install.extrapackages runs all extra 'install' actions, i.e. those registered for handler 'install'.

Usage

packageExtraHandler(handler, fun, package = NULL)

packageExtra(handler, extra = NULL, ..., package = NULL, .wrap = FALSE)

packageExtraRunner(handler)

install.extras(package, extra = NULL, ..., .verbose = getOption("verbose"))

install.extrapackages(package, extra = NULL, ..., .verbose = getOption("verbose"))

Arguments

handler
name of a handler, e.g, 'install'. It must be unique across all handlers registered by any other packages.
fun
handler function that will be called with the arguments registered with packageExtra(name, ...)
package
package name where to store/look for the internal registries. End users should not need to use this argument.
extra
name of the extra action. When registering an action with , it should be unique within the package, or it will overwrite a previously registered action.
...
extra arguments passed to the actual call to the handler. In packageExtra, these define default arguments for the call, which can be overwritten by arguments passed to the runner function.
.wrap
logical that indicates if a function that runs the extra action should be returned or only the default arguments
.verbose
logical that indicates if verbose messages about the extra actions being run should be displayed.

Value

  • the runner function associated with the newly registered handler, as built by packageExtraRunner.

Details

packageExtraHandler defines main action handler functions, for which default arguments are registered using packageExtra.

For example, calling packageExtra('install', pkgs='non_CRAN_pkg', repos='http://non-standard-repo') in a source file of package 'myPkg' registers the call install.packages('non_CRAN_pkg', repos='http://non-standard-repo', ...) in a registry internal to the package. All calls to packageExtra('install', ...) can then be run by the user, as a post installation step via install.extra('myPkg', ..).