-
Notifications
You must be signed in to change notification settings - Fork 6
Running Ladon
Once you have written an Automation
, the logical next step is to execute that Automation
.
Ladon comes packaged with a simple automation runner, fittingly named ladon-run
.
When you install the ladon
gem, the gem installer will automatically add the ladon-run
command to your PATH
. This command simply runs the script in this repository at bin/ladon-run
.
If you've already installed ladon
, go ahead and try it now: ladon-run -h
. This should print out the usage details of the ladon-run
utility:
ssnow-mbp15:ladon ssnow$ ladon-run -h
Usage: ladon-run [options]
-a, --automation PATH [REQUIRED] Path to the target automation script to be executed
-s, --automation_class NAME Name of the target Automation class to run.
-i, --interactive PHASE_LIST Comma-separated list of phase names to enter interactive mode BEFORE running
-f, --flags FLAGS Flags to give the target automation. Comma-separated list of name:value pairs; may be repeated.
-r, --review Use Pry to review after target automation completes
-p, --result_file_path PATH File to store the formatted Result data of the ladon-run Automation
--formatter FMT Formatting method to call on the Result of ladon-run for output (ex: to_s)
-h, --help Prints this help message
As you can see, the -a
option is required, as it tells ladon-run
where your Automation
script is located.
Note: if the script at the path given to -a
results in multiple non-abstract Automation
subclasses being loaded - for example, if your script defines multiple Automation
s - ladon-run
can't know which Automation
you actually want to run. In these circumstances, ladon-run
will prompt you to select the correct one. You can also bypass this interactive prompt by specifying the correct Automation
class using the -s
option.
Automation
s are designed to take in flags; flags must be implemented with a reasonable default value, so you're never required to pass in any flags. If you want to override the default values, you must can the -f
option!. This option must be proceeded by a comma-separated list of name:value
pairs. If you are only specifying a single flag, you do not need a comma.
The ladon-run
executable is not merely a tool for running a script and waiting for it to complete -- after all, there's more to working with and reasoning about software than that! This utility sports an interactive mode, meaning that it is capable of dropping you into an interactive debugging session at various points during the execution of the Automation
.
During interactive mode, you have access to the Automation that ladon-run
is harnessing, as well as any component of that Automation, including its configuration, current result data, underlying model (in the case of ModelAutomation
s), etc. This is pretty nifty.
This is what the -r
and -i
options are designed to facilitate!
The -r
option will drop you into interactive mode after all phases of the Automation
have completed. This is primarily useful for interrogating Ladon's intermediate representation of the Automation
result.
The -i
option is similar; if specified, it requires a comma-separated list of Automation
phase names. This option is for dropping you into interactive mode before the specified phases are processed. For example, if you want to pause execution before a phases called config
and cleanup
, you would use -i cleanup,config
. Note: if you specify an invalid phase name, it will be ignored.
- When you are inserted into an interactive session, you will remain in that session until you enter the
exit
command.- Upon doing so,
ladon-run
will automatically resume automatic execution. Nifty.
- Upon doing so,
- Enter the
target_automation
command to access theAutomation
thatladon-run
is harnessing.- You can call methods on the
target_automation
as you would normally (for example, trytarget_automation.result
!)
- You can call methods on the
- The interactive mode is facilitated via
pry
, which is the reason forladon
requiring it as a dependency- Want to go interactive directly in your automation or model? Use a
binding.pry
statement andladon-run
will automatically enter interactive mode - Install the pry-byebug gem to get
byebug
-style debugging features automatically in your interactive sessions! - Install the pry-stack_explorer gem to get nifty call stack exploration tools automatically in your interactive sessions!
- Want to go interactive directly in your automation or model? Use a
Next: Contributing to Ladon