Class: Escalator::Command::Upload

Inherits:
Escalator::Command show all
Defined in:
lib/escalator/command/upload.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) ⇒ Upload

Returns a new instance of Upload.



55
56
57
58
59
60
61
62
# File 'lib/escalator/command/upload.rb', line 55

def initialize argv
  @ipaPaths = argv.arguments!.select { |arg| !arg.empty? }
  @key_id = argv.option "key-id", ""
  @issuer_id = argv.option "issuer-id", ""
  @keyfile_path = argv.option "keyfile-path", ""
  @bundle_identifier = argv.option "bundle-identifier", ""
  super
end

Instance Attribute Details

#bundle_identifierObject (readonly)

Returns the value of attribute bundle_identifier.



26
27
28
# File 'lib/escalator/command/upload.rb', line 26

def bundle_identifier
  @bundle_identifier
end

#ipaPathsObject (readonly)

Returns the value of attribute ipaPaths.



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

def ipaPaths
  @ipaPaths
end

#issuer_idObject (readonly)

Returns the value of attribute issuer_id.



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

def issuer_id
  @issuer_id
end

#key_idObject (readonly)

Returns the value of attribute key_id.



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

def key_id
  @key_id
end

#keyfile_pathObject (readonly)

Returns the value of attribute keyfile_path.



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

def keyfile_path
  @keyfile_path
end

Class Method Details

.optionsObject



46
47
48
49
50
51
52
53
# File 'lib/escalator/command/upload.rb', line 46

def self.options
  [
    ["--key-id=id", "id 为 Appstore Connect 用户访问密钥的 keyId"],
    ["--issuer-id=id", "id 为 Appstore Connect 用户访问密钥的 issuerId"],
    ["--keyfile-path=path", "path 为 Appstore Connect 用户访问密钥的 .p8 文件保存路径"],
    ["--bundle-identifier=identifier", "identifier 为上传账户下对应唯一标识符"]
  ].concat super
end

Instance Method Details

#help!(error_message = nil) ⇒ Object



83
84
85
# File 'lib/escalator/command/upload.rb', line 83

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

#runObject



87
88
89
# File 'lib/escalator/command/upload.rb', line 87

def run
  Escalator::Upload.run self
end

#validate!Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/escalator/command/upload.rb', line 64

def validate!
  super
  if ipaPaths.empty?
    help! "未检测到 IPAPATH 参数"
  end
  if key_id.empty?
    help! "未检测到 --key-id 参数"
  end
  if issuer_id.empty?
    help! "未检测到 --issuer-id 参数"
  end
  if keyfile_path.empty?
    help! "未检测到 --keyfile-path 参数"
  end
  if bundle_identifier.empty?
    help! "未检测到 --bundle-identifier 参数"
  end
end