fir-cli 2.0.0 → 2.0.1

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: d6523d1d4b8ddda66152739a53aa64aa8a0a83f83fa632e8046b0e00d1fc127e
4
- data.tar.gz: a9b8bd3eca63dfeef6648c8b81dd6a3f9ef6c708a90d3a09b34e15fcd9e608ce
3
+ metadata.gz: a24ad298a981ef005c28065354236351301c0de4c47beb7109fa1b03d0f04aa9
4
+ data.tar.gz: 8dd1f7047b2ba6c7cd89be9044b1498f732458bec23214e6df2c8838a11db2fc
5
5
  SHA512:
6
- metadata.gz: 27c08bcc4b241027ada0f539da89edfed8f61662e8449e23772d756845ad93156341725b49acf97c9647c757ba716be32e756b67290d4a5b64b55fbac385523d
7
- data.tar.gz: 7fc8675d828d9c9a8a6f3db0310ccf93c355b509c6a301d36e335b84c863f2ad369a9f7629ad530f31c7eae136fdef1f52084dd8656e834f3e0cf0d346efab71
6
+ metadata.gz: 943daed46cbd32bd3df0b26ae9e756efea7ac0fa2577d78e49cb5e21618484bc4e1e49e9c0ced2a2479f8a27d43743305faf1f8650e72e3c8fad5d62c1e7b617
7
+ data.tar.gz: c33fec27c39712aba5ef7ae4576438721ade9cd546cec91628de60728325889721fe144387e4f1743c282291a603f69913beee289500d105cc2bb3a652a566c4
data/README.md CHANGED
@@ -14,7 +14,11 @@ fir.im-cli 可以通过指令查看, 上传, iOS/Android 应用.
14
14
 
15
15
 
16
16
  # 最近更新
17
- - (2.0.0.beta2 beta 版本, `gem install fir-cli -v 2.0.0.beta2` 进行安装) publish 使用更快的存储商, 加速上传速度, 若感觉没以前可使用 switch_to_qiniu 恢复
17
+ - (2.0.1) publish 支持 新参数 `specify_app_display_name`, 指定 app 显示名称
18
+ - (2.0.1) publish 支持 新参数 `need_ansi_qrcode`, 在控制台直接打印二维码, jenkins 用户可能需要使用 `AnsiColor Plugin` 插件配合
19
+ - (2.0.1) publish 支持 新参数 `dingtalk_custom_message`, 可以在钉钉通知里增加自定义消息, 此命令需配合 `dingtalk_access_token` 使用
20
+ - (2.0.1) publish 支持 新参数 `skip_fir_cli_feedback`, 可禁止 fir-cli 发送统计信息
21
+ - publish 使用更快的存储商, 加速上传速度, 若感觉没以前可使用 参数 `switch_to_qiniu` 恢复
18
22
  - 支持了在fastlane 直接调用, 具体请参见 [https://github.com/FIRHQ/fastlane-plugin-fir_cli](https://github.com/FIRHQ/fastlane-plugin-fir_cli)
19
23
  - publish 支持 新参数 force_pin_history, 可以 将上传的版本, 固定在下载页面上(当大于最大固定版本数后, 会挤掉最老的固定版本) [2019年11月18日]
20
24
  - publish 支持 新参数 specify_icon_file_path, 可以直接指定 app 的 icon 图标文件 [2019年11月18日]
@@ -27,6 +27,10 @@ Gem::Specification.new do |spec|
27
27
  /_/ /___/_/ |_| \____/_____/___/
28
28
 
29
29
  ## 更新记录
30
+ - (2.0.1) publish 支持 新参数 `specify_app_display_name`, 指定 app 显示名称
31
+ - (2.0.1) publish 支持 新参数 `need_ansi_qrcode`, 在控制台直接打印二维码, jenkins 用户可能需要使用 `AnsiColor Plugin` 插件配合
32
+ - (2.0.1) publish 支持 新参数 `dingtalk_custom_message`, 可以在钉钉通知里增加自定义消息, 此命令需配合 `dingtalk_access_token` 使用
33
+ - (2.0.1) publish 支持 新参数 `skip_fir_cli_feedback`, 可禁止 fir-cli 发送统计信息
30
34
  - (2.0.0) publish 使用更快的存储商, 加速上传速度, 若感觉没以前可使用 switch_to_qiniu 恢复
31
35
  - (1.7.4) 配合 fastlane-plugin-fir_cli 做了一些小优化
32
36
  - (1.7.3) 新增了 上传指定图标, 不上传图标 以及 将版本固定显示在下载页上
@@ -42,10 +46,11 @@ Gem::Specification.new do |spec|
42
46
 
43
47
  spec.add_development_dependency 'bundler'
44
48
  spec.add_development_dependency 'rake'
45
- # spec.add_development_dependency 'byebug'
49
+ spec.add_development_dependency 'byebug'
46
50
  spec.add_development_dependency 'minitest', '~> 5.7'
47
51
  spec.add_development_dependency 'pry', '~> 0.10'
48
52
 
53
+ spec.add_dependency 'admqr_knife', '~> 0.1.2'
49
54
  spec.add_dependency 'thor', '~> 0.19'
50
55
  spec.add_dependency 'rest-client', '~> 2.0'
51
56
  spec.add_dependency 'ruby_android_apk', '~> 0.7.7.1'
data/lib/fir.rb CHANGED
@@ -4,6 +4,7 @@ require 'thor'
4
4
  require 'logger'
5
5
  require 'yaml'
6
6
  require 'rest-client'
7
+ require 'admqr_knife'
7
8
  require 'json'
8
9
  require 'securerandom'
9
10
  require 'fileutils'
@@ -23,6 +24,7 @@ require 'fir/util'
23
24
  require 'fir/version'
24
25
  require 'fir/cli'
25
26
 
27
+ AdmqrKnife.init('fir-cli')
26
28
  module FIR
27
29
  include Util
28
30
  end
@@ -107,16 +107,22 @@ module FIR
107
107
  method_option :short, type: :string, aliases: '-s', desc: 'Set custom short link'
108
108
  method_option :changelog, type: :string, aliases: '-c', desc: 'Set changelog'
109
109
  method_option :qrcode, type: :boolean, aliases: '-Q', desc: 'Generate qrcode'
110
+ method_option :need_ansi_qrcode, type: :boolean, default: false, desc: 'Generate qrcode'
110
111
  method_option :need_release_id, type: :boolean, aliases: '-R', default: false, desc: 'Add release id with fir url (WARNING: FIR ONLY SAVED 30 releases recently per app'
111
112
 
112
113
  method_option :force_pin_history, type: :boolean, aliases: '-H', default: false, desc: 'pin this release to the download page by force'
113
114
  method_option :skip_update_icon, type: :boolean, aliases: '-S', default: false, desc: 'skip update app icon'
114
115
  method_option :specify_icon_file, type: :string, desc: 'specify icon file'
115
116
 
117
+ method_option :skip_fir_cli_feedback, type: :boolean, default: false, desc: 'skip fir-cli usage info feedback'
118
+
119
+ method_option :specify_app_display_name, type: :string, desc: 'specify app display name'
120
+
116
121
  method_option :switch_to_qiniu, type: :boolean, default: false, aliases: '-N', desc: 'if app upload slowly, u can switch this option'
117
122
 
118
123
  method_option :mappingfile, type: :string, aliases: '-m', desc: 'App mapping file'
119
124
  method_option :dingtalk_access_token, type: :string, aliases: '-D', desc: 'Send msg to dingtalk, only need access_token, not whole url'
125
+ method_option :dingtalk_custom_message, type: :string, desc: 'add custom message to dingtalk'
120
126
 
121
127
  method_option :open, type: :boolean, desc: 'true/false if open for everyone'
122
128
  method_option :password, type: :string, desc: 'Set password for app'
@@ -89,7 +89,7 @@ module FIR
89
89
  build: app_info[:build],
90
90
  fname: File.basename(file_path),
91
91
  key: binary_cert[:key],
92
- name: app_info[:display_name] || app_info[:name],
92
+ name: options[:specify_app_display_name] || app_info[:display_name] || app_info[:name],
93
93
  origin: 'fir-cli',
94
94
  parent_id: app_id,
95
95
  release_tag: 'develop',
@@ -1,4 +1,5 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
+ # require 'byebug'
2
3
 
3
4
  module FIR
4
5
  module Login
@@ -7,10 +8,18 @@ module FIR
7
8
 
8
9
  user_info = fetch_user_info(token)
9
10
 
10
- logger.info "Login succeed, previous user's email: #{config[:email]}" unless config.blank?
11
+ unless config.blank?
12
+ logger.info "Login succeed, previous user's email: #{config[:email]}"
13
+ end
11
14
  write_config(email: user_info.fetch(:email, ''), token: token)
12
15
  reload_config
13
16
  logger.info "Login succeed, current user's email: #{config[:email]}"
17
+
18
+ AdmqrKnife.visit(
19
+ unique_code: 'fir_cli_login',
20
+ tag: 'fir_cli',
21
+ referer: "https://#{FIR::VERSION}.fir-cli/#{config[:email]}"
22
+ )
14
23
  logger_info_blank_line
15
24
  end
16
25
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  # require 'byebug'
4
4
  require_relative './qiniu_uploader'
5
-
6
5
  require_relative './ali_uploader'
7
6
 
8
7
  module FIR
@@ -29,6 +28,8 @@ module FIR
29
28
  dingtalk_notifier(download_url, qrcode_path)
30
29
  upload_mapping_file_with_publish
31
30
 
31
+ upload_fir_cli_usage_info(received_app_info)
32
+
32
33
  logger_info_blank_line
33
34
 
34
35
  {
@@ -59,12 +60,17 @@ module FIR
59
60
  end
60
61
 
61
62
  def upload_app
62
-
63
- app_uploaded_callback_data = if @options[:switch_to_qiniu]
64
- QiniuUploader.new(@app_info, @user_info, @uploading_info, @options).upload
65
- else
66
- AliUploader.new(@app_info, @user_info, @uploading_info, @options).upload
67
- end
63
+ time1 = Time.now.to_i
64
+ app_uploaded_callback_data = if @options[:switch_to_qiniu]
65
+ QiniuUploader.new(@app_info, @user_info, @uploading_info, @options).upload
66
+ else
67
+ AliUploader.new(@app_info, @user_info, @uploading_info, @options).upload
68
+ end
69
+
70
+ during_seconds = Time.now.to_i - time1
71
+ speed = File.size(@app_info[:file_path]) / during_seconds / 1024
72
+
73
+ logger.info "File uploaded. During: #{during_seconds} seconds, Upload Speed: #{speed} KB/s "
68
74
 
69
75
  release_id = app_uploaded_callback_data[:release_id]
70
76
 
@@ -82,6 +88,16 @@ module FIR
82
88
  app_info_dict
83
89
  end
84
90
 
91
+ def upload_fir_cli_usage_info(received_app_info)
92
+ return if @options[:skip_fir_cli_feedback]
93
+ short = received_app_info[:short]
94
+ AdmqrKnife.visit(
95
+ unique_code: 'fir_cli_publish',
96
+ tag: 'fir_cli',
97
+ referer: "https://#{FIR::VERSION}.fir-cli/#{short}"
98
+ )
99
+ end
100
+
85
101
  def upload_device_info
86
102
  return if @app_info[:devices].blank?
87
103
 
@@ -121,8 +137,6 @@ module FIR
121
137
  }
122
138
  end
123
139
 
124
-
125
-
126
140
  def upload_mapping_file_with_publish
127
141
  return if !options[:mappingfile] || !options[:proj]
128
142
 
@@ -137,6 +151,15 @@ module FIR
137
151
  def build_qrcode(download_url)
138
152
  qrcode_path = "#{File.dirname(@file_path)}/fir-#{@app_info[:name]}.png"
139
153
  FIR.generate_rqrcode(download_url, qrcode_path)
154
+
155
+
156
+ # NOTE: showing with default options specified explicitly
157
+ puts RQRCode::QRCode.new(download_url).as_ansi(
158
+ light: "\033[47m", dark: "\033[40m",
159
+ fill_character: ' ',
160
+ quiet_zone_size: 1
161
+ ) if @options[:need_ansi_qrcode]
162
+
140
163
  # 为何在这里必须生成 QrCode ? 因为要在 dingtalk 调用
141
164
  logger.info "Local qrcode file: #{qrcode_path}" if @export_qrcode
142
165
  qrcode_path
@@ -165,7 +188,7 @@ module FIR
165
188
  "msgtype": 'markdown',
166
189
  "markdown": {
167
190
  "title": "#{title} uploaded",
168
- "text": "#{title} uploaded at #{Time.now}\nurl: #{download_url}\n ![app二维码](data:image/png;base64,#{Base64.strict_encode64(File.read(open(qrcode_path)))})"
191
+ "text": "#{title} uploaded at #{Time.now}\nurl: #{download_url}\n#{options[:dingtalk_custom_message]}\n![app二维码](data:image/png;base64,#{Base64.strict_encode64(File.read(open(qrcode_path)))})"
169
192
  }
170
193
  }
171
194
  url = "https://oapi.dingtalk.com/robot/send?access_token=#{options[:dingtalk_access_token]}"
@@ -195,7 +218,9 @@ module FIR
195
218
 
196
219
  @skip_update_icon = options[:skip_update_icon]
197
220
  @force_pin_history = options[:force_pin_history]
198
- @specify_icon_file_path = File.absolute_path(options[:specify_icon_file]) unless options[:specify_icon_file].blank?
221
+ unless options[:specify_icon_file].blank?
222
+ @specify_icon_file_path = File.absolute_path(options[:specify_icon_file])
223
+ end
199
224
  end
200
225
 
201
226
  def read_changelog(changelog)
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module FIR
4
- VERSION = '2.0.0'
4
+ VERSION = '2.0.1'
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.0
4
+ version: 2.0.1
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: 2019-12-03 00:00:00.000000000 Z
12
+ date: 2019-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: byebug
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: minitest
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -67,6 +81,20 @@ dependencies:
67
81
  - - "~>"
68
82
  - !ruby/object:Gem::Version
69
83
  version: '0.10'
84
+ - !ruby/object:Gem::Dependency
85
+ name: admqr_knife
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: 0.1.2
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 0.1.2
70
98
  - !ruby/object:Gem::Dependency
71
99
  name: thor
72
100
  requirement: !ruby/object:Gem::Requirement
@@ -239,9 +267,13 @@ metadata: {}
239
267
  post_install_message: "\n ______________ ________ ____\n /
240
268
  ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
241
269
  /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
242
- \ ## 更新记录\n - (2.0.0) publish 使用更快的存储商, 加速上传速度, 若感觉没以前可使用 switch_to_qiniu 恢复\n
243
- \ - (1.7.4) 配合 fastlane-plugin-fir_cli 做了一些小优化\n - (1.7.3) 新增了 上传指定图标, 不上传图标 以及
244
- 将版本固定显示在下载页上\n - (1.7.2) 修正了无论是否加参数都固定出现二维码图片的bug\n - (1.7.1) 增加了 钉钉推送 , 增加了返回指定版本下载地址\n
270
+ \ ## 更新记录\n - (2.0.1) publish 支持 新参数 `specify_app_display_name`, 指定 app 显示名称\n
271
+ \ - (2.0.1) publish 支持 新参数 `need_ansi_qrcode`, 在控制台直接打印二维码, jenkins 用户可能需要使用 `AnsiColor
272
+ Plugin` 插件配合\n - (2.0.1) publish 支持 新参数 `dingtalk_custom_message`, 可以在钉钉通知里增加自定义消息,
273
+ 此命令需配合 `dingtalk_access_token` 使用\n - (2.0.1) publish 支持 新参数 `skip_fir_cli_feedback`,
274
+ 可禁止 fir-cli 发送统计信息\n - (2.0.0) publish 使用更快的存储商, 加速上传速度, 若感觉没以前可使用 switch_to_qiniu
275
+ 恢复\n - (1.7.4) 配合 fastlane-plugin-fir_cli 做了一些小优化\n - (1.7.3) 新增了 上传指定图标, 不上传图标
276
+ 以及 将版本固定显示在下载页上\n - (1.7.2) 修正了无论是否加参数都固定出现二维码图片的bug\n - (1.7.1) 增加了 钉钉推送 , 增加了返回指定版本下载地址\n
245
277
  \ - (1.7.0) 过期了ipa_build 功能, 增加了对 android manifest instant run 的兼容\n - (1.6.13)
246
278
  上传图标逻辑修改\n - (1.6.12) 修复了部分机器没有默认安装 byebug 的问题\n - (1.6.11) 变化了 ruby gem 仓库地址\n
247
279
  \ - [fir-cli](https://github.com/firhq/fir-cli) 已经开源\n - 欢迎 fork, issue 和 pull