Module: LumiaServer::CLI

Extended by:
CLI
Included in:
CLI
Defined in:
lib/lumia-server/cli.rb,
lib/lumia-server/command/exec.rb,
lib/lumia-server/command/build.rb,
lib/lumia-server/command/clean.rb,
lib/lumia-server/command/start.rb,
lib/lumia-server/command/command.rb

Defined Under Namespace

Classes: Build, Clean, Command, Exec, Start

Instance Method Summary collapse

Instance Method Details

#command(arg) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/lumia-server/cli.rb', line 20

def command(arg)
  name = arg.to_s.downcase
  unless (name = constants.detect { |c| c.to_s.downcase == name })
    puts "Unknown command provided: #{arg}"
    exit 1
  end
  const_get(name)
end

#error(message) ⇒ Object



29
30
31
32
# File 'lib/lumia-server/cli.rb', line 29

def error(message)
  puts "Error: #{message}"
  exit 1
end

#run(args) ⇒ Object



14
15
16
17
18
# File 'lib/lumia-server/cli.rb', line 14

def run(args)
  options = {}
  command = command(args.shift).new(args, options)
  command.run
end