Class: Fire::CLI
- Inherits:
-
Object
- Object
- Fire::CLI
- Defined in:
- lib/fire/cli.rb
Overview
Fire’s command line interface.
Class Method Summary collapse
-
.autorun(argv = ARGV) ⇒ Object
Fire her up in autorun mode!.
-
.run(argv = ARGV) ⇒ Object
Fire her up!.
Instance Method Summary collapse
-
#autorun ⇒ Object
Fire her up in autorun mode!.
-
#cli_parse ⇒ Object
Parse command line arguments with just the prettiest little CLI parser there ever was.
-
#initialize(argv = ARGV) ⇒ CLI
constructor
Initialize new instance of Fire::CLI.
-
#list_tasks ⇒ Object
Print out a list of availabe manual triggers.
-
#run ⇒ Object
Fire her up!.
-
#session ⇒ Session
Returns session instance.
-
#watch(seconds) ⇒ Object
Set the watch wait period.
Constructor Details
#initialize(argv = ARGV) ⇒ CLI
Initialize new instance of Fire::CLI.
21 22 23 |
# File 'lib/fire/cli.rb', line 21 def initialize(argv=ARGV) @argv = argv end |
Class Method Details
.autorun(argv = ARGV) ⇒ Object
Fire her up in autorun mode!
16 17 18 |
# File 'lib/fire/cli.rb', line 16 def self.autorun(argv=ARGV) new(argv).autorun end |
.run(argv = ARGV) ⇒ Object
Fire her up!
11 12 13 |
# File 'lib/fire/cli.rb', line 11 def self.run(argv=ARGV) new(argv).run end |
Instance Method Details
#autorun ⇒ Object
Fire her up in autorun mode!
37 38 39 40 |
# File 'lib/fire/cli.rb', line 37 def autorun args = cli_parse session.autorun(args) end |
#cli_parse ⇒ Object
Parse command line arguments with just the prettiest little CLI parser there ever was.
44 45 46 47 48 |
# File 'lib/fire/cli.rb', line 44 def cli_parse cli @argv, "-T" => method(:list_tasks), "-w" => method(:watch) end |
#list_tasks ⇒ Object
Print out a list of availabe manual triggers.
51 52 53 54 55 |
# File 'lib/fire/cli.rb', line 51 def list_tasks puts "(#{session.root})" puts session.task_sheet exit end |
#run ⇒ Object
Fire her up!
31 32 33 34 |
# File 'lib/fire/cli.rb', line 31 def run args = cli_parse session.run(args) end |
#session ⇒ Session
Returns session instance. [Session]
26 27 28 |
# File 'lib/fire/cli.rb', line 26 def session @session ||= Session.new(:watch=>@watch) end |
#watch(seconds) ⇒ Object
Set the watch wait period.
58 59 60 |
# File 'lib/fire/cli.rb', line 58 def watch(seconds) @watch = seconds end |