Class: Escalator::Command::Archive

Inherits:
Escalator::Command show all
Defined in:
lib/escalator/command/archive.rb

Defined Under Namespace

Classes: Help

Constant Summary

Constants inherited from Escalator::Command

DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Archive

Returns a new instance of Archive.



49
50
51
52
53
54
55
# File 'lib/escalator/command/archive.rb', line 49

def initialize argv
  @method = argv.arguments!.first
  @project_path = argv.option "project-path", ""
  @output_path = argv.option "output-path", ""
  @show_output = argv.flag? "show-output", false
  super
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



18
19
20
# File 'lib/escalator/command/archive.rb', line 18

def method
  @method
end

#output_pathObject (readonly)

Returns the value of attribute output_path.



22
23
24
# File 'lib/escalator/command/archive.rb', line 22

def output_path
  @output_path
end

#project_pathObject (readonly)

Returns the value of attribute project_path.



20
21
22
# File 'lib/escalator/command/archive.rb', line 20

def project_path
  @project_path
end

#show_outputObject (readonly) Also known as: show_output?

Returns the value of attribute show_output.



24
25
26
# File 'lib/escalator/command/archive.rb', line 24

def show_output
  @show_output
end

Class Method Details

.optionsObject



41
42
43
44
45
46
47
# File 'lib/escalator/command/archive.rb', line 41

def self.options
  [
    ["--project-path=path", "path 为 .xcproject 源路径"],
    ["--output-path=path",  "path 为 .ipa 以及部分重签资源的存放路径"],
    ["--show-output",       "文件管理中展示输出文件夹, 默认: 否"]
  ].concat super
end

Instance Method Details

#help!(error_message = nil) ⇒ Object



72
73
74
# File 'lib/escalator/command/archive.rb', line 72

def help!(error_message = nil)
  invoked_command_class.help!(error_message, Help)
end

#runObject



76
77
78
# File 'lib/escalator/command/archive.rb', line 76

def run
  Escalator::Archive.run self
end

#validate!Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/escalator/command/archive.rb', line 57

def validate!
  super
  if !method
    help! "未检测到 METHOD 参数"
  elsif !%w(app-store ad-hoc).include? method
    help! "METHOD 参数只能为 #{"app-store".ansi.green}, #{"ad-hoc".ansi.green}"
  end
  if project_path.empty?
    help! "未检测到 --project-path 参数"
  end
  if output_path.empty?
    help! "未检测到 --output-path 参数"
  end
end