Clone a module.

clone(name, from_name, deep = FALSE)

Arguments

name

A string (character vector of lenght one).

A module name can contain letters, figures and some special characters, namely _, -, and /. The latter is a namespace separator.

Names containing /mock/, /mocks/, /test/, /tests/, /example/, or /examples/ have a special meaning related to code testing and examples.

The name "modulr" corresponds to a special module and is therefore reserved.

from_name

Name of module to clone.

deep

A flag. Should the entire register entry be cloned?

Value

A wrapper function around a make call for the defined module.

Details

For versioning purposes, it is often useful to clone modules.

Warning

It is considered a very bad practice to define, touch, undefine, load, make, reset, or perform any other operation from within a module definition that may alterate the internal state of modulr.

See also

define, make, reset, and root_config.

Examples

#> [2017-06-21T21:58:19 UTC] Resetting modulr state ... OK
define("foo", NULL, function() "foo")
#> [2017-06-21T21:58:19 UTC] Defining 'foo' ... OK
clone("bar", "foo")
#> [2017-06-21T21:58:19 UTC] Defining 'bar' ... OK
make("bar")
#> [2017-06-21T21:58:19 UTC] Making 'bar' ... #> [2017-06-21T21:58:19 UTC] * Visiting and defining dependencies ... #> [2017-06-21T21:58:19 UTC] * Constructing dependency graph ... OK #> [2017-06-21T21:58:19 UTC] DONE ('bar' in 0.016 secs)
#> [1] "foo"