Class: Brewmaster::CLI
- Inherits:
-
Object
- Object
- Brewmaster::CLI
- Defined in:
- lib/brewmaster/cli.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
-
#coordinator ⇒ Object
Returns the value of attribute coordinator.
Instance Method Summary collapse
-
#initialize(args) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ CLI
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/brewmaster/cli.rb', line 5 def initialize(args) = {} @name = 'brewmaster' OptionParser.new do |parser| parser. = [ "Usage: #{@name} [--bootstrap] [-c config_file]\n", " #{@name} --help\n" ].compact.join parser.on('-c', '--config FILE') do |path| [:config_path] = path end parser.on('--bootstrap') do [:bootstrap] = true end # parser.on("-l", "--log FILE") do |path| # options[:log_path] = path # end parser.on_tail("-?", "--help", "Display this usage information.") do puts "#{parser}\n" exit end end.parse!(args) self.configuration = Configuration.new() self.coordinator = Coordinator.new(configuration) end |
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
3 4 5 |
# File 'lib/brewmaster/cli.rb', line 3 def configuration @configuration end |
#coordinator ⇒ Object
Returns the value of attribute coordinator.
3 4 5 |
# File 'lib/brewmaster/cli.rb', line 3 def coordinator @coordinator end |
Instance Method Details
#run ⇒ Object
38 39 40 |
# File 'lib/brewmaster/cli.rb', line 38 def run coordinator.run end |