fast_pack 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7b0a77c7befa512b6223027c2ccbd046577e7fe6ac97a39ce52e2d53faa84c6
4
- data.tar.gz: 80db60c6f161a6fc5e22eff3ea7037d95a7ebf054a0f3018ac7c2a89ea13e39d
3
+ metadata.gz: 3f61059915433f7cdd932e3916d3da1d9f01d259771699441d388b9e792b053f
4
+ data.tar.gz: 840006a4627926c91c42209d9c6ee0e6e9dbc5a01d8c308b907a03e63f86bf96
5
5
  SHA512:
6
- metadata.gz: c30508eebbabf4b55a207342731923179f78e38325e69419a165fed7a17ad7eaf234ff85e65b9648eb9d59d39ac913bd2d374c4d3de84f76a40e53785fa246a2
7
- data.tar.gz: 363eace92843091bd8611844128c665590755939c15f04ed9855e9c7bbc71e00b52375fd3a31b1f96ee77d447c22a93c39d701993318d2a955f7901dc78d53f3
6
+ metadata.gz: 3a4b61a93f913d6ee42ed7789396a41694de5587ae28c3672a40648e76a8aadbfa88c4477ee9d1044ee0aaee2c6f9fe1617015f3dd0beb9cbc0518b534ee7ae6
7
+ data.tar.gz: a51d1c6cb321ddae69c91e2d5c70c8f30103c4b121a5f1c513696a4e999e1f7636165b99bf7d914fa1a5ddbd52506484ec525f877b21a7419fc271eaa9e0f113
@@ -1,5 +1,7 @@
1
- url = "http://appsmanager.neoclub.cn/p/code/2c94808382abb5a801830d4825fd0243"
2
1
 
3
- dir = Dir.new(url)
2
+ a = 1
3
+ b = 2
4
4
 
5
- p dir.path
5
+ print(a + b)
6
+
7
+ sleep(1)
@@ -12,8 +12,8 @@ module Pod
12
12
  include Uki_config::Mixin
13
13
  include Shell_Command::Mixin
14
14
 
15
- self.summary = 'Uki 打包工具'
16
- self.description = '支持国内 海外打包'
15
+ self.summary = '砥翼 打包工具'
16
+ self.description = '一键打包就是爽'
17
17
 
18
18
  def self.options
19
19
  [
@@ -4,6 +4,7 @@ require 'net/https'
4
4
  require 'uri'
5
5
  require 'json'
6
6
  require 'socket'
7
+ require 'cli/ui'
7
8
 
8
9
 
9
10
  class Shell_Command
@@ -15,8 +16,10 @@ class Shell_Command
15
16
 
16
17
  log = %x{
17
18
  rootPath=`pwd`
18
- fireName="xcode_env.json"
19
- full_path="${rootPath}/${fireName}"
19
+ fileName="xcode_env.json"
20
+ work_path="${rootPath}/huxue"
21
+ full_path="${work_path}/${fileName}"
22
+ cd $work_path
20
23
  if [ -f "$full_path" ]
21
24
  then
22
25
  echo "存在xcode_env.json"
@@ -111,7 +114,7 @@ class Shell_Command
111
114
  echo -e "包体积=${sizeM}m\n"
112
115
  }
113
116
 
114
-
117
+
115
118
  if !File.exist?(uki_config.ipa_path)
116
119
  puts("*********************************************************导出失败")
117
120
  exit
@@ -126,38 +129,61 @@ class Shell_Command
126
129
  puts(log)
127
130
  end
128
131
 
129
- upload_ipa
132
+ getCOSToken
130
133
 
131
134
  end
132
135
 
133
- def upload_ipa
136
+ def ding_notifi(par)
137
+
138
+ uki_config.upload_time = Time.now.to_i - uki_config.s_time
134
139
 
135
- puts("********************************************************* 开始上传")
140
+ branch = %x{
141
+ if branch=$(git symbolic-ref --short -q HEAD)
142
+ then
143
+ echo $branch
144
+ else
145
+ echo "未知分支"
146
+ fi
147
+ }
148
+
149
+ hostname = Socket.gethostname
150
+ project_name = uki_config.group_name
151
+ project_env = uki_config.configuration
152
+ project_dsym = uki_config.dsym ? "已上传": "无符号表"
153
+ qrUrl = par["buildQRCodeURL"]
154
+
155
+ message = {
156
+ "msgtype": "actionCard",
157
+ "actionCard": {
158
+ "title": "打包成功",
159
+ "text": " ![](#{qrUrl}) # 沪学习iOS打包成功 \n\n #### 打包分支: #{branch} \n\n #### 打包环境: #{project_env} \n\n #### 打包机器: #{hostname} \n\n #### dsym: #{project_dsym} \n\n #### App版本: #{uki_config.app_version} \n\n #### build版本: #{uki_config.build_version} \n\n #### 包体积: #{uki_config.ipa_size} \n\n #### 编译耗时: #{uki_config.build_time}s \n\n #### 上传耗时: #{uki_config.upload_time}s",
160
+ "btnOrientation": "0",
161
+ "btns": [
162
+ {
163
+ "title": "去下载",
164
+ "actionURL": "#{uki_config.fir_url}"
165
+ }
166
+ ]
167
+ }
168
+ }
136
169
 
137
- # 开始上传时间
138
- s_time = Time.now.to_i
170
+ log = %x{
171
+ curl -X POST -H 'Content-Type: application/json' -d '#{message.to_json}' "https://oapi.dingtalk.com/robot/send?access_token=878146b6cef93f214feef79879fa4fb1d1c643a36cf314822aaea7eeac4298fe"
172
+ }
139
173
 
140
- myshort = if uki_config.scheme == "miaohong"
141
- "lZ2S" # 国内
142
- else
143
- "6WCf" # 海外
144
- end
174
+ if uki_config.verbose?
175
+ puts(log)
176
+ end
145
177
 
146
- log = %x{
147
- ipa_dir=#{uki_config.ipa_path}
148
- myshort=#{myshort}
149
- appsmanager_token="11797fc88f1a8f943a68ab90666f0452"
150
- result=$(curl -F "file=@${ipa_dir}" -F "token=$appsmanager_token" https://appsmanager.neoclub.cn/app/upload)
151
- echo $result
152
- }
178
+ local_notfi = %x{
179
+ notification="Did uploaded to fir caost time:#{uki_config.upload_time}s"
180
+ osascript -e 'display notification "size:'#{uki_config.ipa_size}'m\ncaost:'#{uki_config.upload_time}'s" with title "Uploaded Success" sound name "default" '
181
+ }
182
+
183
+ puts("********************************************************* 打包结束已通知钉钉请下载")
153
184
 
154
- data = JSON.parse(log)
155
- url = data["data"]
156
- url_code = url.split('code/').last.to_s
157
- uki_config.fir_url = "https://appsmanager.neoclub.cn/s/#{myshort}?id=#{url_code}"
158
- uki_config.upload_time = Time.now.to_i - s_time
185
+ exit
159
186
 
160
- send_notifi
161
187
  end
162
188
 
163
189
  def send_notifi
@@ -290,6 +316,97 @@ class Shell_Command
290
316
 
291
317
  end
292
318
 
319
+
320
+ def getCOSToken
321
+ # 开始上传时间
322
+ uki_config.s_time = Time.now.to_i
323
+ puts("********************************************************* 获取蒲公英上传地址")
324
+ #application/json
325
+ url = URI('https://www.pgyer.com/apiv2/app/getCOSToken')
326
+ http = Net::HTTP.new(url.host, url.port)
327
+ http.use_ssl = true
328
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
329
+ # 设置请求参数
330
+ data = URI.encode_www_form({'_api_key': uki_config.pgyer_apiKey, 'buildType':'ios', 'buildInstallType': 2, 'buildPassword': '1234'})
331
+ # 设置请求头
332
+ header = {'content-type':'application/x-www-form-urlencoded'}
333
+ response = http.post(url, data, header)
334
+ resbody = JSON.parse(response.body)
335
+
336
+ upload_ipa(resbody["data"])
337
+
338
+ end
339
+
340
+ def upload_ipa(par)
341
+ puts("********************************************************* 开始上传")
342
+ CLI::UI::StdoutRouter.enable
343
+ spinner = CLI::UI::Spinner::Async.start('')
344
+
345
+ # multipart/form-data
346
+ url = URI(par["endpoint"])
347
+ http = Net::HTTP.new(url.host, url.port)
348
+ http.use_ssl = true
349
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
350
+
351
+ file = File.open(uki_config.ipa_path, 'rb')
352
+
353
+ # 设置请求参数
354
+ data = par["params"]
355
+ data["file"] = file.read
356
+
357
+ request = Net::HTTP::Post.new(par["endpoint"])
358
+ request.set_form(data, 'multipart/form-data')
359
+ response = http.request(request)
360
+
361
+ file.close
362
+ spinner.stop()
363
+
364
+ if response.code.to_i == 204
365
+ puts("********************************************************* 上传成功正在获取包处理信息,请稍等...")
366
+ getBuildInfo(par["params"])
367
+ else
368
+ puts("*********************************************************上传失败 code = #{response.code} message = #{response.message}")
369
+ exit
370
+ end
371
+ end
372
+
373
+ def getBuildInfo(par)
374
+ puts("********************************************************* 别着急大兄弟 官方建议睡3秒,等待蒲公英构建发布")
375
+ sleep(3)
376
+ puts("********************************************************* 帅的人已醒来")
377
+
378
+ buildKey = par["key"]
379
+
380
+ url = URI('https://www.pgyer.com/apiv2/app/buildInfo')
381
+ # 设置请求参数
382
+ params = {"_api_key": uki_config.pgyer_apiKey, "buildKey": buildKey}
383
+ url.query = URI.encode_www_form(params)
384
+ http = Net::HTTP.new(url.host, url.port)
385
+ http.use_ssl = true
386
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
387
+ response = http.get(url, params)
388
+ resbody = JSON.parse(response.body)
389
+ code = resbody["code"]
390
+
391
+ if uki_config.verbose?
392
+ puts("打印#{resbody}")
393
+ end
394
+
395
+ if code.to_i == 1247 || code.to_i == 1246 # 正在解析中
396
+ getBuildInfo(par)
397
+ end
398
+
399
+ if code.to_i == 0
400
+ uki_config.fir_url = "https://www.pgyer.com/#{resbody["data"]["buildShortcutUrl"]}"
401
+ else
402
+ puts("*********************************************************上传失败 code = #{resbody["code"]} message = #{resbody["message"]}")
403
+ exit
404
+ end
405
+
406
+ ding_notifi(resbody["data"])
407
+
408
+ end
409
+
293
410
  def self.instance
294
411
  @instance ||= new
295
412
  end
@@ -1,10 +1,6 @@
1
1
 
2
2
  class Uki_config
3
3
 
4
- # scheme info
5
- PROJECT_SCHEME = ['UkiOverseas', 'miaohong'].freeze
6
-
7
-
8
4
  # 是否展示详细信息
9
5
  attr_accessor :verbose
10
6
  # 是否海外
@@ -21,6 +17,8 @@ class Uki_config
21
17
  attr_accessor :build_time
22
18
  # 上传耗时
23
19
  attr_accessor :upload_time
20
+ # 开始上传时间
21
+ attr_accessor :s_time
24
22
  # 上传Url
25
23
  attr_accessor :fir_url
26
24
  # xcode环境变量
@@ -62,11 +60,11 @@ class Uki_config
62
60
  end
63
61
 
64
62
  def dsym_path
65
- return File.join(@installation_root.to_s, "dsym")
63
+ return Pathname.new(huxue_target).join("dsym")
66
64
  end
67
65
 
68
66
  def ipa_path
69
- return File.join(build_exe_path, "#{scheme}.ipa")
67
+ return File.join(build_exe_path.to_s, "#{self.xcode_envs["target"]}.ipa")
70
68
  end
71
69
 
72
70
  def verbose(v)
@@ -85,15 +83,18 @@ class Uki_config
85
83
 
86
84
  def auto_work_space_name
87
85
  installation_root
88
-
89
86
  Dir.foreach(@installation_root) do |entry|
90
- if entry.end_with?('xcworkspace')
87
+ if entry.end_with?('ios.xcworkspace')
91
88
  @workspace_name = entry
92
89
  next
93
90
  end
94
91
  end
95
92
  end
96
93
 
94
+ def huxue_target
95
+ return File.join(@installation_root, "huxue")
96
+ end
97
+
97
98
  def app_version
98
99
  buildSettings = self.xcode_envs["buildSettings"]
99
100
  return buildSettings["MARKETING_VERSION"]
@@ -106,7 +107,7 @@ class Uki_config
106
107
 
107
108
  # 读取产物记录文件
108
109
  def app_file_path
109
- return File.join(@installation_root, "app_path")
110
+ return Pathname.new(huxue_target).join("app_path")
110
111
  end
111
112
 
112
113
  # 产物路径
@@ -115,21 +116,21 @@ class Uki_config
115
116
  end
116
117
 
117
118
  def group_name
118
- unless @workspace_name == "miaohong.xcworkspace"
119
- return "iOS海外极速打包已完成"
120
- end
121
-
122
- return "iOS国内极速打包已完成"
119
+ return "沪学习打包已完成"
123
120
  end
124
121
 
125
122
  def xcode_env_path
126
- return File.join(@installation_root, "xcode_env.json")
123
+ return Pathname.new(huxue_target).join("xcode_env.json")
127
124
  end
128
125
 
129
126
  def self.instance
130
127
  @instance ||= new
131
128
  end
132
129
 
130
+ def pgyer_apiKey
131
+ "12c406fb60a9b3f83f65b349ab48771e"
132
+ end
133
+
133
134
  class << self
134
135
  attr_writer :instance
135
136
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Packager
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_pack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - 耿磊
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-26 00:00:00.000000000 Z
11
+ date: 2023-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -24,36 +24,16 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: fir-cli
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.0'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 2.0.14
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - "~>"
42
- - !ruby/object:Gem::Version
43
- version: '2.0'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 2.0.14
47
- description: 支持国内海外一键快速出包
27
+ description: 支持一键快速出包
48
28
  email:
49
29
  - glworkfine@gmail.com
50
30
  executables:
51
- - uki
31
+ - dy
52
32
  extensions: []
53
33
  extra_rdoc_files: []
54
34
  files:
55
35
  - README.md
56
- - bin/uki
36
+ - bin/dy
57
37
  - lib/cocoapods-uki-packager/Test.rb
58
38
  - lib/cocoapods-uki-packager/command/pack.rb
59
39
  - lib/cocoapods-uki-packager/shell.rb
@@ -79,8 +59,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
59
  - !ruby/object:Gem::Version
80
60
  version: '0'
81
61
  requirements: []
82
- rubygems_version: 3.0.9
62
+ rubygems_version: 3.1.4
83
63
  signing_key:
84
64
  specification_version: 4
85
- summary: TT-Uki快速打包工具
65
+ summary: 砥翼快速打包工具
86
66
  test_files: []
/data/bin/{uki → dy} RENAMED
File without changes