Class: Cerberus::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/cerberus/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLI

Returns a new instance of CLI.



7
8
9
10
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
# File 'lib/cerberus/cli.rb', line 7

def initialize(*args)
  say HELP if args.empty?

  command = args.shift

  cli_options = extract_options(args)

  case command
  when 'add'
    path = args.shift || Dir.pwd
    command = Cerberus::AddCommand.new(path, cli_options)
    command.run
  when 'remove'
    command = Cerberus::RemoveCommand.new(args.shift, cli_options)
    command.run
  when 'build'
    say HELP if args.empty?

    application_name  = args.shift

    command = Cerberus::BuildCommand.new(application_name, cli_options)
    command.run
  when 'buildall'
    command = Cerberus::BuildAllCommand.new(cli_options)
    command.run
  when 'list'
    command = Cerberus::ListCommand.new(cli_options)
    command.run
  when 'status'
    command = Cerberus::StatusCommand.new(cli_options)
    command.run
  else 
    say HELP
  end
end