Class: Sandals::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments) ⇒ CLI

Returns a new instance of CLI.



12
13
14
# File 'lib/sandals/cli.rb', line 12

def initialize(arguments)
  @arguments = arguments.dup
end

Class Method Details

.start(arguments) ⇒ Object



8
9
10
# File 'lib/sandals/cli.rb', line 8

def self.start(arguments)
  new(arguments).run
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sandals/cli.rb', line 16

def run
  command = @arguments.shift
  case command
  when "run" then run_app
  when "new" then new_app
  else usage
  end
rescue Interrupt
  0
rescue StandardError => error
  warn "sandals: #{error.message}"
  1
end