Class: Appship::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.start(argv) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/appship/cli.rb', line 5

def self.start(argv)
  new.start(argv)
rescue Error => e
  warn "#{e.message}"
  exit 1
rescue OptionParser::ParseError => e
  warn "#{e.message}"
  exit 2
end

Instance Method Details

#start(argv) ⇒ Object



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
42
# File 'lib/appship/cli.rb', line 15

def start(argv)
  args = argv.dup
  global = extract_global_options!(args)
  command = args.shift

  case command
  when "init"
    init(args)
  when "doctor"
    doctor
  when "build"
    build(args, global)
  when "package"
    package(args, global)
  when "upload"
    upload(args, global)
  when "pgyer"
    pgyer(args, global)
  when "fir"
    fir(args, global)
  when "version", "--version", "-v"
    puts "appship #{VERSION}"
  when nil, "help", "--help", "-h"
    puts help
  else
    raise ConfigurationError, "未知命令: #{command}\n\n#{help}"
  end
end