Class: Sandals::CLI

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

Defined Under Namespace

Classes: InitialAppError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments) ⇒ CLI

Returns a new instance of CLI.



22
23
24
# File 'lib/sandals/cli.rb', line 22

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

Class Method Details

.start(arguments) ⇒ Object



18
19
20
# File 'lib/sandals/cli.rb', line 18

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

Instance Method Details

#runObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/sandals/cli.rb', line 26

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