supply 0.5.3 → 0.6.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: eff55accd696bce7ea7f682dbe1f1201abaab960
4
- data.tar.gz: 6904059222901364058d75845490675f9a001df2
3
+ metadata.gz: dfce9589c181ae3e7fee0c3424ab0f3edcec5a79
4
+ data.tar.gz: 227bf608c6cf1d5971e2848de19718ee718496a0
5
5
  SHA512:
6
- metadata.gz: 8443859f5876dd6dd7bc1015f91ab49a96cc0c96a28045e5ff4402be07b6fb3d77e4385b94551df679b8506994760274331c52a80aa3b208a99c5ca64dee35e1
7
- data.tar.gz: 9d879c1ae4f98e4a119970306277f807d5d3cf38a7312f8e1401ab8ac09353da6b52967299031d4f3afad94af87e483865c434be9cde9ee36e002c3805d087e2
6
+ metadata.gz: 8ea1590b53f11f6eceb347ffa3ebe45f0828d255b4dc94bece5e9392dd5b326160feffb4bdcc62f50302a265a67b221eabd98205b809c1b6553ddfa4889fd52f
7
+ data.tar.gz: 55f81de2d3654faf784bbe9ffa835753fb4576a0cdc0a058909596a4b916c84a33f2eabf595ab715e5b14884495928c570d9dc00693b71a05618f0c5f5436011
data/README.md CHANGED
@@ -76,13 +76,11 @@ Setup consists of setting up your Google Developers Service Account
76
76
  - Open the [Google Play Console](https://play.google.com/apps/publish/)
77
77
  - Select **Settings** tab, followed by the **API access** tab
78
78
  - Click the **Create Service Account** button and follow the **Google Developers Console** link in the dialog
79
- - Click **Add credentials** and select **Service account**
79
+ - Click **Create credentials** and select **Service account**
80
80
  - Select **JSON** as the Key type and click **Create**
81
81
  - Make a note of the file name of the JSON file downloaded to your computer, and close the dialog
82
- - Make a note of the **Email address** under **Service accounts** - this is the user which you will need later
83
82
  - Back on the Google Play developer console, click **Done** to close the dialog
84
83
  - Click on **Grant Access** for the newly added service account
85
- - In the **Invite a New User** dialog, paste the service account email address you noted earlier into the **Email address** field
86
84
  - Choose **Release Manager** from the **Role** dropdown and click **Send Invitation** to close the dialog
87
85
 
88
86
  ### Migrating Google credential format (from .p12 key file to .json)
data/lib/supply/client.rb CHANGED
@@ -193,13 +193,16 @@ module Supply
193
193
  return result_upload.version_code
194
194
  end
195
195
 
196
+ # Updates the track for the provided version code(s)
196
197
  def update_track(track, rollout, apk_version_code)
197
198
  ensure_active_edit!
198
199
 
200
+ track_version_codes = apk_version_code.kind_of?(Array) ? apk_version_code : [apk_version_code]
201
+
199
202
  track_body = Androidpublisher::Track.new({
200
203
  track: track,
201
204
  user_fraction: rollout,
202
- version_codes: [apk_version_code]
205
+ version_codes: track_version_codes
203
206
  })
204
207
 
205
208
  android_publisher.update_track(
@@ -67,11 +67,26 @@ module Supply
67
67
  env_name: "SUPPLY_APK",
68
68
  description: "Path to the APK file to upload",
69
69
  short_option: "-b",
70
+ conflicting_options: [:apk_paths],
70
71
  default_value: Dir["*.apk"].last || Dir[File.join("app", "build", "outputs", "apk", "app-Release.apk")].last,
71
72
  optional: true,
72
73
  verify_block: proc do |value|
73
74
  UI.user_error! "Could not find apk file at path '#{value}'" unless File.exist?(value)
74
- UI.user_error! "apk file is not an apk" unless value.end_with?(value)
75
+ UI.user_error! "apk file is not an apk" unless value.end_with?('.apk')
76
+ end),
77
+ FastlaneCore::ConfigItem.new(key: :apk_paths,
78
+ env_name: "SUPPLY_APK_PATHS",
79
+ conflicting_options: [:apk],
80
+ optional: true,
81
+ type: Array,
82
+ description: "An array of paths to APK files to upload",
83
+ short_option: "-u",
84
+ verify_block: proc do |value|
85
+ UI.user_error!("Could not evaluate array from '#{value}'") unless value.kind_of?(Array)
86
+ value.each do |path|
87
+ UI.user_error! "Could not find apk file at path '#{path}'" unless File.exist?(path)
88
+ UI.user_error! "file at path '#{path}' is not an apk" unless path.end_with?('.apk')
89
+ end
75
90
  end),
76
91
  FastlaneCore::ConfigItem.new(key: :skip_upload_apk,
77
92
  env_name: "SUPPLY_SKIP_UPLOAD_APK",
@@ -5,7 +5,7 @@ module Supply
5
5
 
6
6
  client.begin_edit(package_name: Supply.config[:package_name])
7
7
 
8
- UI.user_error!("No local metadata found, make sure to run `supply init` to setup supply") unless metadata_path || Supply.config[:apk]
8
+ UI.user_error!("No local metadata found, make sure to run `supply init` to setup supply") unless metadata_path || Supply.config[:apk] || Supply.config[:apk_paths]
9
9
 
10
10
  if metadata_path
11
11
  UI.user_error!("Could not find folder #{metadata_path}") unless File.directory? metadata_path
@@ -23,7 +23,7 @@ module Supply
23
23
  end
24
24
  end
25
25
 
26
- upload_binary unless Supply.config[:skip_upload_apk]
26
+ upload_binaries unless Supply.config[:skip_upload_apk]
27
27
 
28
28
  UI.message("Uploading all changes to Google Play...")
29
29
  client.commit_current_edit!
@@ -88,19 +88,33 @@ module Supply
88
88
  end
89
89
  end
90
90
 
91
- def upload_binary
92
- apk_path = Supply.config[:apk]
91
+ def upload_binaries
92
+ apk_paths = [Supply.config[:apk]] unless (apk_paths = Supply.config[:apk_paths])
93
93
 
94
+ apk_version_codes = []
95
+
96
+ apk_paths.each do |apk_path|
97
+ apk_version_codes.push(upload_binary_data(apk_path))
98
+ end
99
+
100
+ update_track(apk_version_codes)
101
+ end
102
+
103
+ private
104
+
105
+ ##
106
+ # Upload binary apk and obb and corresponding change logs with client
107
+ #
108
+ # @param [String] apk_path
109
+ # Path of the apk file to upload.
110
+ #
111
+ # @return [Integer] The apk version code returned after uploading, or nil if there was a problem
112
+ def upload_binary_data(apk_path)
113
+ apk_version_code = nil
94
114
  if apk_path
95
115
  UI.message("Preparing apk at path '#{apk_path}' for upload...")
96
116
  apk_version_code = client.upload_apk(apk_path)
97
-
98
- UI.message("Updating track '#{Supply.config[:track]}'...")
99
- if Supply.config[:track].eql? "rollout"
100
- client.update_track(Supply.config[:track], Supply.config[:rollout], apk_version_code)
101
- else
102
- client.update_track(Supply.config[:track], 1.0, apk_version_code)
103
- end
117
+ UI.user_error!("Could not upload #{apk_path}") unless apk_version_code
104
118
 
105
119
  upload_obbs(apk_path, apk_version_code)
106
120
 
@@ -110,13 +124,20 @@ module Supply
110
124
  upload_changelog(language, apk_version_code)
111
125
  end
112
126
  end
113
-
114
127
  else
115
128
  UI.message("No apk file found, you can pass the path to your apk using the `apk` option")
116
129
  end
130
+ apk_version_code
117
131
  end
118
132
 
119
- private
133
+ def update_track(apk_version_codes)
134
+ UI.message("Updating track '#{Supply.config[:track]}'...")
135
+ if Supply.config[:track].eql? "rollout"
136
+ client.update_track(Supply.config[:track], Supply.config[:rollout], apk_version_code)
137
+ else
138
+ client.update_track(Supply.config[:track], 1.0, apk_version_codes)
139
+ end
140
+ end
120
141
 
121
142
  def all_languages
122
143
  Dir.foreach(metadata_path).sort { |x, y| x <=> y }
@@ -1,4 +1,4 @@
1
1
  module Supply
2
- VERSION = "0.5.3".freeze
2
+ VERSION = "0.6.0".freeze
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.5.3
4
+ version: 0.6.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-03-29 00:00:00.000000000 Z
11
+ date: 2016-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client