Class: Berkshelf::API::SrvCtl
- Inherits:
-
Object
- Object
- Berkshelf::API::SrvCtl
- Defined in:
- lib/berkshelf/api/srv_ctl.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ SrvCtl
constructor
A new instance of SrvCtl.
- #start ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ SrvCtl
Returns a new instance of SrvCtl.
66 67 68 69 |
# File 'lib/berkshelf/api/srv_ctl.rb', line 66 def initialize( = {}) @options = @options[:eager_build] = true end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
62 63 64 |
# File 'lib/berkshelf/api/srv_ctl.rb', line 62 def @options end |
Class Method Details
.parse_options(args, filename) ⇒ Hash
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/berkshelf/api/srv_ctl.rb', line 11 def (args, filename) = Hash.new OptionParser.new("Usage: #{filename} [options]") do |opts| opts.on("-h", "--host HOST", String, "set the listening address") do |h| [:host] = h end opts.on("-p", "--port PORT", Integer, "set the listening port") do |v| [:port] = v end opts.on("-V", "--verbose", "run with verbose output") do [:log_level] = "INFO" end opts.on("-d", "--debug", "run with debug output") do [:log_level] = "DEBUG" end opts.on("-q", "--quiet", "silence output") do [:log_location] = '/dev/null' end opts.on("-c", "--config FILE", String, "path to a configuration file to use") do |v| [:config_file] = v end opts.on("-v", "--version", "show version") do |v| require 'berkshelf/api/version' puts Berkshelf::API::VERSION exit end opts.on_tail("-h", "--help", "show this message") do puts opts exit end end.parse!(args) .symbolize_keys end |
.run(args, filename) ⇒ Object
56 57 58 59 |
# File 'lib/berkshelf/api/srv_ctl.rb', line 56 def run(args, filename) = (args, filename) new().start end |
Instance Method Details
#start ⇒ Object
71 72 73 74 |
# File 'lib/berkshelf/api/srv_ctl.rb', line 71 def start require 'berkshelf/api' Berkshelf::API::Application.run() end |