class Garlando::CLI

Public Class Methods

perform(args) click to toggle source
# File lib/garlando.rb, line 148
def self.perform(args)
  new.perform(args)
end

Public Instance Methods

parse(args) click to toggle source
# File lib/garlando.rb, line 163
def parse(args)
  options = Server::OPTIONS.dup

  opt = OptionParser.new
  opt.on('-o', '--host HOST')       { |v| options[:host] = v }
  opt.on('-p', '--port PORT')       { |v| options[:port] = v }
  opt.on('-P', '--pid FILE')        { |v| options[:pid]  = v }
  opt.on('-E', '--env ENVIRONMENT') { |v| options[:env]  = v }

  [opt.parse(args), options]
end
perform(args) click to toggle source
# File lib/garlando.rb, line 152
def perform(args)
  commands, options = parse(args)
  command = (commands.first || :restart).to_sym

  begin
    Server.new(options).call command
  rescue ArgumentError
    abort 'unsupported command'
  end
end