fastlane-plugin-pgyer 0.2.0 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +39 -2
- data/lib/fastlane/plugin/pgyer/actions/pgyer_action.rb +131 -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: 8d3c45e770d204ec7bc1f613a1b27dc11db4f25043a8975e9bd63b6bcb10abf8
|
4
|
+
data.tar.gz: 71e8f65496c95cf9168f09ae2c81880666d88ed59b2d2a9e21f2c034a98b53d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1382bcc6d2cf7b41c5fb0f2ac5a52a1fa451ebab5bddfcd43ac03cab5728a2f3f7459c0524c18f19c6887b54e2e327448190cfa30fb08e6c2dfa9d8eaa71fe16
|
7
|
+
data.tar.gz: 313861f4d385c8bb2c3964839ce6807a7ba9a6b3dc47aac75c262fe637ae197236e96fa0734b206821e6800cbcaa9367a1a02f52c2dfbc5302228e0af7540c4d
|
data/README.md
CHANGED
@@ -18,15 +18,52 @@ 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
|
|
30
|
+
You can also set a password to protect the App from being downloaded publicly:
|
31
|
+
|
32
|
+
```
|
33
|
+
lane :beta do
|
34
|
+
gym
|
35
|
+
pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", password: "123456", install_type: "2")
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
Set a version update description for App:
|
40
|
+
|
41
|
+
```
|
42
|
+
lane :beta do
|
43
|
+
gym
|
44
|
+
pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", update_description: "update by fastlane")
|
45
|
+
end
|
46
|
+
```
|
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
|
+
```
|
30
67
|
## Run tests for this plugin
|
31
68
|
|
32
69
|
To run both the tests, and code style validation, run
|
@@ -1,74 +1,115 @@
|
|
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
|
+
|
31
42
|
update_description = params[:update_description]
|
32
|
-
|
33
|
-
|
43
|
+
|
44
|
+
if update_description != nil
|
45
|
+
request_params["buildUpdateDescription"] = update_description
|
34
46
|
end
|
35
47
|
|
36
|
-
|
37
|
-
|
38
|
-
|
48
|
+
install_date = params[:install_date]
|
49
|
+
|
50
|
+
if install_date != nil
|
51
|
+
if install_date == "1"
|
52
|
+
request_params["buildInstallDate"] = install_date
|
53
|
+
install_start_date = params[:install_start_date]
|
54
|
+
request_params["buildInstallStartDate"] = install_start_date
|
55
|
+
install_end_date = params[:install_end_date]
|
56
|
+
request_params["buildInstallEndDate"] = install_end_date
|
57
|
+
elsif install_date == "2"
|
58
|
+
request_params["buildInstallDate"] = install_date
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
channel = params[:channel]
|
63
|
+
if channel != nil
|
64
|
+
request_params["buildChannelShortcut"] = channel
|
39
65
|
end
|
40
66
|
|
41
67
|
# start upload
|
42
68
|
conn_options = {
|
43
69
|
request: {
|
44
|
-
timeout:
|
45
|
-
open_timeout:
|
46
|
-
}
|
70
|
+
timeout: 1000,
|
71
|
+
open_timeout: 300,
|
72
|
+
},
|
47
73
|
}
|
48
74
|
|
75
|
+
api_host = "https://www.pgyer.com/apiv2/app"
|
76
|
+
|
49
77
|
pgyer_client = Faraday.new(nil, conn_options) do |c|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
78
|
+
c.request :multipart
|
79
|
+
c.request :url_encoded
|
80
|
+
c.response :json, content_type: /\bjson$/
|
81
|
+
c.adapter :net_http
|
54
82
|
end
|
55
83
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
84
|
+
response = pgyer_client.post "#{api_host}/getCOSToken", request_params
|
85
|
+
|
86
|
+
info = response.body
|
87
|
+
|
88
|
+
if info["code"] != 0
|
89
|
+
UI.user_error!("Get token is failed, info: #{info}")
|
90
|
+
end
|
91
|
+
|
92
|
+
key = info["data"]["key"]
|
93
|
+
|
94
|
+
endpoint = info["data"]["endpoint"]
|
95
|
+
|
96
|
+
request_params = info["data"]["params"]
|
97
|
+
|
98
|
+
if key.nil? || endpoint.nil? || request_params.nil?
|
99
|
+
UI.user_error!("Get token is failed")
|
100
|
+
end
|
101
|
+
content_type = type == 'android' ? 'application/vnd.android.package-archive' : 'application/octet-stream'
|
102
|
+
request_params["file"] = Faraday::UploadIO.new(build_file, content_type)
|
64
103
|
|
65
104
|
UI.message "Start upload #{build_file} to pgyer..."
|
66
105
|
|
67
|
-
response = pgyer_client.post
|
68
|
-
info = response.body
|
106
|
+
response = pgyer_client.post endpoint, request_params
|
69
107
|
|
70
|
-
|
108
|
+
if response.status != 204
|
109
|
+
UI.user_error!("PGYER Plugin Upload Error: #{response.body}")
|
110
|
+
end
|
71
111
|
|
112
|
+
self.checkPublishStatus(pgyer_client, api_host, api_key, key)
|
72
113
|
end
|
73
114
|
|
74
115
|
def self.description
|
@@ -91,15 +132,10 @@ module Fastlane
|
|
91
132
|
def self.available_options
|
92
133
|
[
|
93
134
|
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),
|
135
|
+
env_name: "PGYER_API_KEY",
|
136
|
+
description: "api_key in your pgyer account",
|
137
|
+
optional: false,
|
138
|
+
type: String),
|
103
139
|
FastlaneCore::ConfigItem.new(key: :apk,
|
104
140
|
env_name: "PGYER_APK",
|
105
141
|
description: "Path to your APK file",
|
@@ -125,20 +161,40 @@ module Fastlane
|
|
125
161
|
UI.user_error!("You can't use 'ipa' and '#{value.key}' options in one run")
|
126
162
|
end),
|
127
163
|
FastlaneCore::ConfigItem.new(key: :password,
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
164
|
+
env_name: "PGYER_PASSWORD",
|
165
|
+
description: "Set password to protect app",
|
166
|
+
optional: true,
|
167
|
+
type: String),
|
132
168
|
FastlaneCore::ConfigItem.new(key: :update_description,
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
169
|
+
env_name: "PGYER_UPDATE_DESCRIPTION",
|
170
|
+
description: "Set update description for app",
|
171
|
+
optional: true,
|
172
|
+
type: String),
|
137
173
|
FastlaneCore::ConfigItem.new(key: :install_type,
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
174
|
+
env_name: "PGYER_INSTALL_TYPE",
|
175
|
+
description: "Set install type for app (1=public, 2=password, 3=invite). Please set as a string",
|
176
|
+
optional: true,
|
177
|
+
type: String),
|
178
|
+
FastlaneCore::ConfigItem.new(key: :install_date,
|
179
|
+
env_name: "PGYER_INSTALL_DATE",
|
180
|
+
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",
|
181
|
+
optional: true,
|
182
|
+
type: String),
|
183
|
+
FastlaneCore::ConfigItem.new(key: :install_start_date,
|
184
|
+
env_name: "PGYER_INSTALL_START_DATE",
|
185
|
+
description: "The value is a string of characters, for example, 2018-01-01",
|
186
|
+
optional: true,
|
187
|
+
type: String),
|
188
|
+
FastlaneCore::ConfigItem.new(key: :install_end_date,
|
189
|
+
env_name: "PGYER_INSTALL_END_DATE",
|
190
|
+
description: "The value is a string of characters, such as 2018-12-31",
|
191
|
+
optional: true,
|
192
|
+
type: String),
|
193
|
+
FastlaneCore::ConfigItem.new(key: :channel,
|
194
|
+
env_name: "PGYER_INSTALL_TYPE",
|
195
|
+
description: "Need to update the specified channel of the download short link, can specify only one channel, string type, such as: ABCD",
|
196
|
+
optional: true,
|
197
|
+
type: String),
|
142
198
|
]
|
143
199
|
end
|
144
200
|
|
@@ -149,6 +205,27 @@ module Fastlane
|
|
149
205
|
[:ios, :mac, :android].include?(platform)
|
150
206
|
true
|
151
207
|
end
|
208
|
+
|
209
|
+
private
|
210
|
+
|
211
|
+
def self.checkPublishStatus(client, api_host, api_key, buildKey)
|
212
|
+
response = client.post "#{api_host}/buildInfo", { :_api_key => api_key, :buildKey => buildKey }
|
213
|
+
info = response.body
|
214
|
+
code = info["code"]
|
215
|
+
if code == 0
|
216
|
+
UI.success "Upload success. BuildInfo is #{info["data"]}."
|
217
|
+
shortUrl = info["data"]["buildShortcutUrl"]
|
218
|
+
if shortUrl.nil? || shortUrl == ""
|
219
|
+
shortUrl = info["data"]["buildKey"]
|
220
|
+
end
|
221
|
+
UI.success "Upload success. Visit this URL to see: https://www.pgyer.com/#{shortUrl}"
|
222
|
+
elsif code == 1246 || code == 1247
|
223
|
+
sleep 3
|
224
|
+
self.checkPublishStatus(client, api_host, api_key, buildKey)
|
225
|
+
else
|
226
|
+
UI.user_error!("PGYER Plugin Published Error: #{info} buildKey: #{buildKey}")
|
227
|
+
end
|
228
|
+
end
|
152
229
|
end
|
153
230
|
end
|
154
231
|
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.3
|
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-22 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: []
|