fastlane-plugin-pgyer 0.2.1 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +23 -4
- data/lib/fastlane/plugin/pgyer/actions/pgyer_action.rb +139 -54
- data/lib/fastlane/plugin/pgyer/helper/pgyer_helper.rb +4 -0
- data/lib/fastlane/plugin/pgyer/version.rb +1 -1
- metadata +69 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a46ff250a25edb2b0c6a243916177df1e67006cb01715a0ede6d3f4c8df1654
|
4
|
+
data.tar.gz: 90803824896253a5ba3ba3894da2d65618afaccbe96798a1bcabd2e4a490c650
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bccdcd579d4b9c98d56f913ca5cdb9a55259029f4fd2c389552baf2661ee3d4e47faefe6caf3aff9219d2b550eb8a3648df9b964ac5443ec06c05e5be259b999
|
7
|
+
data.tar.gz: a5635a2e1153743867119f0e7a148dee2e21fc956e3c5dd5ed11c2b5447191745504d5534f5c6c6737ba8725815ecad97a17fbb5409922feaeb8c5451f9737c2
|
data/README.md
CHANGED
@@ -18,12 +18,12 @@ This pluginin allow you distribute app automatically to [pgyer beta testing serv
|
|
18
18
|
|
19
19
|
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
20
20
|
|
21
|
-
Just specify the `api_key`
|
21
|
+
Just specify the `api_key` associated with your pgyer account.
|
22
22
|
|
23
23
|
```
|
24
24
|
lane :beta do
|
25
25
|
gym
|
26
|
-
pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141"
|
26
|
+
pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141")
|
27
27
|
end
|
28
28
|
```
|
29
29
|
|
@@ -32,7 +32,7 @@ You can also set a password to protect the App from being downloaded publicly:
|
|
32
32
|
```
|
33
33
|
lane :beta do
|
34
34
|
gym
|
35
|
-
pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141",
|
35
|
+
pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", password: "123456", install_type: "2")
|
36
36
|
end
|
37
37
|
```
|
38
38
|
|
@@ -41,10 +41,29 @@ Set a version update description for App:
|
|
41
41
|
```
|
42
42
|
lane :beta do
|
43
43
|
gym
|
44
|
-
pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141",
|
44
|
+
pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", update_description: "update by fastlane")
|
45
45
|
end
|
46
46
|
```
|
47
47
|
|
48
|
+
And more params
|
49
|
+
|
50
|
+
```
|
51
|
+
|
52
|
+
password: Set password to protect app.
|
53
|
+
|
54
|
+
update_description: Set update description for app.
|
55
|
+
|
56
|
+
install_type: Set install type for app (1=public, 2=password, 3=invite), Please set as a string.
|
57
|
+
|
58
|
+
install_date: Set install type for app (1=Set valid time, 2=Long-term effective, other=Do not modify the last setting), Please set as a string.
|
59
|
+
|
60
|
+
install_start_date: The value is a string of characters, for example, 2018-01-01.
|
61
|
+
|
62
|
+
install_end_date: The value is a string of characters, such as 2018-12-31.
|
63
|
+
|
64
|
+
channel: Need to update the specified channel of the download short link, can specify only one channel, string type, such as: ABCD. Specifies channel uploads. If you do not have one, do not use this parameter.
|
65
|
+
|
66
|
+
```
|
48
67
|
## Run tests for this plugin
|
49
68
|
|
50
69
|
To run both the tests, and code style validation, run
|
@@ -1,74 +1,116 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "faraday"
|
2
|
+
require "faraday_middleware"
|
3
3
|
|
4
4
|
module Fastlane
|
5
5
|
module Actions
|
6
6
|
class PgyerAction < Action
|
7
|
-
|
8
7
|
def self.run(params)
|
9
8
|
UI.message("The pgyer plugin is working.")
|
10
9
|
|
11
|
-
api_host = "http://qiniu-storage.pgyer.com/apiv1/app/upload"
|
12
10
|
api_key = params[:api_key]
|
13
|
-
user_key = params[:user_key]
|
14
11
|
|
15
12
|
build_file = [
|
16
|
-
|
17
|
-
|
13
|
+
params[:ipa],
|
14
|
+
params[:apk],
|
18
15
|
].detect { |e| !e.to_s.empty? }
|
19
16
|
|
20
17
|
if build_file.nil?
|
21
|
-
|
18
|
+
UI.user_error!("You have to provide a build file")
|
22
19
|
end
|
23
20
|
|
24
|
-
|
21
|
+
type = params[:ipa].nil? ? "android" : "ios"
|
22
|
+
|
23
|
+
UI.message "build_file: #{build_file}, type: #{type}"
|
24
|
+
|
25
|
+
install_type = params[:install_type]
|
26
|
+
if install_type.nil?
|
27
|
+
install_type = "1"
|
28
|
+
end
|
25
29
|
|
26
30
|
password = params[:password]
|
27
31
|
if password.nil?
|
28
|
-
|
32
|
+
password = ""
|
29
33
|
end
|
30
34
|
|
35
|
+
request_params = {
|
36
|
+
"_api_key" => api_key,
|
37
|
+
"buildType" => type,
|
38
|
+
"buildInstallType" => install_type,
|
39
|
+
"buildPassword" => password,
|
40
|
+
}
|
41
|
+
request_params["oversea"] = params[:oversea] unless params[:oversea].nil?
|
42
|
+
|
31
43
|
update_description = params[:update_description]
|
32
|
-
|
33
|
-
|
44
|
+
|
45
|
+
if update_description != nil
|
46
|
+
request_params["buildUpdateDescription"] = update_description
|
34
47
|
end
|
35
48
|
|
36
|
-
|
37
|
-
|
38
|
-
|
49
|
+
install_date = params[:install_date]
|
50
|
+
|
51
|
+
if install_date != nil
|
52
|
+
if install_date == "1"
|
53
|
+
request_params["buildInstallDate"] = install_date
|
54
|
+
install_start_date = params[:install_start_date]
|
55
|
+
request_params["buildInstallStartDate"] = install_start_date
|
56
|
+
install_end_date = params[:install_end_date]
|
57
|
+
request_params["buildInstallEndDate"] = install_end_date
|
58
|
+
elsif install_date == "2"
|
59
|
+
request_params["buildInstallDate"] = install_date
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
channel = params[:channel]
|
64
|
+
if channel != nil
|
65
|
+
request_params["buildChannelShortcut"] = channel
|
39
66
|
end
|
40
67
|
|
41
68
|
# start upload
|
42
69
|
conn_options = {
|
43
70
|
request: {
|
44
|
-
timeout:
|
45
|
-
open_timeout:
|
46
|
-
}
|
71
|
+
timeout: 1000,
|
72
|
+
open_timeout: 300,
|
73
|
+
},
|
47
74
|
}
|
48
75
|
|
76
|
+
api_host = "https://www.pgyer.com/apiv2/app"
|
77
|
+
|
49
78
|
pgyer_client = Faraday.new(nil, conn_options) do |c|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
79
|
+
c.request :multipart
|
80
|
+
c.request :url_encoded
|
81
|
+
c.response :json, content_type: /\bjson$/
|
82
|
+
c.adapter :net_http
|
54
83
|
end
|
55
84
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
85
|
+
response = pgyer_client.post "#{api_host}/getCOSToken", request_params
|
86
|
+
|
87
|
+
info = response.body
|
88
|
+
|
89
|
+
if info["code"] != 0
|
90
|
+
UI.user_error!("Get token is failed, info: #{info}")
|
91
|
+
end
|
92
|
+
|
93
|
+
key = info["data"]["key"]
|
94
|
+
|
95
|
+
endpoint = info["data"]["endpoint"]
|
96
|
+
|
97
|
+
request_params = info["data"]["params"]
|
98
|
+
|
99
|
+
if key.nil? || endpoint.nil? || request_params.nil?
|
100
|
+
UI.user_error!("Get token is failed")
|
101
|
+
end
|
102
|
+
content_type = type == "android" ? "application/vnd.android.package-archive" : "application/octet-stream"
|
103
|
+
request_params["file"] = Faraday::UploadIO.new(build_file, content_type)
|
64
104
|
|
65
105
|
UI.message "Start upload #{build_file} to pgyer..."
|
66
106
|
|
67
|
-
response = pgyer_client.post
|
68
|
-
info = response.body
|
107
|
+
response = pgyer_client.post endpoint, request_params
|
69
108
|
|
70
|
-
|
109
|
+
if response.status != 204
|
110
|
+
UI.user_error!("PGYER Plugin Upload Error: #{response.body}")
|
111
|
+
end
|
71
112
|
|
113
|
+
self.checkPublishStatus(pgyer_client, api_host, api_key, key)
|
72
114
|
end
|
73
115
|
|
74
116
|
def self.description
|
@@ -91,15 +133,10 @@ module Fastlane
|
|
91
133
|
def self.available_options
|
92
134
|
[
|
93
135
|
FastlaneCore::ConfigItem.new(key: :api_key,
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
FastlaneCore::ConfigItem.new(key: :user_key,
|
99
|
-
env_name: "PGYER_USER_KEY",
|
100
|
-
description: "user_key in your pgyer account",
|
101
|
-
optional: false,
|
102
|
-
type: String),
|
136
|
+
env_name: "PGYER_API_KEY",
|
137
|
+
description: "api_key in your pgyer account",
|
138
|
+
optional: false,
|
139
|
+
type: String),
|
103
140
|
FastlaneCore::ConfigItem.new(key: :apk,
|
104
141
|
env_name: "PGYER_APK",
|
105
142
|
description: "Path to your APK file",
|
@@ -125,20 +162,47 @@ module Fastlane
|
|
125
162
|
UI.user_error!("You can't use 'ipa' and '#{value.key}' options in one run")
|
126
163
|
end),
|
127
164
|
FastlaneCore::ConfigItem.new(key: :password,
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
165
|
+
env_name: "PGYER_PASSWORD",
|
166
|
+
description: "Set password to protect app",
|
167
|
+
optional: true,
|
168
|
+
type: String),
|
132
169
|
FastlaneCore::ConfigItem.new(key: :update_description,
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
170
|
+
env_name: "PGYER_UPDATE_DESCRIPTION",
|
171
|
+
description: "Set update description for app",
|
172
|
+
optional: true,
|
173
|
+
type: String),
|
137
174
|
FastlaneCore::ConfigItem.new(key: :install_type,
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
175
|
+
env_name: "PGYER_INSTALL_TYPE",
|
176
|
+
description: "Set install type for app (1=public, 2=password, 3=invite). Please set as a string",
|
177
|
+
optional: true,
|
178
|
+
type: String),
|
179
|
+
FastlaneCore::ConfigItem.new(key: :install_date,
|
180
|
+
env_name: "PGYER_INSTALL_DATE",
|
181
|
+
description: "Set install type for app (1=Set valid time, 2=Long-term effective, other=Do not modify the last setting). Please set as a string",
|
182
|
+
optional: true,
|
183
|
+
type: String),
|
184
|
+
FastlaneCore::ConfigItem.new(key: :install_start_date,
|
185
|
+
env_name: "PGYER_INSTALL_START_DATE",
|
186
|
+
description: "The value is a string of characters, for example, 2018-01-01",
|
187
|
+
optional: true,
|
188
|
+
type: String),
|
189
|
+
|
190
|
+
FastlaneCore::ConfigItem.new(key: :install_end_date,
|
191
|
+
env_name: "PGYER_INSTALL_END_DATE",
|
192
|
+
description: "The value is a string of characters, such as 2018-12-31",
|
193
|
+
optional: true,
|
194
|
+
type: String),
|
195
|
+
|
196
|
+
FastlaneCore::ConfigItem.new(key: :oversea,
|
197
|
+
env_name: "PGYER_OVERSEA",
|
198
|
+
description: "Whether to use overseas acceleration. 1 for overseas accelerated upload, 0 for domestic accelerated upload, not filled in for automatic judgment based on IP",
|
199
|
+
optional: true,
|
200
|
+
type: Numeric),
|
201
|
+
FastlaneCore::ConfigItem.new(key: :channel,
|
202
|
+
env_name: "PGYER_SPECIFIED_CHANNEL",
|
203
|
+
description: "Need to update the specified channel of the download short link, can specify only one channel, string type, such as: ABCD",
|
204
|
+
optional: true,
|
205
|
+
type: String),
|
142
206
|
]
|
143
207
|
end
|
144
208
|
|
@@ -149,6 +213,27 @@ module Fastlane
|
|
149
213
|
[:ios, :mac, :android].include?(platform)
|
150
214
|
true
|
151
215
|
end
|
216
|
+
|
217
|
+
private
|
218
|
+
|
219
|
+
def self.checkPublishStatus(client, api_host, api_key, buildKey)
|
220
|
+
response = client.post "#{api_host}/buildInfo", { :_api_key => api_key, :buildKey => buildKey }
|
221
|
+
info = response.body
|
222
|
+
code = info["code"]
|
223
|
+
if code == 0
|
224
|
+
UI.success "Upload success. BuildInfo is #{info["data"]}."
|
225
|
+
shortUrl = info["data"]["buildShortcutUrl"]
|
226
|
+
if shortUrl.nil? || shortUrl == ""
|
227
|
+
shortUrl = info["data"]["buildKey"]
|
228
|
+
end
|
229
|
+
UI.success "Upload success. Visit this URL to see: https://www.pgyer.com/#{shortUrl}"
|
230
|
+
elsif code == 1246 || code == 1247
|
231
|
+
sleep 3
|
232
|
+
self.checkPublishStatus(client, api_host, api_key, buildKey)
|
233
|
+
else
|
234
|
+
UI.user_error!("PGYER Plugin Published Error: #{info} buildKey: #{buildKey}")
|
235
|
+
end
|
236
|
+
end
|
152
237
|
end
|
153
238
|
end
|
154
239
|
end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-pgyer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rexshi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fastlane
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.208.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.208.0
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: pry
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -25,7 +53,7 @@ dependencies:
|
|
25
53
|
- !ruby/object:Gem::Version
|
26
54
|
version: '0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
56
|
+
name: rake
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
59
|
- - ">="
|
@@ -53,7 +81,7 @@ dependencies:
|
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
84
|
+
name: rspec_junit_formatter
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - ">="
|
@@ -68,6 +96,20 @@ dependencies:
|
|
68
96
|
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.12.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.12.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-performance
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
72
114
|
requirements:
|
73
115
|
- - ">="
|
@@ -81,20 +123,34 @@ dependencies:
|
|
81
123
|
- !ruby/object:Gem::Version
|
82
124
|
version: '0'
|
83
125
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
126
|
+
name: rubocop-require_tools
|
85
127
|
requirement: !ruby/object:Gem::Requirement
|
86
128
|
requirements:
|
87
129
|
- - ">="
|
88
130
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
131
|
+
version: '0'
|
90
132
|
type: :development
|
91
133
|
prerelease: false
|
92
134
|
version_requirements: !ruby/object:Gem::Requirement
|
93
135
|
requirements:
|
94
136
|
- - ">="
|
95
137
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
97
|
-
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description:
|
98
154
|
email: rexshi@pgyer.com
|
99
155
|
executables: []
|
100
156
|
extensions: []
|
@@ -110,7 +166,7 @@ homepage: https://github.com/shishirui/fastlane-plugin-pgyer
|
|
110
166
|
licenses:
|
111
167
|
- MIT
|
112
168
|
metadata: {}
|
113
|
-
post_install_message:
|
169
|
+
post_install_message:
|
114
170
|
rdoc_options: []
|
115
171
|
require_paths:
|
116
172
|
- lib
|
@@ -118,16 +174,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
174
|
requirements:
|
119
175
|
- - ">="
|
120
176
|
- !ruby/object:Gem::Version
|
121
|
-
version: '
|
177
|
+
version: '2.6'
|
122
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
179
|
requirements:
|
124
180
|
- - ">="
|
125
181
|
- !ruby/object:Gem::Version
|
126
182
|
version: '0'
|
127
183
|
requirements: []
|
128
|
-
|
129
|
-
|
130
|
-
signing_key:
|
184
|
+
rubygems_version: 3.1.6
|
185
|
+
signing_key:
|
131
186
|
specification_version: 4
|
132
187
|
summary: distribute app to pgyer beta testing service
|
133
188
|
test_files: []
|