fir-cli 2.0.15 → 2.0.17

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: bf7e501f2e3614613573927fe7496965f3d7b781cfea058be78c915238f3d1a6
4
- data.tar.gz: 12ba9d688d85e42afde6758690291622568f142cd59beca2627c05573d2da78a
3
+ metadata.gz: 27a5c2fe69e1713db4099ac901228f33d23ac94ac92018fdf6b6ee6f71bc1061
4
+ data.tar.gz: d9280aa40366d505c9735c614bd7d0051446fbffd173c76e9338fcccea077e86
5
5
  SHA512:
6
- metadata.gz: 213caf94e89f0f0a420cfc1e13500ac889456b449a6ce231ab9f957f1b4c39d4df527c0b8a43c1e1356967cace003ad53078421c4370ede747b290a60c3b91e0
7
- data.tar.gz: e9be9b459dd90c536f6ef109b5ce353b435d094f655b864fe4d49a3461a9235e2a91ef643aefa2fc1b26d8f768eec3c0ad217f0d22c3cbaa0c25d9138ba08e2b
6
+ metadata.gz: 9a09911d9e1fd3dbfc62f41c37ad196b5f76864a101569e2b3184fe5ee57c0702fbae59bff20e22b1ac01a25f2d0a002d30ee2d91941f853521bda5572af310f
7
+ data.tar.gz: c5ecf24fa4c7bb4afdd82a256bf2a878788f3e96e0aac0058dea9c2dd10b04bd439aff1710ae760769a7a38d67bf901d196d445fb1bf3d9557f3d5146ed00de0
data/README.md CHANGED
@@ -15,8 +15,11 @@ fir.im-cli 可以通过指令查看, 上传, iOS/Android 应用.
15
15
  # 重大提醒
16
16
  - fir.im 更换域名至 betaqr.com 后, 需要升级至 `fir-cli` >= `2.0.4` 有部分用户反馈 2.0.2 无法直接使用 `gem update fir-cli` 升级到 2.0.4, 则可以尝试卸载后重新安装, 即 `gem uninstall fir-cli` 后 `gem install fir-cli`
17
17
 
18
+ - 现也有一个go 版本的 go-fir-cli 供大家使用, 无需安装依赖, 可以直接使用. 具体请访问 [https://github.com/PGYER/go-fir-cli](https://github.com/PGYER/go-fir-cli). 注意! 该版本功能并不与fir-cli 完全重合.
18
19
 
19
20
  # 最近更新
21
+ - (2.0.17) 增加了上传百分比显示
22
+ - (2.0.16) 更新了 thor
20
23
  - (2.0.15) 更换了 API 域名
21
24
  - (2.0.14) 第三方通知加入了 app 类型, 第三方报错将忽略异常继续运行
22
25
  - (2.0.13) 修正了企业微信通知的bug
data/fir-cli.gemspec CHANGED
@@ -27,6 +27,8 @@ Gem::Specification.new do |spec|
27
27
  /_/ /___/_/ |_| \____/_____/___/
28
28
 
29
29
  ## 更新记录
30
+ - (2.0.17) 增加了上传百分比显示
31
+ - (2.0.16) 更新了 thor
30
32
  - (2.0.15) 修改了API域名
31
33
  - (2.0.14) 第三方通知加入了 app 类型, 第三方报错将不再直接报出异常
32
34
  - (2.0.13) 修复了无法跳过企业微信通知逻辑的bug
@@ -36,18 +38,6 @@ Gem::Specification.new do |spec|
36
38
  - (2.0.9) publish 支持了 企业微信通知 可以使用 --wxwork_access_token 或 --wxwork_webhook, 增加了回调超时时间至20秒
37
39
  - (2.0.8) publish 支持 飞书通知, 可使用 `feishu_access_token` 和 `feishu_custom_message`, 详情见 `fir publish --help`
38
40
  - (2.0.7) 修复了提示 token 有问题的错误
39
- - (2.0.6) 将校验文件是否存在提前
40
- - (2.0.5) 更换了上传域名, 避免与 深信服的设备冲突
41
- - (2.0.4) 修复了 cdn 不支持 patch 方法透传, 导致在修改 app 信息的时候返回的 400 错误
42
- - (2.0.3) 增加 dingtalk_at_phones, 钉钉通知可 at 用户手机号, 以逗号,分割. 此命令需配合 `dingtalk_access_token` 使用
43
- - (2.0.3) 增加 dingtalk_at_all, 钉钉通知可 at 所有人, 此命令需配合 `dingtalk_access_token` 使用
44
- - (2.0.3) publish 增加海外加速参数 --oversea_turbo
45
- - (2.0.2) 有限支持 aab 文件上传, 强依赖`bundletool`工具, 具体请参见参数 `--bundletool_jar_path` 和 `auto_download_bundletool_jar`
46
- - (2.0.1) publish 支持 新参数 `specify_app_display_name`, 指定 app 显示名称
47
- - (2.0.1) publish 支持 新参数 `need_ansi_qrcode`, 在控制台直接打印二维码, jenkins 用户可能需要使用 `AnsiColor Plugin` 插件配合
48
- - (2.0.1) publish 支持 新参数 `dingtalk_custom_message`, 可以在钉钉通知里增加自定义消息, 此命令需配合 `dingtalk_access_token` 使用
49
- - (2.0.1) publish 支持 新参数 `skip_fir_cli_feedback`, 可禁止 fir-cli 发送统计信息
50
- - (2.0.0) publish 使用更快的存储商, 加速上传速度, 若感觉没以前可使用 switch_to_qiniu 恢复
51
41
  - [fir-cli](https://github.com/firhq/fir-cli) 已经开源
52
42
  - 欢迎 fork, issue 和 pull request
53
43
  )
@@ -59,7 +49,7 @@ Gem::Specification.new do |spec|
59
49
  spec.add_development_dependency 'pry', '~> 0.10'
60
50
 
61
51
  spec.add_dependency 'admqr_knife', '~> 0.1.5'
62
- spec.add_dependency 'thor', '~> 0.19'
52
+ spec.add_dependency 'thor', '~> 1.2.1'
63
53
  spec.add_dependency 'rest-client', '~> 2.0'
64
54
  spec.add_dependency 'ruby_android_apk', '~> 0.7.7.1'
65
55
  spec.add_dependency 'rqrcode', '~> 0.7'
@@ -0,0 +1,42 @@
1
+ require 'net/http'
2
+ require 'tempfile'
3
+ require 'securerandom'
4
+
5
+ class Net::HTTP::UploadProgress
6
+ attr_reader :upload_size
7
+
8
+ def initialize(req, &block)
9
+ @req = req
10
+ @callback = block
11
+ @upload_size = 0
12
+ if req.body_stream
13
+ @io = req.body_stream
14
+ req.body_stream = self
15
+ elsif req.instance_variable_get(:@body_data)
16
+ raise NotImplementedError if req.chunked?
17
+ raise NotImplementedError if /\Amultipart\/form-data\z/i !~ req.content_type
18
+ opt = req.instance_variable_get(:@form_option).dup
19
+ opt[:boundary] ||= SecureRandom.urlsafe_base64(40)
20
+ req.set_content_type(req.content_type, boundary: opt[:boundary])
21
+ file = Tempfile.new('multipart')
22
+ file.binmode
23
+ req.send(:encode_multipart_form_data, file, req.instance_variable_get(:@body_data), opt)
24
+ file.rewind
25
+ req.content_length = file.size
26
+ @io = file
27
+ req.body_stream = self
28
+ else
29
+ raise NotImplementedError
30
+ end
31
+ end
32
+
33
+ def readpartial(maxlen, outbuf)
34
+ begin
35
+ str = @io.readpartial(maxlen, outbuf)
36
+ ensure
37
+ @callback.call(self) unless @upload_size.zero?
38
+ end
39
+ @upload_size += str.length
40
+ str
41
+ end
42
+ end
data/lib/fir/patches.rb CHANGED
@@ -8,3 +8,4 @@ require_relative './patches/native_patch'
8
8
  require_relative './patches/os_patch'
9
9
  require_relative './patches/try'
10
10
  require_relative './patches/default_headers'
11
+ require_relative './patches/progress'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative './app_uploader'
4
- # require 'byebug'
4
+
5
5
 
6
6
  module FIR
7
7
  class AliUploader < AppUploader
@@ -16,7 +16,7 @@ module FIR
16
16
  icon_info = uploading_icon_info
17
17
 
18
18
  logger.debug "icon_url = #{icon_url}, icon_info = #{icon_info}"
19
- put_file(icon_url, uploading_icon_info, uploading_info[:cert][:icon][:custom_headers])
19
+ put_file(icon_url, uploading_icon_info, uploading_info[:cert][:icon][:custom_headers], false)
20
20
  callback_to_api(callback_url, callback_icon_information)
21
21
  end
22
22
  rescue StandardError => e
@@ -50,14 +50,43 @@ module FIR
50
50
 
51
51
  protected
52
52
 
53
- def put_file(url, file, headers)
54
- RestClient::Request.execute(
55
- method: 'PUT',
56
- url: url,
57
- payload: file,
58
- headers: headers,
59
- timeout: 300
60
- )
53
+ def put_file(url, file, headers, need_progress = true)
54
+
55
+ uri = URI(url)
56
+ hostname = uri.hostname
57
+
58
+
59
+ File.open(file_path, 'rb') do |io|
60
+ t = Time.now
61
+ http = Net::HTTP.new(hostname, 443)
62
+ http.use_ssl = true
63
+ req = Net::HTTP::Put.new(uri.request_uri, headers)
64
+ req.content_length = io.size
65
+ req.body_stream = io
66
+ Net::HTTP::UploadProgress.new(req) do |progress|
67
+ if need_progress
68
+ if progress.upload_size == io.size
69
+ puts "upload finished"
70
+ else
71
+ if Time.now - t > 0.5
72
+ puts "progress: #{ ((progress.upload_size / io.size.to_f) * 100).round(2) }%"
73
+ t = Time.now
74
+ end
75
+ end
76
+ end
77
+ end
78
+ res = http.request(req)
79
+ end
80
+
81
+
82
+
83
+ # RestClient::Request.execute(
84
+ # method: 'PUT',
85
+ # url: url,
86
+ # payload: file,
87
+ # headers: headers,
88
+ # timeout: 300
89
+ # )
61
90
  end
62
91
 
63
92
  def callback_url
data/lib/fir/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module FIR
4
- VERSION = "2.0.15"
4
+ VERSION = "2.0.17"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fir-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.15
4
+ version: 2.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - NaixSpirit
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-08-30 00:00:00.000000000 Z
12
+ date: 2023-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '0.19'
90
+ version: 1.2.1
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '0.19'
97
+ version: 1.2.1
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rest-client
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -224,6 +224,7 @@ files:
224
224
  - lib/fir/patches/instance_variables.rb
225
225
  - lib/fir/patches/native_patch.rb
226
226
  - lib/fir/patches/os_patch.rb
227
+ - lib/fir/patches/progress.rb
227
228
  - lib/fir/patches/try.rb
228
229
  - lib/fir/util.rb
229
230
  - lib/fir/util/ali_uploader.rb
@@ -271,24 +272,14 @@ metadata: {}
271
272
  post_install_message: "\n ______________ ________ ____\n /
272
273
  ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
273
274
  /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
274
- \ ## 更新记录\n - (2.0.15) 修改了API域名\n - (2.0.14) 第三方通知加入了 app 类型, 第三方报错将不再直接报出异常\n
275
- \ - (2.0.13) 修复了无法跳过企业微信通知逻辑的bug\n - (2.0.12) 修复因为钉钉机器人不再支持base64导致无法显示二维码,另外开始支持钉钉加签方式的鉴权,
276
- 参数为 --dingtalk_secret\n - (2.0.11) 兼容了 ruby 3.0 版本, 增加了环境变量FEISHU_TIMEOUT,可以多给飞书一些超时时间\n
277
- \ - (2.0.10) 飞书支持了 V2 版本的机器人推送\n - (2.0.9) publish 支持了 企业微信通知 可以使用 --wxwork_access_token
278
- --wxwork_webhook, 增加了回调超时时间至20秒\n - (2.0.8) publish 支持 飞书通知, 可使用 `feishu_access_token`
279
- 和 `feishu_custom_message`, 详情见 `fir publish --help`\n - (2.0.7) 修复了提示 token 有问题的错误\n
280
- \ - (2.0.6) 将校验文件是否存在提前\n - (2.0.5) 更换了上传域名, 避免与 深信服的设备冲突\n - (2.0.4) 修复了 cdn
281
- 不支持 patch 方法透传, 导致在修改 app 信息的时候返回的 400 错误\n - (2.0.3) 增加 dingtalk_at_phones, 钉钉通知可
282
- at 用户手机号, 以逗号,分割. 此命令需配合 `dingtalk_access_token` 使用\n - (2.0.3) 增加 dingtalk_at_all,
283
- 钉钉通知可 at 所有人, 此命令需配合 `dingtalk_access_token` 使用\n - (2.0.3) publish 增加海外加速参数 --oversea_turbo\n
284
- \ - (2.0.2) 有限支持 aab 文件上传, 强依赖`bundletool`工具, 具体请参见参数 `--bundletool_jar_path` 和
285
- `auto_download_bundletool_jar`\n - (2.0.1) publish 支持 新参数 `specify_app_display_name`,
286
- 指定 app 显示名称\n - (2.0.1) publish 支持 新参数 `need_ansi_qrcode`, 在控制台直接打印二维码, jenkins
287
- 用户可能需要使用 `AnsiColor Plugin` 插件配合\n - (2.0.1) publish 支持 新参数 `dingtalk_custom_message`,
288
- 可以在钉钉通知里增加自定义消息, 此命令需配合 `dingtalk_access_token` 使用\n - (2.0.1) publish 支持 新参数 `skip_fir_cli_feedback`,
289
- 可禁止 fir-cli 发送统计信息\n - (2.0.0) publish 使用更快的存储商, 加速上传速度, 若感觉没以前可使用 switch_to_qiniu
290
- 恢复\n - [fir-cli](https://github.com/firhq/fir-cli) 已经开源\n - 欢迎 fork, issue 和 pull
291
- request\n "
275
+ \ ## 更新记录\n - (2.0.17) 增加了上传百分比显示\n - (2.0.16) 更新了 thor\n - (2.0.15) 修改了API域名\n
276
+ \ - (2.0.14) 第三方通知加入了 app 类型, 第三方报错将不再直接报出异常\n - (2.0.13) 修复了无法跳过企业微信通知逻辑的bug\n
277
+ \ - (2.0.12) 修复因为钉钉机器人不再支持base64导致无法显示二维码,另外开始支持钉钉加签方式的鉴权, 参数为 --dingtalk_secret\n
278
+ \ - (2.0.11) 兼容了 ruby 3.0 版本, 增加了环境变量FEISHU_TIMEOUT,可以多给飞书一些超时时间\n - (2.0.10) 飞书支持了
279
+ V2 版本的机器人推送\n - (2.0.9) publish 支持了 企业微信通知 可以使用 --wxwork_access_token 或 --wxwork_webhook,
280
+ 增加了回调超时时间至20秒\n - (2.0.8) publish 支持 飞书通知, 可使用 `feishu_access_token` 和 `feishu_custom_message`,
281
+ 详情见 `fir publish --help`\n - (2.0.7) 修复了提示 token 有问题的错误\n - [fir-cli](https://github.com/firhq/fir-cli)
282
+ 已经开源\n - 欢迎 fork, issue pull request\n "
292
283
  rdoc_options: []
293
284
  require_paths:
294
285
  - lib
@@ -303,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
294
  - !ruby/object:Gem::Version
304
295
  version: '0'
305
296
  requirements: []
306
- rubygems_version: 3.1.6
297
+ rubygems_version: 3.2.15
307
298
  signing_key:
308
299
  specification_version: 4
309
300
  summary: fir.im command tool