Class: Fire::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/fire/cli.rb

Overview

Fire’s command line interface.

Class Method Summary collapse

Instance Method Summary collapse

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

#autorunObject

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_parseObject

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_tasksObject

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

#runObject

Fire her up!



31
32
33
34
# File 'lib/fire/cli.rb', line 31

def run
  args = cli_parse
  session.run(args)
end

#sessionSession

Returns session instance. [Session]

Returns:



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