supply 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 029fc80fc088a11de8e2f81af99fa093f09226ab
4
- data.tar.gz: 2cb65207742a207031154ce342961d7ccbe75455
3
+ metadata.gz: 4f83fc4e36d718344106107075628c0ec7d2132e
4
+ data.tar.gz: 2c2be0e69074bf70feabbef9088e19cbdb0bbd13
5
5
  SHA512:
6
- metadata.gz: 365022aa3a2c6b8142c26ea217d88c8a5aaa3ad7f19aa6d8fd2537db6e31a9677617f67c061377e8cc3ecf50bfd75aef4dffaef93b33eae86cb8f4d65e2b5f46
7
- data.tar.gz: b607b543b3be473199120fdb4b293161ca49b34480c74f2a026d43083fd0089af4b35c321b5f8da9d6663f0911f80b332f848702c3f294139d9dcc227c07d5e5
6
+ metadata.gz: 00b5fb9d566f858423e3a82e2f257f85a1cb3bb1436f8f4f6e94a1c9dd54315f15d658ed8e3358e24684756c826d968bee7668e1c61b4ac995c9170b5f797cc7
7
+ data.tar.gz: 88439d20a9115470efac14d99bb5da5cbcfadc7a2cebc66f20f847972cc290c9c71156752f8467fecc9e6a7dfc0abf4113f4ae3b9b4afe31adc1c5cd56fe6c9b
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <a href="https://github.com/fastlane/deliver">deliver</a> &bull;
10
10
  <a href="https://github.com/fastlane/snapshot">snapshot</a> &bull;
11
11
  <a href="https://github.com/fastlane/frameit">frameit</a> &bull;
12
- <a href="https://github.com/fastlane/PEM">PEM</a> &bull;
12
+ <a href="https://github.com/fastlane/pem">pem</a> &bull;
13
13
  <a href="https://github.com/fastlane/sigh">sigh</a> &bull;
14
14
  <a href="https://github.com/fastlane/produce">produce</a> &bull;
15
15
  <a href="https://github.com/fastlane/cert">cert</a> &bull;
@@ -17,7 +17,8 @@
17
17
  <a href="https://github.com/fastlane/pilot">pilot</a> &bull;
18
18
  <a href="https://github.com/fastlane/boarding">boarding</a> &bull;
19
19
  <a href="https://github.com/fastlane/gym">gym</a> &bull;
20
- <a href="https://github.com/fastlane/scan">scan</a>
20
+ <a href="https://github.com/fastlane/scan">scan</a> &bull;
21
+ <a href="https://github.com/fastlane/match">match</a>
21
22
  </p>
22
23
  -------
23
24
 
@@ -68,17 +69,19 @@ Install the gem
68
69
 
69
70
  sudo gem install supply
70
71
 
71
- ## Setup
72
+ ## Setup a Google Developers Service Account
72
73
 
73
74
  - Open the [Google Play Console](https://play.google.com/apps/publish/)
74
- - Open _Settings => API-Access_
75
- - Create a new Service Account - follow the link of the dialog
76
- - Create new Client ID
77
- - Select _Service Account_
78
- - Click _Generate new P12 key_ and store the downloaded file
79
- - Make a note of the _Email address_ underneath _Service account_ - this is the issuer which you will need later
80
- - Back on the Google Play developer console, click on _Grant Access_ for the newly added service account
81
- - Choose _Release Manager_ from the dropdown and confirm
75
+ - Select **Settings** tab, followed by the **API access** tab
76
+ - Click the **Create Service Account** button and follow the **Google Developers Console** link in the dialog
77
+ - Click **Add credentials** and select **Service account**
78
+ - Select **P12** as the Key type and click **Create**
79
+ - Make a note of the file name of the P12 file downloaded to your computer, and close the dialog
80
+ - Make a note of the **Email address** under **Service accounts** - this is the issuer which you will need later
81
+ - Back on the Google Play developer console, click **Done** to close the dialog
82
+ - Click on **Grant Access** for the newly added service account
83
+ - In the **Invite a New User** dialog, paste the service account email address you noted earlier into the **Email address** field
84
+ - Choose **Release Manager** from the **Role** dropdown and click **Send Invitation** to close the dialog
82
85
 
83
86
  ## Quick Start
84
87
 
@@ -128,9 +131,27 @@ And you can supply screenshots by creating directories with the following names,
128
131
  - `sevenInchScreenshots/` (7-inch tablets)
129
132
  - `tenInchScreenshots/` (10-inch tablets)
130
133
  - `tvScreenshots/`
134
+ - `wearScreenshots/`
131
135
 
132
136
  Note that these will replace the current images and screenshots on the play store listing, not add to them.
133
137
 
138
+ ## Changelogs (What's new)
139
+
140
+ You can add changelog files under the `changelogs/` directory for each locale. The filename should exactly match the version code of the APK that it represents. `supply init` will populate changelog files from existing data on Google Play if no `metadata/` directory exists when it is run.
141
+
142
+ ```
143
+ └── fastlane
144
+ └── metadata
145
+ └── android
146
+ ├── en-US
147
+ │ └── changelogs
148
+ │ ├── 100000.txt
149
+ │ └── 100100.txt
150
+ └── fr-FR
151
+ └── changelogs
152
+ └── 100100.txt
153
+ ```
154
+
134
155
  ## Tips
135
156
 
136
157
  ### [`fastlane`](https://fastlane.tools) Toolchain
@@ -139,7 +160,7 @@ Note that these will replace the current images and screenshots on the play stor
139
160
  - [`deliver`](https://github.com/fastlane/deliver): Upload screenshots, metadata and your app to the App Store
140
161
  - [`snapshot`](https://github.com/fastlane/snapshot): Automate taking localized screenshots of your iOS app on every device
141
162
  - [`frameit`](https://github.com/fastlane/frameit): Quickly put your screenshots into the right device frames
142
- - [`PEM`](https://github.com/fastlane/PEM): Automatically generate and renew your push notification profiles
163
+ - [`pem`](https://github.com/fastlane/pem): Automatically generate and renew your push notification profiles
143
164
  - [`sigh`](https://github.com/fastlane/sigh): Because you would rather spend your time building stuff than fighting provisioning
144
165
  - [`produce`](https://github.com/fastlane/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
145
166
  - [`cert`](https://github.com/fastlane/cert): Automatically create and maintain iOS code signing certificates
@@ -148,6 +169,7 @@ Note that these will replace the current images and screenshots on the play stor
148
169
  - [`pilot`](https://github.com/fastlane/pilot): The best way to manage your TestFlight testers and builds from your terminal
149
170
  - [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
150
171
  - [`gym`](https://github.com/fastlane/gym): Building your iOS apps has never been easier
172
+ - [`match`](https://github.com/fastlane/match): Easily sync your certificates and profiles across your team using git
151
173
 
152
174
  ##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
153
175
 
data/lib/supply.rb CHANGED
@@ -3,6 +3,7 @@ require 'supply/version'
3
3
  require 'supply/options'
4
4
  require 'supply/client'
5
5
  require 'supply/listing'
6
+ require 'supply/apk_listing'
6
7
  require 'supply/uploader'
7
8
 
8
9
  require 'fastlane_core'
@@ -20,5 +21,8 @@ module Supply
20
21
  IMAGES_FOLDER_NAME = "images"
21
22
  IMAGE_FILE_EXTENSIONS = "{png,jpg,jpeg}"
22
23
 
24
+ CHANGELOGS_FOLDER_NAME = "changelogs"
25
+
23
26
  Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
27
+ UI = FastlaneCore::UI
24
28
  end
@@ -0,0 +1,14 @@
1
+ module Supply
2
+ class ApkListing
3
+ attr_accessor :recent_changes
4
+ attr_accessor :language
5
+ attr_accessor :apk_version_code
6
+
7
+ # Initializes the apk listing with the current listing if available
8
+ def initialize(recent_changes, language, apk_version_code)
9
+ self.recent_changes = recent_changes
10
+ self.language = language
11
+ self.apk_version_code = apk_version_code
12
+ end
13
+ end
14
+ end
data/lib/supply/client.rb CHANGED
@@ -161,6 +161,45 @@ module Supply
161
161
  end
162
162
  end
163
163
 
164
+ # Get a list of all apks verion codes - returns the list of version codes
165
+ def apks_version_codes
166
+ ensure_active_edit!
167
+
168
+ result = api_client.execute(
169
+ api_method: android_publisher.edits.apks.list,
170
+ parameters: {
171
+ 'editId' => current_edit.data.id,
172
+ 'packageName' => current_package_name
173
+ },
174
+ authorization: auth_client
175
+ )
176
+
177
+ raise result.error_message.red if result.error? && result.status != 404
178
+
179
+ return result.data.apks.collect(&:versionCode)
180
+ end
181
+
182
+ # Get a list of all apk listings (changelogs) - returns the list
183
+ def apk_listings(apk_version_code)
184
+ ensure_active_edit!
185
+
186
+ result = api_client.execute(
187
+ api_method: android_publisher.edits.apklistings.list,
188
+ parameters: {
189
+ 'apkVersionCode' => apk_version_code,
190
+ 'editId' => current_edit.data.id,
191
+ 'packageName' => current_package_name
192
+ },
193
+ authorization: auth_client
194
+ )
195
+
196
+ raise result.error_message.red if result.error? && result.status != 404
197
+
198
+ return result.data.listings.collect do |row|
199
+ ApkListing.new(row.recentChanges, row.language, apk_version_code)
200
+ end
201
+ end
202
+
164
203
  #####################################################
165
204
  # @!group Modifying data
166
205
  #####################################################
@@ -190,11 +229,7 @@ module Supply
190
229
  raise result.error_message.red if result.error?
191
230
  end
192
231
 
193
- def upload_apk_to_track(path_to_apk, track)
194
- upload_apk_to_track_with_rollout(path_to_apk, track, 1.0)
195
- end
196
-
197
- def upload_apk_to_track_with_rollout(path_to_apk, track, rollout)
232
+ def upload_apk(path_to_apk)
198
233
  ensure_active_edit!
199
234
 
200
235
  apk = Google::APIClient::UploadIO.new(File.expand_path(path_to_apk), 'application/vnd.android.package-archive')
@@ -211,10 +246,16 @@ module Supply
211
246
 
212
247
  raise result_upload.error_message.red if result_upload.error?
213
248
 
249
+ return result_upload.data.versionCode
250
+ end
251
+
252
+ def update_track(track, rollout, apk_version_code)
253
+ ensure_active_edit!
254
+
214
255
  track_body = {
215
256
  'track' => track,
216
257
  'userFraction' => rollout,
217
- 'versionCodes' => [result_upload.data.versionCode]
258
+ 'versionCodes' => [apk_version_code]
218
259
  }
219
260
 
220
261
  result_update = api_client.execute(
@@ -231,6 +272,28 @@ module Supply
231
272
  raise result_update.error_message.red if result_update.error?
232
273
  end
233
274
 
275
+ def update_apk_listing_for_language(apk_listing)
276
+ ensure_active_edit!
277
+
278
+ body_object = {
279
+ 'language' => apk_listing.language,
280
+ 'recentChanges' => apk_listing.recent_changes
281
+ }
282
+
283
+ result = api_client.execute(
284
+ api_method: android_publisher.edits.apklistings.update,
285
+ parameters: {
286
+ 'apkVersionCode' => apk_listing.apk_version_code,
287
+ 'editId' => current_edit.data.id,
288
+ 'packageName' => current_package_name,
289
+ 'language' => apk_listing.language
290
+ },
291
+ body_object: body_object,
292
+ authorization: auth_client
293
+ )
294
+ raise result.error_message.red if result.error?
295
+ end
296
+
234
297
  #####################################################
235
298
  # @!group Screenshots
236
299
  #####################################################
@@ -58,7 +58,31 @@ module Supply
58
58
  verify_block: proc do |value|
59
59
  raise "Could not find apk file at path '#{value}'".red unless File.exist?(value)
60
60
  raise "apk file is not an apk".red unless value.end_with?(value)
61
- end)
61
+ end),
62
+ FastlaneCore::ConfigItem.new(key: :skip_upload_apk,
63
+ env_name: "SUPPLY_SKIP_UPLOAD_APK",
64
+ optional: true,
65
+ description: "Whether to skip uploading APK",
66
+ is_string: false,
67
+ default_value: false),
68
+ FastlaneCore::ConfigItem.new(key: :skip_upload_metadata,
69
+ env_name: "SUPPLY_SKIP_UPLOAD_METADATA",
70
+ optional: true,
71
+ description: "Whether to skip uploading metadata",
72
+ is_string: false,
73
+ default_value: false),
74
+ FastlaneCore::ConfigItem.new(key: :skip_upload_images,
75
+ env_name: "SUPPLY_SKIP_UPLOAD_IMAGES",
76
+ optional: true,
77
+ description: "Whether to skip uploading images, screenshots not included",
78
+ is_string: false,
79
+ default_value: false),
80
+ FastlaneCore::ConfigItem.new(key: :skip_upload_screenshots,
81
+ env_name: "SUPPLY_SKIP_UPLOAD_SCREENSHOTS",
82
+ optional: true,
83
+ description: "Whether to skip uploading SCREENSHOTS",
84
+ is_string: false,
85
+ default_value: false)
62
86
  ]
63
87
  end
64
88
  end
data/lib/supply/setup.rb CHANGED
@@ -14,6 +14,12 @@ module Supply
14
14
  download_images(listing)
15
15
  end
16
16
 
17
+ client.apks_version_codes.each do |apk_version_code|
18
+ client.apk_listings(apk_version_code).each do |apk_listing|
19
+ store_apk_listing(apk_listing)
20
+ end
21
+ end
22
+
17
23
  client.abort_current_edit
18
24
 
19
25
  Helper.log.info "Successfully stored metadata in '#{metadata_path}'".green
@@ -64,6 +70,17 @@ module Supply
64
70
  Helper.log.info "Due to the limit of the Google Play API `supply` can't download your existing screenshots..."
65
71
  end
66
72
 
73
+ def store_apk_listing(apk_listing)
74
+ containing = File.join(metadata_path, apk_listing.language, CHANGELOGS_FOLDER_NAME)
75
+ unless File.exist?(containing)
76
+ FileUtils.mkdir_p(containing)
77
+ end
78
+
79
+ path = File.join(containing, "#{apk_listing.apk_version_code}.txt")
80
+ Helper.log.info "Writing to #{path}..."
81
+ File.write(path, apk_listing.recent_changes)
82
+ end
83
+
67
84
  private
68
85
 
69
86
  def metadata_path
@@ -1,7 +1,7 @@
1
1
  module Supply
2
2
  class Uploader
3
3
  def perform_upload
4
- FastlaneCore::PrintTable.print_values(config: Supply.config, hide_keys: [:issuer], title: "Summary for sigh #{Supply::VERSION}")
4
+ FastlaneCore::PrintTable.print_values(config: Supply.config, hide_keys: [:issuer], title: "Summary for supply #{Supply::VERSION}")
5
5
 
6
6
  client.begin_edit(package_name: Supply.config[:package_name])
7
7
 
@@ -13,13 +13,13 @@ module Supply
13
13
 
14
14
  listing = client.listing_for_language(language)
15
15
 
16
- upload_metadata(language, listing)
17
- upload_images(language)
18
- upload_screenshots(language)
16
+ upload_metadata(language, listing) unless Supply.config[:skip_upload_metadata]
17
+ upload_images(language) unless Supply.config[:skip_upload_images]
18
+ upload_screenshots(language) unless Supply.config[:skip_upload_screenshots]
19
19
  end
20
20
  end
21
21
 
22
- upload_binary
22
+ upload_binary unless Supply.config[:skip_upload_apk]
23
23
 
24
24
  Helper.log.info "Uploading all changes to Google Play..."
25
25
  client.commit_current_edit!
@@ -69,11 +69,28 @@ module Supply
69
69
  def upload_binary
70
70
  if Supply.config[:apk]
71
71
  Helper.log.info "Preparing apk at path '#{Supply.config[:apk]}' for upload..."
72
+ apk_version_code = client.upload_apk(Supply.config[:apk])
73
+
74
+ Helper.log.info "Updating track '#{Supply.config[:track]}'..."
72
75
  if Supply.config[:track].eql? "rollout"
73
- client.upload_apk_to_track_with_rollout(Supply.config[:apk], Supply.config[:track], Supply.config[:rollout])
76
+ client.update_track(Supply.config[:track], Supply.config[:rollout], apk_version_code)
74
77
  else
75
- client.upload_apk_to_track(Supply.config[:apk], Supply.config[:track])
78
+ client.update_track(Supply.config[:track], 1.0, apk_version_code)
79
+ end
80
+
81
+ if metadata_path
82
+ Dir.foreach(metadata_path) do |language|
83
+ next if language.start_with?('.') # e.g. . or .. or hidden folders
84
+
85
+ path = File.join(metadata_path, language, Supply::CHANGELOGS_FOLDER_NAME, "#{apk_version_code}.txt")
86
+ if File.exist?(path)
87
+ Helper.log.info "Updating changelog for code version '#{apk_version_code}' and language '#{language}'..."
88
+ apk_listing = ApkListing.new(File.read(path), language, apk_version_code)
89
+ client.update_apk_listing_for_language(apk_listing)
90
+ end
91
+ end
76
92
  end
93
+
77
94
  else
78
95
  Helper.log.info "No apk file found, you can pass the path to your apk using the `apk` option"
79
96
  end
@@ -1,4 +1,4 @@
1
1
  module Supply
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  DESCRIPTION = "Command line tool for updating Android apps and their metadata on the Google Play Store"
4
4
  end
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.2.2
4
+ version: 0.3.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: 2015-11-16 00:00:00.000000000 Z
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.19.0
33
+ version: 0.30.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.19.0
40
+ version: 0.30.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: credentials_manager
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -191,6 +191,7 @@ files:
191
191
  - README.md
192
192
  - bin/supply
193
193
  - lib/supply.rb
194
+ - lib/supply/apk_listing.rb
194
195
  - lib/supply/client.rb
195
196
  - lib/supply/commands_generator.rb
196
197
  - lib/supply/listing.rb
@@ -218,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
219
  version: '0'
219
220
  requirements: []
220
221
  rubyforge_project:
221
- rubygems_version: 2.4.0
222
+ rubygems_version: 2.2.2
222
223
  signing_key:
223
224
  specification_version: 4
224
225
  summary: Command line tool for updating Android apps and their metadata on the Google