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