-
Notifications
You must be signed in to change notification settings - Fork 0
Scripting api
The mdoc
command line tool can handle complex projects as well as one off migration scripts. To simplify one off migration scripts, mdoc adds various methods to the groovy Script and Binding classes. To do this, an extension class is used. Here are the most frequently used methods in mdoc scripts:
configure() - Configures the script by parsing command line arguments and adding the default
configuration located at ~/.metridoc/MetridocConfig.groovy
. Behind the scenes, includeService(ConfigService)
is called. See the Metridoc Configuration page for more details.
includeService(Class serviceClass) - Instantiates a service and injects any command line or binded variables in addition to other previously included services. A service class can be ANY class with a no arg constructor. For more details on services see the Metridoc Services page.
step(Map description, Closure work) - Creates a step within a pipeline of work. In addition to the description containing the name of the step, is also can contains a depends
parameter to describe a workflow. Unless directly called, each step can only run once. Please see Metridoc Steps for more details.
runStep(String stepName) - Runs a step along with all of its dependencies.
profile(Closure) - Runs the enclosed work while printing profile information.
Although MetridocScript performs the Script extensions, StepManager does most of the work.