ocean_package 0.15.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b15b8eb8f1ae6c0de3a7775dce9348e041ffe488527b0cd5712d8cca849c8167
4
- data.tar.gz: 6f84dacc6a354ce0fc3348d87b58c40d42bf2fdf29f260d83d7a28ea21006856
3
+ metadata.gz: 8fdeaa9f9c0ec67459f5383a4ee8b93ab9d4ba23c1ab6824deafb6016871a6df
4
+ data.tar.gz: ff1af0e34f1334cdb203093f11043699b5e118b2ea867e26df40a51e12c09c1c
5
5
  SHA512:
6
- metadata.gz: 42919ac94d8d2eaf38bb7392f6d3bef685d75cf8c6a9a344b174a707dd0aed93238c677235ada9ad2ee65ad26bb489bc8e25fad21e1f6fc058fafa00fb97d9fe
7
- data.tar.gz: fb4aa28a87cac101e7a42b858ff31d17549b3d2ac8afbccef06db7e8daa3bbdd2aa287dd3464616f914f922a9d333ccf4599e247041e09091324eb50bdeee395
6
+ metadata.gz: abb4364e4cea33d8768dfaf0ed616ea4a31280b1c2cf3f5e0b7d28d12068c5dbfde477835d6ad16588b5d7ecbe2f8a2d60704cd51c22bdc82670418810d30d96
7
+ data.tar.gz: 40a35d23d5f527c2983f9a6b91276044ff094cf20048317336c95deb1b52c5288ffea22e5f5a63b9da9f222a28036aab5b77d1b1399188daa0c994d32cc8e024
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ocean_package (0.14.0)
4
+ ocean_package (0.17.0)
5
5
  CFPropertyList
6
6
  dingbot
7
7
  faraday
@@ -2,6 +2,8 @@
2
2
  module OceanPackage
3
3
  class Command
4
4
  include OceanPackage::TimeFlow::Mixin
5
+ require 'net/http'
6
+ require 'uri'
5
7
 
6
8
  # xcodebuild 打包相关
7
9
  attr_accessor :package
@@ -26,6 +28,11 @@ module OceanPackage
26
28
  # 自定义的ipa文件路径
27
29
  attr_accessor :custom_ipa_file_path
28
30
 
31
+ # 整个流程时间记录上报url
32
+ attr_accessor :time_flow_url
33
+
34
+ # 整个流程时间记录上报url,额外的参数
35
+ attr_accessor :time_flow_extra_req
29
36
 
30
37
  def initialize(params = [])
31
38
  argv = CLAide::ARGV.new(params)
@@ -63,6 +70,14 @@ module OceanPackage
63
70
  open_finder = argv.flag?("open-finder", false )
64
71
  Log.info("open-finder: #{open_finder}")
65
72
 
73
+ time_flow_url = argv.option("time-flow-url", "")
74
+ Log.info("time_flow_url: #{time_flow_url}")
75
+ @time_flow_url = time_flow_url
76
+
77
+ time_flow_extra_req = argv.option("time-flow-extra-req", "")
78
+ Log.info("time_flow_extra_req: #{time_flow_extra_req}")
79
+ @time_flow_extra_req = time_flow_extra_req
80
+
66
81
  # 自定义ipa文件,使用该文件作为 archive path
67
82
  tmp_archive_path = has_custom_ipa_file ? File.dirname("#{ipa_file_path}") : archive_path
68
83
  Log.info("tmp_archive_path: #{tmp_archive_path}")
@@ -187,6 +202,17 @@ module OceanPackage
187
202
  seconds
188
203
  end
189
204
 
205
+ # 总共时间,单位 分
206
+ def compute_total_time_minute
207
+ time1 = package.start_time
208
+ time2 = Time.now
209
+ minutes = (time2 - time1) / 60
210
+
211
+ Log.info("total time: #{minutes} minute")
212
+
213
+ minutes
214
+ end
215
+
190
216
  # web hook 消息标题
191
217
  def make_web_hook_message_title
192
218
  "iOS 来新包啦~"
@@ -202,7 +228,7 @@ module OceanPackage
202
228
  content += "当前平台: iOS \n\n"
203
229
  content += "APP名称: " + ipa.display_name + "\n\n"
204
230
  content += "当前版本: " + ipa.version + "(#{ipa.build_version})" + "\n\n"
205
- content += "打包耗时: " + "#{compute_total_time}" + "s" + "\n\n"
231
+ content += "打包耗时: " + "#{compute_total_time_minute}" + " 分钟" + "\n\n"
206
232
  content += "发布环境: " + "#{package.configuration}" + "\n\n"
207
233
  content += "更新描述: " + final_change_log + "\n\n"
208
234
  content += "发布时间: " + Time.new.strftime("%Y年%m月%d日 %H时%M分%S秒") + "\n\n"
@@ -242,7 +268,6 @@ module OceanPackage
242
268
  time_flow_dir = @package.final_archive_path
243
269
  time_flow_file_path = "#{time_flow_dir}timeflow.json"
244
270
  params = time_flow.make_all_points
245
- params['timeFlowPath'] = time_flow_file_path
246
271
  json = JSON.dump(params)
247
272
 
248
273
  unless File.exist?(time_flow_file_path)
@@ -255,6 +280,38 @@ module OceanPackage
255
280
  else
256
281
  Log.error("write time flow to path(fail): #{time_flow_file_path}")
257
282
  end
283
+
284
+ upload_time_flow_data(params)
285
+ end
286
+
287
+ def upload_time_flow_data(data)
288
+ time_flow_url_value = "#{@time_flow_url}"
289
+ unless time_flow_url_value.empty?
290
+ Log.info("upload time flow data")
291
+
292
+ uri = URI(time_flow_url_value)
293
+ params = data
294
+
295
+ # 分割
296
+ extra_params = "#{@time_flow_extra_req}".split(",")
297
+ # 再拼接
298
+ extra_params.each do |p|
299
+ extra_key_values = "#{p}".split("=")
300
+ if extra_key_values.length == 2
301
+ extra_key = "#{extra_key_values[0]}"
302
+ extra_value = "#{extra_key_values[1]}"
303
+ if extra_key.length > 0 && extra_value.length > 0
304
+ params[extra_key] = extra_value
305
+ end
306
+ end
307
+ end
308
+
309
+ Log.info("url: #{uri}")
310
+ Log.info("body: #{params}")
311
+
312
+ res = Net::HTTP.post_form(uri, params)
313
+ Log.info("upload time flow data result: #{res.body}")
314
+ end
258
315
  end
259
316
 
260
317
  end
@@ -109,7 +109,7 @@ module OceanPackage
109
109
  "notifyGroupTime" => @notify_group_time,
110
110
  "endTime" => @end_time
111
111
  }
112
- json
112
+ params
113
113
  end
114
114
 
115
115
  module Mixin
@@ -1,3 +1,3 @@
1
1
  module OceanPackage
2
- VERSION = "0.15.0"
2
+ VERSION = "0.18.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean_package
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ocean