fastlane-plugin-pgyer_jvtd 0.1.7 → 0.1.8

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: 6e391277612610b620b9aa65c369dd8b8c63e31485657ba6f143cb79286ec1c5
4
- data.tar.gz: 17de902acee5e255f646a32d4c45922d227aca083a880bf087615074c98534e4
3
+ metadata.gz: ddeefc67253d08bd64d8c8f496dd6706902e43deabaff6f33f8d74101c13f9a9
4
+ data.tar.gz: 53eb5767b449aeddb0249ff4fa375780f2f52f1c437cd72a132cb82185789824
5
5
  SHA512:
6
- metadata.gz: db02089e67674cb4ce5b7227c3721ed2777397ab6c82910f8fddc875daabaed53215c1363d1459ed1e6cb854fa851899e54c3b60e45e89c000c2c38f5aab1eff
7
- data.tar.gz: 88ad77f3f572181ecfba2ba13a63ea6b88b2a9326bc543fbbb165773a8b8403260c1ae03b5ebce88fe4180a58f4d60d98d6761422a5cbdbe00147c64e484eece
6
+ metadata.gz: fce83201a7774248a5abaf1eb3d9af6378f2256375135077ed1bd2ef240a8ce36f8ec38892cddcd490bf10f544b4c120760aaea78587c13141a45c0aeda787b9
7
+ data.tar.gz: b35785e288b6f7a5ea530507e76b86b20adfd6f019c44c7060e0543eb94d70e46a5c2100eb5d10ebebc46020ee81b783acf9501ff7ae55fc3603e77e5c702695
@@ -10,16 +10,16 @@ module Fastlane
10
10
  api_host = "http://qiniu-storage.pgyer.com/apiv1/app/upload"
11
11
  api_key = params[:api_key]
12
12
  user_key = params[:user_key]
13
- access_token = params[:dingtalk_access_token]
14
- is_at_all = params[:is_at_all]
15
-
16
- if is_at_all.nil?
17
- is_at_all = "0"
18
- end
13
+ access_token = params[:dingtalk_access_token]
14
+ is_at_all = params[:is_at_all]
15
+
16
+ if is_at_all.nil?
17
+ is_at_all = "0"
18
+ end
19
19
 
20
20
  build_file = [
21
- params[:ipa],
22
- params[:apk]
21
+ params[:ipa],
22
+ params[:apk]
23
23
  ].detect { |e| !e.to_s.empty? }
24
24
 
25
25
  if build_file.nil?
@@ -42,7 +42,7 @@ module Fastlane
42
42
  if install_type.nil?
43
43
  install_type = "1"
44
44
  end
45
-
45
+
46
46
  channel_shortcut = params[:channel_shortcut]
47
47
  if channel_shortcut.nil?
48
48
  channel_shortcut = ""
@@ -50,10 +50,10 @@ module Fastlane
50
50
 
51
51
  # start upload
52
52
  conn_options = {
53
- request: {
54
- timeout: 1000,
55
- open_timeout: 300
56
- }
53
+ request: {
54
+ timeout: 1000,
55
+ open_timeout: 300
56
+ }
57
57
  }
58
58
 
59
59
  pgyer_client = Faraday.new(nil, conn_options) do |c|
@@ -80,86 +80,87 @@ module Fastlane
80
80
 
81
81
  if info['code'] != 0
82
82
  UI.user_error!("PGYER Plugin Error: #{info['message']}")
83
+ return
83
84
  end
84
85
 
85
86
  UI.success "Upload success. Visit this URL to see: https://www.pgyer.com/#{info['data']['appShortcutUrl']}"
86
-
87
-
88
- # 应用类型
89
- appType = "Android";
90
- if info['data']['appType'] == 1
91
- appType = "iOS"
92
- end
93
-
94
- # 应用名称
95
- appName = info['data']['appName']
96
- # 应用版本信息
97
- appVersion = info['data']['appVersion']
98
- # 应用蒲公英版本
99
- appBuildVersion = info['data']['appBuildVersion']
100
- # 图标
101
- appIcon = "https://appicon.pgyer.com/image/view/app_icons/#{info['data']['appIcon']}"
102
- # 地址
103
- appUrl = "https://www.pgyer.com/#{info['data']['appShortcutUrl']}"
104
-
105
- unless access_token.nil?
106
- uri = URI.parse("https://oapi.dingtalk.com/robot/send?access_token=#{access_token}")
107
-
108
- dingtalk_client = Faraday.new(nil, conn_options) do |c|
109
- c.request :multipart
110
- c.request :url_encoded
111
- c.response :json, content_type: /\bjson$/
112
- c.adapter :net_http
113
- end
114
-
115
- params = {
116
- "msgtype"=> "link",
117
- "link"=> {
118
- "text"=> "#{appName}#{appType} App发布",
119
- "title"=> "请下载最新版本#{appVersion}(#{appBuildVersion})",
120
- "picUrl"=> appIcon,
121
- "messageUrl"=> appUrl
122
- }
123
- }
124
-
125
-
126
- response = dingtalk_client.post uri, params
127
- info = response.body
128
-
129
- if info['errcode'] != 0
130
- UI.error('ding talk error message: ' + info["errmsg"])
131
- end
132
-
133
- dingtalk2_client = Faraday.new(nil, conn_options) do |c|
134
- c.request :multipart
135
- c.request :url_encoded
136
- c.response :json, content_type: /\bjson$/
137
- c.adapter :net_http
138
- end
139
-
140
- params = {
141
- "msgtype" => "text",
142
- "text" => {
143
- "content" => "#{appName}#{appType} App最新版本已发布"
144
- },
145
- "at"=> {
146
- "atMobiles" => [],
147
- "isAtAll" => ia_at_all == "1"
148
- }
149
- }
150
-
151
-
152
- response = dingtalk2_client.post uri, params
153
- info = response.body
154
-
155
- if info['errcode'] != 0
156
- UI.error('ding talk error message: ' + info["errmsg"])
157
- end
158
-
159
- UI.success("Successfully send qr code to ding talk!")
160
- else
161
- end
162
-
87
+
88
+
89
+ # 应用类型
90
+ appType = "Android";
91
+ if info['data']['appType'] == 1
92
+ appType = "iOS"
93
+ end
94
+
95
+ # 应用名称
96
+ appName = info['data']['appName']
97
+ # 应用版本信息
98
+ appVersion = info['data']['appVersion']
99
+ # 应用蒲公英版本
100
+ appBuildVersion = info['data']['appBuildVersion']
101
+ # 图标
102
+ appIcon = "https://appicon.pgyer.com/image/view/app_icons/#{info['data']['appIcon']}"
103
+ # 地址
104
+ appUrl = "https://www.pgyer.com/#{info['data']['appShortcutUrl']}"
105
+
106
+ unless access_token.nil?
107
+ uri = URI.parse("https://oapi.dingtalk.com/robot/send?access_token=#{access_token}")
108
+
109
+ dingtalk_client = Faraday.new(nil, conn_options) do |c|
110
+ c.request :multipart
111
+ c.request :url_encoded
112
+ c.response :json, content_type: /\bjson$/
113
+ c.adapter :net_http
114
+ end
115
+
116
+ params = {
117
+ "msgtype" => "link",
118
+ "link" => {
119
+ "text" => "#{appName}#{appType} App发布",
120
+ "title" => "请下载最新版本#{appVersion}(#{appBuildVersion})",
121
+ "picUrl" => appIcon,
122
+ "messageUrl" => appUrl
123
+ }
124
+ }
125
+
126
+
127
+ response = dingtalk_client.post uri, params
128
+ info = response.body
129
+
130
+ if info['errcode'] != 0
131
+ UI.error('ding talk error message: ' + info["errmsg"])
132
+ end
133
+
134
+ dingtalk2_client = Faraday.new(nil, conn_options) do |c|
135
+ c.request :multipart
136
+ c.request :url_encoded
137
+ c.response :json, content_type: /\bjson$/
138
+ c.adapter :net_http
139
+ end
140
+
141
+ params = {
142
+ "msgtype" => "text",
143
+ "text" => {
144
+ "content" => "#{appName}#{appType} App最新版本已发布"
145
+ },
146
+ "at" => {
147
+ "atMobiles" => [],
148
+ "isAtAll" => is_at_all == "1"
149
+ }
150
+ }
151
+
152
+
153
+ response = dingtalk2_client.post uri, params
154
+ info = response.body
155
+
156
+ if info['errcode'] != 0
157
+ UI.error('ding talk error message: ' + info["errmsg"])
158
+ end
159
+
160
+ UI.success("Successfully send qr code to ding talk!")
161
+ else
162
+ end
163
+
163
164
  end
164
165
 
165
166
  def self.description
@@ -181,70 +182,70 @@ module Fastlane
181
182
 
182
183
  def self.available_options
183
184
  [
184
- FastlaneCore::ConfigItem.new(key: :api_key,
185
- env_name: "PGYER_API_KEY",
186
- description: "api_key in your pgyer account",
187
- optional: false,
188
- type: String),
189
- FastlaneCore::ConfigItem.new(key: :user_key,
190
- env_name: "PGYER_USER_KEY",
191
- description: "user_key in your pgyer account",
192
- optional: false,
193
- type: String),
194
- FastlaneCore::ConfigItem.new(key: :apk,
195
- env_name: "PGYER_APK",
196
- description: "Path to your APK file",
197
- default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
198
- optional: true,
199
- verify_block: proc do |value|
200
- UI.user_error!("Couldn't find apk file at path '#{value}'") unless File.exist?(value)
201
- end,
202
- conflicting_options: [:ipa],
203
- conflict_block: proc do |value|
204
- UI.user_error!("You can't use 'apk' and '#{value.key}' options in one run")
205
- end),
206
- FastlaneCore::ConfigItem.new(key: :ipa,
207
- env_name: "PGYER_IPA",
208
- description: "Path to your IPA file. Optional if you use the _gym_ or _xcodebuild_ action. For Mac zip the .app. For Android provide path to .apk file",
209
- default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
210
- optional: true,
211
- verify_block: proc do |value|
212
- UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value)
213
- end,
214
- conflicting_options: [:apk],
215
- conflict_block: proc do |value|
216
- UI.user_error!("You can't use 'ipa' and '#{value.key}' options in one run")
217
- end),
218
- FastlaneCore::ConfigItem.new(key: :password,
219
- env_name: "PGYER_PASSWORD",
220
- description: "set password to protect app",
221
- optional: true,
222
- type: String),
223
- FastlaneCore::ConfigItem.new(key: :update_description,
224
- env_name: "PGYER_UPDATE_DESCRIPTION",
225
- description: "set update description for app",
226
- optional: true,
227
- type: String),
228
- FastlaneCore::ConfigItem.new(key: :install_type,
229
- env_name: "PGYER_INSTALL_TYPE",
230
- description: "set install type for app (1=public, 2=password, 3=invite). Please set as a string",
231
- optional: true,
232
- type: String),
233
- FastlaneCore::ConfigItem.new(key: :channel_shortcut,
234
- env_name: "PGYER_CHANNEL",
235
- description: "Use channel short link. Please set as a string",
236
- optional: true,
237
- type: String),
238
- FastlaneCore::ConfigItem.new(key: :dingtalk_access_token,
239
- env_name: "DINGTALK_ACCESS_TOKEN",
240
- description: "Set up webhook and push update messages. Please set as a string",
241
- optional: true,
242
- type: String),
243
- FastlaneCore::ConfigItem.new(key: :is_at_all,
244
- env_name: "DINGTALK_IS_AT_ALL",
245
- description: "set is at all for dingtalk (0=not_all, 1=all). Please set as a string",
246
- optional: true,
247
- type: String)
185
+ FastlaneCore::ConfigItem.new(key: :api_key,
186
+ env_name: "PGYER_API_KEY",
187
+ description: "api_key in your pgyer account",
188
+ optional: false,
189
+ type: String),
190
+ FastlaneCore::ConfigItem.new(key: :user_key,
191
+ env_name: "PGYER_USER_KEY",
192
+ description: "user_key in your pgyer account",
193
+ optional: false,
194
+ type: String),
195
+ FastlaneCore::ConfigItem.new(key: :apk,
196
+ env_name: "PGYER_APK",
197
+ description: "Path to your APK file",
198
+ default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
199
+ optional: true,
200
+ verify_block: proc do |value|
201
+ UI.user_error!("Couldn't find apk file at path '#{value}'") unless File.exist?(value)
202
+ end,
203
+ conflicting_options: [:ipa],
204
+ conflict_block: proc do |value|
205
+ UI.user_error!("You can't use 'apk' and '#{value.key}' options in one run")
206
+ end),
207
+ FastlaneCore::ConfigItem.new(key: :ipa,
208
+ env_name: "PGYER_IPA",
209
+ description: "Path to your IPA file. Optional if you use the _gym_ or _xcodebuild_ action. For Mac zip the .app. For Android provide path to .apk file",
210
+ default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
211
+ optional: true,
212
+ verify_block: proc do |value|
213
+ UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value)
214
+ end,
215
+ conflicting_options: [:apk],
216
+ conflict_block: proc do |value|
217
+ UI.user_error!("You can't use 'ipa' and '#{value.key}' options in one run")
218
+ end),
219
+ FastlaneCore::ConfigItem.new(key: :password,
220
+ env_name: "PGYER_PASSWORD",
221
+ description: "set password to protect app",
222
+ optional: true,
223
+ type: String),
224
+ FastlaneCore::ConfigItem.new(key: :update_description,
225
+ env_name: "PGYER_UPDATE_DESCRIPTION",
226
+ description: "set update description for app",
227
+ optional: true,
228
+ type: String),
229
+ FastlaneCore::ConfigItem.new(key: :install_type,
230
+ env_name: "PGYER_INSTALL_TYPE",
231
+ description: "set install type for app (1=public, 2=password, 3=invite). Please set as a string",
232
+ optional: true,
233
+ type: String),
234
+ FastlaneCore::ConfigItem.new(key: :channel_shortcut,
235
+ env_name: "PGYER_CHANNEL",
236
+ description: "Use channel short link. Please set as a string",
237
+ optional: true,
238
+ type: String),
239
+ FastlaneCore::ConfigItem.new(key: :dingtalk_access_token,
240
+ env_name: "DINGTALK_ACCESS_TOKEN",
241
+ description: "Set up webhook and push update messages. Please set as a string",
242
+ optional: true,
243
+ type: String),
244
+ FastlaneCore::ConfigItem.new(key: :is_at_all,
245
+ env_name: "DINGTALK_IS_AT_ALL",
246
+ description: "set is at all for dingtalk (0=not_all, 1=all). Please set as a string",
247
+ optional: true,
248
+ type: String)
248
249
  ]
249
250
  end
250
251
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module PgyerJvtd
3
- VERSION = "0.1.7"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-pgyer_jvtd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - 陈磊的MacBook Pro