Class: Chef::Fork::Application
- Inherits:
-
Object
- Object
- Chef::Fork::Application
- Defined in:
- lib/chef/fork/application.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#optparse ⇒ Object
readonly
Returns the value of attribute optparse.
Instance Method Summary collapse
- #configure(options = {}) ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #main(args = []) ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
13 14 15 16 17 18 19 |
# File 'lib/chef/fork/application.rb', line 13 def initialize() @logger = Logger.new(STDERR) @optparse = OptionParser.new @optparse.version = "#{Chef::Fork::VERSION} (chef #{Chef::VERSION})" = {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'lib/chef/fork/application.rb', line 20 def end |
#optparse ⇒ Object (readonly)
Returns the value of attribute optparse.
21 22 23 |
# File 'lib/chef/fork/application.rb', line 21 def optparse @optparse end |
Instance Method Details
#configure(options = {}) ⇒ Object
33 34 35 |
# File 'lib/chef/fork/application.rb', line 33 def configure(={}) configure_chef(locate_config_file("fork") || locate_config_file("knife"), ) end |
#main(args = []) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/chef/fork/application.rb', line 23 def main(args=[]) rest = @optparse.order(args) begin command = get_command(rest.shift || "help").new(self) command.run(rest) rescue Errno::EPIPE # noop end end |