class Berkshelf::API::SrvCtl
Attributes
options[R]
Public Class Methods
new(options = {})
click to toggle source
@param [Hash] options
@see {Berkshelf::API::Application.run} for the list of valid options
# File lib/berkshelf/api/srv_ctl.rb, line 66 def initialize(options = {}) @options = options @options[:eager_build] = true end
parse_options(args, filename)
click to toggle source
@param [Array] args
@return [Hash]
# File lib/berkshelf/api/srv_ctl.rb, line 11 def parse_options(args, filename) options = Hash.new OptionParser.new("Usage: #{filename} [options]") do |opts| opts.on("-h", "--host HOST", String, "set the listening address") do |h| options[:host] = h end opts.on("-p", "--port PORT", Integer, "set the listening port") do |v| options[:port] = v end opts.on("-V", "--verbose", "run with verbose output") do options[:log_level] = "INFO" end opts.on("-d", "--debug", "run with debug output") do options[:log_level] = "DEBUG" end opts.on("-q", "--quiet", "silence output") do options[:log_location] = '/dev/null' end opts.on("-c", "--config FILE", String, "path to a configuration file to use") do |v| options[: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) options.symbolize_keys end
run(args, filename)
click to toggle source
@param [Array] args @param [String] filename
# File lib/berkshelf/api/srv_ctl.rb, line 56 def run(args, filename) options = parse_options(args, filename) new(options).start end
Public Instance Methods
start()
click to toggle source
# File lib/berkshelf/api/srv_ctl.rb, line 71 def start require 'berkshelf/api' Berkshelf::API::Application.run(options) end