Module: Runfile
- Includes:
- Colsole
- Defined in:
- lib/runfile/dsl.rb,
lib/runfile/action.rb,
lib/runfile/runner.rb,
lib/runfile/version.rb,
lib/runfile/docopt_maker.rb
Overview
This file defines all the commands supported in a Runfile. All commands are immediately handed over to the Runner instance for handling.
Defined Under Namespace
Classes: Action, DocoptMaker, Runner
Constant Summary collapse
- VERSION =
"0.2.2"
Instance Method Summary collapse
-
#action(name, &block) ⇒ Object
Define the action.
-
#call(command_string) ⇒ Object
Cross-call another action.
-
#command(name = nil) ⇒ Object
(also: #endcommand)
Define a new command namespace.
-
#help(text) ⇒ Object
Set the help message for the next action.
-
#option(flag, text) ⇒ Object
Add an option/flag to the next action (can be called multiple times).
-
#summary(text) ⇒ Object
Set the one line summary of your Runfile program.
-
#usage(text) ⇒ Object
Set the usage pattern for the next action.
-
#version(ver) ⇒ Object
Set the version of your Runfile program.
Instance Method Details
#action(name, &block) ⇒ Object
Define the action
33 34 35 |
# File 'lib/runfile/dsl.rb', line 33 def action(name, &block) Runner.instance.add_action name, &block end |
#call(command_string) ⇒ Object
Cross-call another action
43 44 45 |
# File 'lib/runfile/dsl.rb', line 43 def call(command_string) Runner.instance.cross_call command_string end |
#command(name = nil) ⇒ Object Also known as: endcommand
Define a new command namespace
38 39 40 |
# File 'lib/runfile/dsl.rb', line 38 def command(name=nil) Runner.instance.namespace = name end |
#help(text) ⇒ Object
Set the help message for the next action
22 23 24 |
# File 'lib/runfile/dsl.rb', line 22 def help(text) Runner.instance.last_help = text end |
#option(flag, text) ⇒ Object
Add an option/flag to the next action (can be called multiple times)
28 29 30 |
# File 'lib/runfile/dsl.rb', line 28 def option(flag, text) Runner.instance.add_option flag, text end |
#summary(text) ⇒ Object
Set the one line summary of your Runfile program
12 13 14 |
# File 'lib/runfile/dsl.rb', line 12 def summary(text) Runner.instance.summary = text end |