fastlane-plugin-alioss 0.1.7 → 0.2.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3407ac577c77dbc5a4cd56051df9c1362e8828ce38c2e47ae2d72fc343b2a069
|
4
|
+
data.tar.gz: 4c4b89f30f4d088588bebab53502cd4e26b1eef64d9e29e5fa2f27a660c11962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3d6c45fe4f62dff19937917010aba10cdb66eb02fdc1ebb18cd38f7ea563231314e03607a21f663e2bc68e21e519422e63e3d5c04f0eef906d047683a169dfb
|
7
|
+
data.tar.gz: 5c79db5cdd586d4c7952e1b282d1293df429b78007b380db3e935894b68fd76eaaf33a0149c4361f88f920cf52c475df439b3e6a88a63d98f085ac6b01b0ca47
|
@@ -6,6 +6,14 @@ require 'json'
|
|
6
6
|
|
7
7
|
module Fastlane
|
8
8
|
module Actions
|
9
|
+
module SharedValues
|
10
|
+
ALIOSS_BUILD_NUMBER = :ALIOSS_BUILD_NUMBER
|
11
|
+
ALIOSS_VERSION_NUMBER = :ALIOSS_VERSION_NUMBER
|
12
|
+
ALIOSS_PUBLISH_TIMESTAMP = :ALIOSS_PUBLISH_TIMESTAMP
|
13
|
+
ALIOSS_FILE_SIZE = :ALIOSS_FILE_SIZE
|
14
|
+
ALIOSS_DOWNLOAD_URL = :ALIOSS_DOWNLOAD_URL
|
15
|
+
end
|
16
|
+
|
9
17
|
class AliossAction < Action
|
10
18
|
def self.run(params)
|
11
19
|
UI.message("The alioss plugin is working!")
|
@@ -16,6 +24,7 @@ module Fastlane
|
|
16
24
|
access_key_secret = params[:access_key_secret]
|
17
25
|
path_for_app_name = params[:app_name]
|
18
26
|
html_header_title = params[:html_header_title]
|
27
|
+
list_buckets = params[:list_buckets]
|
19
28
|
|
20
29
|
build_file = [
|
21
30
|
params[:ipa],
|
@@ -51,14 +60,27 @@ module Fastlane
|
|
51
60
|
bucket = client.get_bucket(bucket_name)
|
52
61
|
|
53
62
|
# list all buckets
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
63
|
+
unless list_buckets.nil? || %w(NO no false FALSE).include?(list_buckets) || list_buckets == false
|
64
|
+
UI.message "========== list all buckets =========="
|
65
|
+
bucket_objects = []
|
66
|
+
bucket.list_objects.each do |o|
|
67
|
+
UI.message o.key
|
68
|
+
bucket_objects.push(o.key)
|
69
|
+
end
|
59
70
|
end
|
60
71
|
UI.message "======================================"
|
61
72
|
|
73
|
+
# 配置logo
|
74
|
+
unless bucket.object_exists?("#{path_for_app_name}/icon.png")
|
75
|
+
input = File.expand_path(UI.input("icon.png不存在,请上传您App的logo(120*120 <= 尺寸 <= 480*480),请输入文件路径(例如:~/Desktop/icon.png):"))
|
76
|
+
# 判断是一个普通文件 && 可读 && 扩展名是png
|
77
|
+
if File.readable_real?(input) && File.extname(input) == ".png"
|
78
|
+
bucket.put_object("#{path_for_app_name}/icon.png", :file => input)
|
79
|
+
UI.message "#{path_for_app_name}/icon.png 配置完成"
|
80
|
+
else
|
81
|
+
UI.important "文件不存在或无权限读写,请确认icon.png的文件路径"
|
82
|
+
end
|
83
|
+
end
|
62
84
|
|
63
85
|
# 必须包含的文件,没有就引导去下载
|
64
86
|
# must_bucket_file = ["app/config.json", "app/index.html"]
|
@@ -120,10 +142,12 @@ module Fastlane
|
|
120
142
|
# versionName、versionCode先从output.json文件里取
|
121
143
|
apk_output_json_path = File.join(File.dirname(build_file), "output.json")
|
122
144
|
if File.readable?(apk_output_json_path)
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
145
|
+
apk_output_content = File.read(apk_output_json_path)
|
146
|
+
version_number_regex = /"versionName":"(\d+\.\d+\.\d+)"/.match(apk_output_content)
|
147
|
+
build_number_regex = /"versionCode":(\d+)/.match(apk_output_content)
|
148
|
+
if !version_number_regex.nil? && !build_number_regex.nil?
|
149
|
+
version_number = version_number_regex.captures.first
|
150
|
+
build_number = build_number_regex.captures.first
|
127
151
|
end
|
128
152
|
end
|
129
153
|
# 如果output.json文件里取不到则从Actions.lane_context中取
|
@@ -169,6 +193,12 @@ module Fastlane
|
|
169
193
|
"build" => build_number,
|
170
194
|
"time" => timestamp.to_i
|
171
195
|
}
|
196
|
+
# Store the build_number, version_number, time, size
|
197
|
+
Actions.lane_context[SharedValues::ALIOSS_BUILD_NUMBER] = build_number
|
198
|
+
Actions.lane_context[SharedValues::ALIOSS_VERSION_NUMBER] = version_number
|
199
|
+
Actions.lane_context[SharedValues::ALIOSS_PUBLISH_TIMESTAMP] = timestamp.to_i
|
200
|
+
Actions.lane_context[SharedValues::ALIOSS_FILE_SIZE] = file_size
|
201
|
+
Actions.lane_context[SharedValues::ALIOSS_DOWNLOAD_URL] = "#{download_domain}#{path_for_app_name}/index.html"
|
172
202
|
|
173
203
|
# 根据不同的平台,将bucket_path记录到json中
|
174
204
|
case File.extname(filename)
|
@@ -176,7 +206,6 @@ module Fastlane
|
|
176
206
|
UI.message "配置 manifest.plist ..."
|
177
207
|
app_name = GetIpaInfoPlistValueAction.run(ipa: build_file, key: 'CFBundleDisplayName')
|
178
208
|
app_identifier = GetIpaInfoPlistValueAction.run(ipa: build_file, key: 'CFBundleIdentifier')
|
179
|
-
download_url = download_url
|
180
209
|
UI.message "app_name: #{app_name}"
|
181
210
|
UI.message "app_identifier: #{app_identifier}"
|
182
211
|
UI.message "version_number: #{version_number}"
|
@@ -243,6 +272,16 @@ module Fastlane
|
|
243
272
|
["woodwu"]
|
244
273
|
end
|
245
274
|
|
275
|
+
def self.output
|
276
|
+
[
|
277
|
+
['ALIOSS_BUILD_NUMBER', 'Update the new build number(version code) of your iOS/Android project'],
|
278
|
+
['ALIOSS_VERSION_NUMBER', 'Update the new version number(version name) of your iOS/Android project'],
|
279
|
+
['ALIOSS_PUBLISH_TIMESTAMP', 'The timestamp of auto-build'],
|
280
|
+
['ALIOSS_FILE_SIZE', 'The size of your ipa/apk file'],
|
281
|
+
['ALIOSS_DOWNLOAD_URL', 'The website url that you can download it']
|
282
|
+
]
|
283
|
+
end
|
284
|
+
|
246
285
|
def self.return_value
|
247
286
|
# If your method provides a return value, you can describe here what it does
|
248
287
|
end
|
@@ -319,7 +358,12 @@ module Fastlane
|
|
319
358
|
env_name: "ALIOSS_UPDATE_DESCRIPTION",
|
320
359
|
description: "设置app更新日志,描述你修改了哪些内容。",
|
321
360
|
optional: true,
|
322
|
-
type: String)
|
361
|
+
type: String),
|
362
|
+
FastlaneCore::ConfigItem.new(key: :list_buckets,
|
363
|
+
env_name: "ALIOSS_LIST_BUCKETS",
|
364
|
+
description: "是否列出已经上传的所有的buckets",
|
365
|
+
default_value: nil,
|
366
|
+
optional: true)
|
323
367
|
]
|
324
368
|
end
|
325
369
|
|
@@ -331,6 +375,23 @@ module Fastlane
|
|
331
375
|
true
|
332
376
|
end
|
333
377
|
|
378
|
+
def self.example_code
|
379
|
+
[
|
380
|
+
# 上传App到阿里云oss服务器
|
381
|
+
'alioss(
|
382
|
+
endpoint: "oss-cn-shenzhen.aliyuncs.com",
|
383
|
+
access_key_id: "xxxxx",
|
384
|
+
access_key_secret: "xxxxx",
|
385
|
+
bucket_name: "cn-app-test",
|
386
|
+
app_name: "app/appname",
|
387
|
+
download_domain: "https://dl.yourdomain.com/",
|
388
|
+
update_description: "update description",
|
389
|
+
ipa: "valid ipa path", # iOS project required
|
390
|
+
apk: "valid apk path" # Android project required
|
391
|
+
)'
|
392
|
+
]
|
393
|
+
end
|
394
|
+
|
334
395
|
def self.create_manifest_file(params)
|
335
396
|
# create manifest.plist file
|
336
397
|
manifest_file = File.new("manifest.plist", "w")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-alioss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- woodwu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
145
|
+
version: 0.7.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: 0.7.0
|
153
153
|
description:
|
154
154
|
email: woodwu@dotdotbuy.com
|
155
155
|
executables: []
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
|
-
rubygems_version: 3.
|
185
|
+
rubygems_version: 3.1.2
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: upload ipa/apk to aliyun oos server, and scan QRcode to install app on mobile
|