fir-cli 2.0.8 → 2.0.9

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: 9850b88e681117a4ca51cbbb03a4a763b9988e0bbbe9a71240ce4be0c0d3af8e
4
- data.tar.gz: 7216bcba798d427464cea462fd51c01547930478eb173a145d8395c2e1c3b4c2
3
+ metadata.gz: bdd7fc7cd378d98beff907cd71e92b014c8f2123088fbd15d092694040513d23
4
+ data.tar.gz: e589b79ef22e771c660af8ec3f1eadd47aff73bf67247e296f8dc1f820588b2c
5
5
  SHA512:
6
- metadata.gz: c296355543864f8b42c21c356a54d8c297aa4f3cc31ac0df0e94a3e9a6a54aaca68a8d1970052cb4106b102d42eb0ac8fe82618c860b787adbd85b6dba9c2083
7
- data.tar.gz: 8c5beba65c8401c85a87f1b8437682133fdec9c9ad95441df4c8ac4ef199044ec23aacc105aa72bef21c046e4699de9e14616254406eeac9cf664b6be419e7e7
6
+ metadata.gz: ea1824c70e3ba0aa2e25ffcf9f803b93e804efc66d8da142cce125bebb0b03084470e355f2b78e6e7629fc5366b9fec2c543518eafcd67e973ffe5b9354f16a9
7
+ data.tar.gz: affbceef191ddbe5afc05fa22040c0f8d249183eee92e68644fa2ab43107e890c43df409b030df047646ff78f5fc9e28686d54a22157333a0daf6b0e7142c2fe
data/README.md CHANGED
@@ -18,7 +18,8 @@ fir.im-cli 可以通过指令查看, 上传, iOS/Android 应用.
18
18
  当然还有种解决办法是 更新 `fir-cli` 至 `2.0.5`, 这个版本换到了备用域名
19
19
 
20
20
  # 最近更新
21
- - (2.0.8) publish 支持 飞书通知, 可使用 `feishu_access_token` `feishu_custom_message`
21
+ - (2.0.9) publish 支持了 企业微信通知 可以使用 --wxwork_access_token --wxwork_webhook, 增加了回调超时时间至20秒
22
+ - (2.0.8) publish 支持 飞书通知, 可使用 `feishu_access_token` 和 `feishu_custom_message`, 详情见 `fir publish --help`
22
23
  - (2.0.7) 修复了提示 token 错误的问题
23
24
  - (2.0.6) 修复了因为文件读取方式变化而导致的文件找不到不报错的问题
24
25
  - (2.0.5) 因为深信服 的黑名单误判, 将 api 切换到了备用域名
@@ -141,7 +142,7 @@ docker run -e API_TOKEN=您的token -v 您的上传文件的目录的绝对路
141
142
  ## 特别感谢
142
143
 
143
144
  - 感谢 sparkrico 提供修正的 https://github.com/sparkrico/ruby_apk 解决了 android 解析的问题
144
-
145
+ - 感谢 fabcz 同学对企业微信的通知的支持 https://github.com/FIRHQ/fir-cli/pull/277
145
146
 
146
147
  ## 鼓励维护
147
148
 
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  /_/ /___/_/ |_| \____/_____/___/
28
28
 
29
29
  ## 更新记录
30
+ - (2.0.9) publish 支持了 企业微信通知 可以使用 --wxwork_access_token 或 --wxwork_webhook, 增加了回调超时时间至20秒
30
31
  - (2.0.8) publish 支持 飞书通知, 可使用 `feishu_access_token` 和 `feishu_custom_message`, 详情见 `fir publish --help`
31
32
  - (2.0.7) 修复了提示 token 有问题的错误
32
33
  - (2.0.6) 将校验文件是否存在提前
@@ -130,6 +130,11 @@ module FIR
130
130
  method_option :feishu_access_token, type: :string, desc: 'Send msg to feishu, need access_token, not whole url'
131
131
  method_option :feishu_custom_message, type: :string, desc: 'add custom message to feishu'
132
132
 
133
+ method_option :wxwork_webhook, type: :string, desc: 'wxwork webhook url (optional)'
134
+ method_option :wxwork_access_token, type: :string, desc: 'Send msg to wxwork group, need group bot webhook, not whole url'
135
+ method_option :wxwork_custom_message, type: :string, desc: 'add custom message to wxwork group'
136
+ method_option :wxwork_pic_url, type: :string, desc: 'message background image, best size is 1068x455'
137
+
133
138
  method_option :open, type: :boolean, desc: 'true/false if open for everyone'
134
139
  method_option :password, type: :string, desc: 'Set password for app'
135
140
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FIR
2
4
  class AppUploader
3
5
  include ApiTools::DefaultRestModule
@@ -14,6 +16,8 @@ module FIR
14
16
  def upload
15
17
  upload_icon
16
18
  binary_callback_info = upload_binary
19
+ raise binary_callback_info if binary_callback_info.is_a? StandardError
20
+
17
21
  # 将 binary 的callback信息返回
18
22
  binary_callback_info
19
23
  end
@@ -21,9 +25,12 @@ module FIR
21
25
  protected
22
26
 
23
27
  def callback_to_api(callback_url, callback_binary_information)
28
+ logger.debug 'begin to callback api'
24
29
  return if callback_binary_information.blank?
25
30
 
26
- post callback_url, callback_binary_information
31
+ answer = post callback_url, callback_binary_information, timeout: 20
32
+ logger.debug 'callback api finished'
33
+ answer
27
34
  end
28
35
 
29
36
  def icon_file_path
@@ -74,6 +81,7 @@ module FIR
74
81
 
75
82
  def callback_icon_information
76
83
  return {} if icon_file_path.nil?
84
+
77
85
  {
78
86
  key: icon_cert[:key],
79
87
  token: icon_cert[:token],
@@ -106,6 +114,5 @@ module FIR
106
114
  def logger
107
115
  FIR.logger
108
116
  end
109
-
110
117
  end
111
- end
118
+ end
@@ -28,6 +28,7 @@ module FIR
28
28
 
29
29
  dingtalk_notifier(download_url, qrcode_path)
30
30
  feishu_notifier(download_url)
31
+ wxwork_notifier(download_url)
31
32
 
32
33
  upload_mapping_file_with_publish
33
34
 
@@ -226,6 +227,26 @@ module FIR
226
227
  DefaultRest.post(url, payload)
227
228
  end
228
229
 
230
+ def wxwork_notifier(download_url)
231
+ webhook_url = options[:wxwork_webhook]
232
+ webhook_url ||= "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=#{options[:wxwork_access_token]}"
233
+ return if webhook_url.blank?
234
+
235
+ title = "#{@app_info[:name]}-#{@app_info[:version]}(Build #{@app_info[:build]})"
236
+ payload = {
237
+ "msgtype": "news",
238
+ "news": {
239
+ "articles": [{
240
+ "title": "#{title} uploaded",
241
+ "description": "#{title} uploaded at #{Time.now}\nurl: #{download_url}\n#{options[:wxwork_custom_message]}\n",
242
+ "url": download_url,
243
+ "picurl": options[:wxwork_pic_url]
244
+ }],
245
+ },
246
+ }
247
+ DefaultRest.post(webhook_url, payload)
248
+ end
249
+
229
250
  def initialize_publish_options(args, options)
230
251
  @options = options
231
252
  @file_path = File.absolute_path(args.first.to_s)
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module FIR
4
- VERSION = '2.0.8'
4
+ VERSION = '2.0.9'
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.8
4
+ version: 2.0.9
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: 2020-03-17 00:00:00.000000000 Z
12
+ date: 2020-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -254,7 +254,8 @@ metadata: {}
254
254
  post_install_message: "\n ______________ ________ ____\n /
255
255
  ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
256
256
  /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
257
- \ ## 更新记录\n - (2.0.8) publish 支持 飞书通知, 可使用 `feishu_access_token` `feishu_custom_message`,
257
+ \ ## 更新记录\n - (2.0.9) publish 支持了 企业微信通知 可以使用 --wxwork_access_token --wxwork_webhook,
258
+ 增加了回调超时时间至20秒\n - (2.0.8) publish 支持 飞书通知, 可使用 `feishu_access_token` 和 `feishu_custom_message`,
258
259
  详情见 `fir publish --help`\n - (2.0.7) 修复了提示 token 有问题的错误\n - (2.0.6) 将校验文件是否存在提前\n
259
260
  \ - (2.0.5) 更换了上传域名, 避免与 深信服的设备冲突\n - (2.0.4) 修复了 cdn 不支持 patch 方法透传, 导致在修改 app
260
261
  信息的时候返回的 400 错误\n - (2.0.3) 增加 dingtalk_at_phones, 钉钉通知可 at 用户手机号, 以逗号,分割. 此命令需配合