105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
# File 'lib/pindo/command/jps/upload.rb', line 105
def run
current_project_dir = Dir.pwd
build_helper = Pindo::BuildHelper.share_instance
Dir.chdir(current_project_dir)
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(current_project_dir)
if is_need_add_tag
Pindo::Command::Dev::Tag::run(tag_action_parms)
end
if @args_ipa_file.nil? || !File.exist?(@args_ipa_file)
project_type = build_helper.project_type(current_project_dir)
case project_type
when :ios
build_path = File.join(current_project_dir, "build", "*.{ipa,app}")
@args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
when :android
build_path = File.join(current_project_dir, "build", "*.{apk}")
@args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
when :unity
if File.exist?(File.join(current_project_dir, "GoodPlatform/BaseiOS"))
build_path = File.join(current_project_dir, "GoodPlatform/BaseiOS/build", "*.{ipa,app}")
@args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
else
build_path = File.join(current_project_dir, "GoodPlatform/iOS/build", "*.{ipa,app}")
@args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
end
else
raise Informative, "当前目录不是工程目录,不能编译"
end
if @args_ipa_file.nil?
build_path = File.join(current_project_dir, "*.{ipa,app,apk}")
@args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
end
if !@args_ipa_file.nil?
answer = agree("需要上传的文件是: #{@args_ipa_file} ?(Y/n)")
if !answer
@args_ipa_file = nil
end
end
if !@args_ipa_file.nil? && File.exist?(@args_ipa_file)
else
@args_ipa_file = ask('需要上传的文件:') || nil
@args_ipa_file = @args_ipa_file.strip.gsub(/\\ /, ' ')
end
end
if !File.exist?(@args_ipa_file)
raise Informative, "#{@args_ipa_file} 文件不存在"
end
PgyerHelper.share_instace.setForeLogin(beforeLogin:@args_login_flag)
app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:@args_proj_name)
if app_info_obj.nil?
raise Informative, "#{@args_proj_name} 错误, 请输入正确的App代号名称, jps网站没有该App"
end
result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:@args_ipa_file, description:@args_upload_desc)
if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
PgyerHelper.share_instace.print_app_version_info(
app_info_obj: app_info_obj,
app_version_info_obj: result_data["data"]
)
if @args_resign_flag
args = []
if @args_send_flag
args << "--send"
end
if !@args_cert_id.nil? && !@args_cert_id.empty?
args << "--certid=#{@args_cert_id}"
end
if !@args_proj_name.nil? && !@args_proj_name.empty?
args << "--proj=#{@args_proj_name}"
end
Pindo::Command::Jps::Resign::run(args)
else
PgyerHelper.share_instace.send_apptest_msg(
app_info_obj: app_info_obj,
app_version_info_obj: result_data["data"],
receiveType: "self"
)
if @args_send_flag
PgyerHelper.share_instace.send_apptest_msg(
app_info_obj: app_info_obj,
app_version_info_obj: result_data["data"],
chatEnv: "DevTest",
receiveType: "chat"
)
end
end
end
end
|