supply 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/supply/client.rb +17 -0
- data/lib/supply/uploader.rb +56 -3
- data/lib/supply/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c35292abbffd6e72b05753b44d20421d64277a77
|
4
|
+
data.tar.gz: 3d01830e5a7b445fbf3fa6048faa1140400e1b87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45213fa053b29bbcd62b51e1148017596e9111c4f4b7b774aab7579fba3c762f432e1b58be579f5d8373c81ec17bfd16d28fc2784c38137cc54c252d4145af47
|
7
|
+
data.tar.gz: 041a7d12da918735ea8873c1a8f1222b6e4371302f3de33fb6d871017a50e8d88a8ad7d1be8881c06231da0ede07b928c00073b1e1757873c216874e4e918e6c
|
data/README.md
CHANGED
@@ -128,6 +128,11 @@ To gradually roll out a new build use
|
|
128
128
|
supply --apk path/app.apk --track rollout --rollout 0.5
|
129
129
|
```
|
130
130
|
|
131
|
+
Expansion files (obbs) found under the same directory as your APK will also be uploaded together with your APK as long as:
|
132
|
+
|
133
|
+
- they are identified as type 'main' or 'patch' (by containing 'main' or 'patch' in their file name)
|
134
|
+
- you have at most one of each type
|
135
|
+
|
131
136
|
## Images and Screenshots
|
132
137
|
|
133
138
|
After running `supply init`, you will have a metadata directory. This directory contains one or more locale directories (e.g. en-US, en-GB, etc.), and inside this directory are text files such as `title.txt` and `short_description.txt`.
|
data/lib/supply/client.rb
CHANGED
@@ -22,6 +22,10 @@ module Supply
|
|
22
22
|
|
23
23
|
# instanciate a client given the supplied configuration
|
24
24
|
def self.make_from_config
|
25
|
+
unless Supply.config[:json_key] || (Supply.config[:key] && Supply.config[:issuer])
|
26
|
+
UI.user_error! "Missing auth credentials: You must specify either 'json_key' or 'key' and 'issuer'"
|
27
|
+
end
|
28
|
+
|
25
29
|
return Client.new(path_to_key: Supply.config[:key],
|
26
30
|
issuer: Supply.config[:issuer],
|
27
31
|
path_to_service_account_json: Supply.config[:json_key])
|
@@ -253,6 +257,19 @@ module Supply
|
|
253
257
|
image_type)
|
254
258
|
end
|
255
259
|
|
260
|
+
def upload_obb(obb_file_path: nil, apk_version_code: nil, expansion_file_type: nil)
|
261
|
+
ensure_active_edit!
|
262
|
+
|
263
|
+
android_publisher.upload_expansion_file(
|
264
|
+
current_package_name,
|
265
|
+
current_edit.id,
|
266
|
+
apk_version_code,
|
267
|
+
expansion_file_type,
|
268
|
+
upload_source: obb_file_path,
|
269
|
+
content_type: 'application/octet-stream'
|
270
|
+
)
|
271
|
+
end
|
272
|
+
|
256
273
|
private
|
257
274
|
|
258
275
|
def ensure_active_edit!
|
data/lib/supply/uploader.rb
CHANGED
@@ -85,9 +85,11 @@ module Supply
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def upload_binary
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
apk_path = Supply.config[:apk]
|
89
|
+
|
90
|
+
if apk_path
|
91
|
+
Helper.log.info "Preparing apk at path '#{apk_path}' for upload..."
|
92
|
+
apk_version_code = client.upload_apk(apk_path)
|
91
93
|
|
92
94
|
Helper.log.info "Updating track '#{Supply.config[:track]}'..."
|
93
95
|
if Supply.config[:track].eql? "rollout"
|
@@ -96,6 +98,8 @@ module Supply
|
|
96
98
|
client.update_track(Supply.config[:track], 1.0, apk_version_code)
|
97
99
|
end
|
98
100
|
|
101
|
+
upload_obbs(apk_path, apk_version_code)
|
102
|
+
|
99
103
|
if metadata_path
|
100
104
|
Dir.foreach(metadata_path) do |language|
|
101
105
|
next if language.start_with?('.') # e.g. . or .. or hidden folders
|
@@ -117,5 +121,54 @@ module Supply
|
|
117
121
|
def metadata_path
|
118
122
|
Supply.config[:metadata_path]
|
119
123
|
end
|
124
|
+
|
125
|
+
# searches for obbs in the directory where the apk is located and
|
126
|
+
# upload at most one main and one patch file. Do nothing if it finds
|
127
|
+
# more than one of either of them.
|
128
|
+
def upload_obbs(apk_path, apk_version_code)
|
129
|
+
expansion_paths = find_obbs(apk_path)
|
130
|
+
['main', 'patch'].each do |type|
|
131
|
+
if expansion_paths[type]
|
132
|
+
upload_obb(expansion_paths[type], type, apk_version_code)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# @return a map of the obb paths for that apk
|
138
|
+
# keyed by their detected expansion file type
|
139
|
+
# E.g.
|
140
|
+
# { 'main' => 'path/to/main.obb', 'patch' => 'path/to/patch.obb' }
|
141
|
+
def find_obbs(apk_path)
|
142
|
+
search = File.join(File.dirname(apk_path), '*.obb')
|
143
|
+
paths = Dir.glob(search, File::FNM_CASEFOLD)
|
144
|
+
expansion_paths = {}
|
145
|
+
paths.each do |path|
|
146
|
+
type = obb_expansion_file_type(path)
|
147
|
+
next unless type
|
148
|
+
if expansion_paths[type]
|
149
|
+
Helper.log.warn("Can only upload one '#{type}' apk expansion. Skipping obb upload entirely.")
|
150
|
+
Helper.log.warn("If you'd like this to work differently, please submit an issue.")
|
151
|
+
return {}
|
152
|
+
end
|
153
|
+
expansion_paths[type] = path
|
154
|
+
end
|
155
|
+
expansion_paths
|
156
|
+
end
|
157
|
+
|
158
|
+
def upload_obb(obb_path, expansion_file_type, apk_version_code)
|
159
|
+
Helper.log.info "Uploading obb file #{obb_path}..."
|
160
|
+
client.upload_obb(obb_file_path: obb_path,
|
161
|
+
apk_version_code: apk_version_code,
|
162
|
+
expansion_file_type: expansion_file_type)
|
163
|
+
end
|
164
|
+
|
165
|
+
def obb_expansion_file_type(obb_file_path)
|
166
|
+
filename = File.basename(obb_file_path, ".obb")
|
167
|
+
if filename.include?('main')
|
168
|
+
'main'
|
169
|
+
elsif filename.include?('patch')
|
170
|
+
'patch'
|
171
|
+
end
|
172
|
+
end
|
120
173
|
end
|
121
174
|
end
|
data/lib/supply/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: supply
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|