prepare_gear: Prepare Modulr Gear.

View source: R/gears.R

prepare_gearR Documentation

Prepare Modulr Gear.

Description

Prepare a module (including mocks, tests and examples) for publication as a modulr gear.

Usage

prepare_gear(name = .Last.name, url = NULL, load = TRUE)

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.

url

A string (character vector of length one). The URL must use the HTTP(S) protocol.

load

A flag. Should an undefined module be implicitely loaded?

Details

A modulr gear is an R Markdown script containing a module, its docstring info, and its special modules definitions, like mocks, tests, and examples, for instance. prepare_gear prepares such a Modulr Gear. If an url is given, the script will be completed accordingly (see example).

Value

A string (character vector of length one) containing a modulr gear R Markdown script.

See Also

define, release_gear_as_gist, info, and reset.

Examples

reset()
define("foo", NULL, function() {
 #' # A `foo` module
 #'
 #' Description goes here.
 NULL
})
cat(prepare_gear("foo", url = "https://example.org/gears/foo"), sep = "\n")


aclemen1/modulr documentation built on Oct. 2, 2024, 7:18 a.m.