deliver 0.10.0 → 0.11.0

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
  SHA1:
3
- metadata.gz: 2a3a8eed44f8084c64b1f4947a3e5c6158fb0582
4
- data.tar.gz: 0d6a5d848a43ccac5c447a8f0f5b627615a4953d
3
+ metadata.gz: 6827a727bec1ffe3eb9e9aa53db1f744ce70037c
4
+ data.tar.gz: 861e402152acd6b7153cb4cfb0001167575ebfc1
5
5
  SHA512:
6
- metadata.gz: 405185ddfcf48f78757938756dc8391dfa484a88b613629a4c4fa5d9035555583bcfe6deb7307c5907303378e8883a749c8a39e2a72e1d87808efad846fb9f78
7
- data.tar.gz: 9b20f456befe9309d76efe6d88c884264c51f6cc58fbf957775f2dc4a298948d56268e3f2430016b7c83e432de18d0fda2d2c30ab06efc770c045dbfcf5b9150
6
+ metadata.gz: b6451cbde937213b378b598c63085fcac77e6f24210e75fc93c6eba5a01c66eb3ddb69c0e1297207df99f4e5522325af1f668f3d927cb4b8c30bb5a8c515efbc
7
+ data.tar.gz: 9f4fc188af8db6f38c39de3f077a256b496604e0d2614a8d2dbb8375b7210f52b7693bc3bb7bc137685ca8bd8c08c04725172a3b5845ab93bfbf1956d7be941f
data/README.md CHANGED
@@ -290,13 +290,13 @@ This project is well documented, check it out on [Rubydoc](http://www.rubydoc.in
290
290
 
291
291
  # Credentials
292
292
 
293
- A detailed description about your credentials is available on a [separate repo](https://github.com/KrauseFx/CredentialsManager).
293
+ A detailed description about your credentials is available on a [separate repo](https://github.com/fastlane/CredentialsManager).
294
294
 
295
295
 
296
296
  # Can I trust `deliver`?
297
297
  ###How does this thing even work? Is magic involved? 🎩###
298
298
 
299
- `deliver` is fully open source, you can take a look at its source files. It will only modify the content you want to modify using the ```Deliverfile```. Your password will be stored in the Mac OS X keychain, but can also be passed using environment variables.
299
+ `deliver` is fully open source, you can take a look at its source files. It will only modify the content you want to modify using the ```Deliverfile```. Your password will be stored in the Mac OS X keychain, but can also be passed using environment variables. (More information available on [CredentialsManager](https://github.com/fastlane/CredentialsManager))
300
300
 
301
301
  Before actually uploading anything to iTunes, ```deliver``` will generate a [PDF summary](https://github.com/krausefx/deliver/blob/master/assets/PDFExample.png?raw=1) of the collected data.
302
302
 
@@ -323,7 +323,7 @@ Before actually uploading anything to iTunes, ```deliver``` will generate a [PDF
323
323
 
324
324
  ## Available language codes
325
325
  ```ruby
326
- ["da-DK", "de-DE", "el-GR", "en-AU", "en-CA", "en-GB", "en-US", "es-ES", "es-MX", "fi-FI", "fr-CA", "fr-FR", "id-ID", "it-IT", "ja-JP", "ko-KR", "ms-MY", "nl-NL", "no-NO", "pt-BR", "pt-PT", "ru-RU", "sv-SE", "th-TH", "tr-TR", "vi-VI", "cmn-Hans", "zh_CN", "cmn-Hant"]
326
+ ["da-DK", "de-DE", "el-GR", "en-AU", "en-CA", "en-GB", "en-US", "es-ES", "es-MX", "fi-FI", "fr-CA", "fr-FR", "id-ID", "it-IT", "ja-JP", "ko-KR", "ms-MY", "nl-NL", "no-NO", "pt-BR", "pt-PT", "ru-RU", "sv-SE", "th-TH", "tr-TR", "vi-VI", "cmn-Hans", "cmn-Hant"]
327
327
  ```
328
328
 
329
329
  ## Use a clean status bar
@@ -28,7 +28,21 @@ class FastlaneApplication
28
28
  c.syntax = 'deliver'
29
29
  c.description = 'Run a deploy process using the Deliverfile in the current folder'
30
30
  c.action do |args, options|
31
- path = (Deliver::Helper.fastlane_enabled?? './fastlane' : '.')
31
+ run_deliver(options)
32
+ end
33
+ end
34
+
35
+ command :upload_metadata do |c|
36
+ c.syntax = 'deliver upload_metadata'
37
+ c.description = "Uploads new app metadata only. No binary will be uploaded"
38
+ c.action do |args, options|
39
+ ENV["DELIVER_SKIP_BINARY"] = "1"
40
+ run_deliver(options)
41
+ end
42
+ end
43
+
44
+ def run_deliver(options)
45
+ path = (Deliver::Helper.fastlane_enabled?? './fastlane' : '.')
32
46
  Dir.chdir(path) do # switch the context
33
47
  if File.exists?(deliver_path)
34
48
  # Everything looks alright, use the given Deliverfile
@@ -41,7 +55,6 @@ class FastlaneApplication
41
55
  end
42
56
  end
43
57
  end
44
- end
45
58
  end
46
59
 
47
60
  command :init do |c|
@@ -101,7 +101,9 @@ module Deliver
101
101
  #
102
102
  # This will also clear all existing screenshots before setting the new ones.
103
103
  # @param (Hash) hash A hash containing a different path for each locale ({FastlaneCore::Languages::ALL_LANGUAGES})
104
- def set_screenshots_for_each_language(hash)
104
+ # @param (Bool) Use the framed screenshots? Only use it if you use frameit 2.0
105
+
106
+ def set_screenshots_for_each_language(hash, use_framed = false)
105
107
  raise AppMetadataParameterError.new("Parameter needs to be an hash, containg strings with the new description") unless hash.kind_of?Hash
106
108
 
107
109
  hash.each do |language, current_path|
@@ -117,7 +119,11 @@ module Deliver
117
119
  self.clear_all_screenshots(language)
118
120
 
119
121
  Dir.glob(resulting_path, File::FNM_CASEFOLD).sort.each do |path|
120
- next if path.include?"_framed."
122
+ if use_framed
123
+ next unless path.include?"_framed."
124
+ else
125
+ next if path.include?"_framed."
126
+ end
121
127
 
122
128
  begin
123
129
  add_screenshot(language, Deliver::AppScreenshot.new(path))
@@ -134,7 +140,8 @@ module Deliver
134
140
  # This method will run through all the available locales, check if there is
135
141
  # a folder for this language (e.g. 'en-US') and use all screenshots in there
136
142
  # @param (String) path A path to the folder, which contains a folder for each locale
137
- def set_all_screenshots_from_path(path)
143
+ # @param (Bool) Use the framed screenshots? Only use it if you use frameit 2.0
144
+ def set_all_screenshots_from_path(path, use_framed = false)
138
145
  raise AppMetadataParameterError.new("Parameter needs to be a path (string)") unless path.kind_of?String
139
146
 
140
147
  found = false
@@ -144,7 +151,7 @@ module Deliver
144
151
  found = true
145
152
  set_screenshots_for_each_language({
146
153
  language => full_path
147
- })
154
+ }, use_framed)
148
155
  end
149
156
  end
150
157
  return found
@@ -26,33 +26,36 @@ module Deliver
26
26
 
27
27
  def run
28
28
  begin
29
- run_unit_tests
30
- fetch_information_from_ipa_file
31
-
32
- verify_ipa_file
33
-
34
- Helper.log.info("Got all information needed to deploy a new update ('#{@app_version}') for app '#{@app_identifier}'")
29
+ unless metadata_only?
30
+ run_unit_tests
31
+ fetch_app_key_information
32
+ fetch_information_from_ipa_file
35
33
 
34
+ @app_version ||= get_latest_version
35
+ verify_ipa_file
36
+ else
37
+ fetch_app_key_information
38
+ @app_identifier ||= ask("App Identifier (e.g. com.krausefx.app): ")
39
+ @app_version ||= get_latest_version || ask("Which version number should be updated? ")
40
+ end
36
41
  create_app
37
- verify_app_on_itunesconnect
38
-
39
- unless is_beta_build?
40
- # App Metdata will not be updated for beta builds
41
42
 
42
- load_metadata_from_config_json_folder # the json file generated from the quick start # deprecated
43
- load_metadata_folder # this is the new way of defining app metadata
44
- set_app_metadata
45
- set_screenshots
43
+ Helper.log.info("Got all information needed to deploy a new update ('#{@app_version}') for app '#{@app_identifier}'")
46
44
 
47
- verify_pdf_file
45
+ verify_app_on_itunesconnect unless metadata_only?
48
46
 
49
- additional_itc_information # e.g. copyright, age rating
47
+ if ready_for_sale?
48
+ raise "Cannot update metadata of apps 'Ready for Sale'. You can dupe: http://www.openradar.appspot.com/18263306".red
49
+ end
50
50
 
51
- trigger_metadata_upload
51
+ if is_beta_build?
52
+ Helper.log.info "Beta builds don't upload new metadata to iTunesConnet".yellow
53
+ else
54
+ upload_metadata
52
55
  end
53
56
 
54
57
  # Always upload a new ipa (except if none was given)
55
- trigger_ipa_upload
58
+ trigger_ipa_upload unless metadata_only?
56
59
 
57
60
  call_success_block
58
61
  rescue => ex
@@ -60,6 +63,53 @@ module Deliver
60
63
  end
61
64
  end
62
65
 
66
+ def upload_metadata
67
+ load_metadata_from_config_json_folder # the json file generated from the quick start # deprecated
68
+ load_metadata_folder # this is the new way of defining app metadata
69
+ set_app_metadata
70
+ set_screenshots
71
+
72
+ verify_pdf_file
73
+
74
+ additional_itc_information # e.g. copyright, age rating
75
+
76
+ trigger_metadata_upload
77
+ end
78
+
79
+ #####################################################
80
+ # @!group What kind of release
81
+ #####################################################
82
+
83
+ # Deployment = Submission of the binary
84
+ def skip_deployment?
85
+ @deploy_information[Deliverer::ValKey::SKIP_DEPLOY]
86
+ end
87
+
88
+ # Release = App Store and not TestFlight
89
+ def is_release_build?
90
+ is_beta_build? == false
91
+ end
92
+
93
+ # TestFlight Buil
94
+ def is_beta_build?
95
+ @deploy_information[Deliverer::ValKey::IS_BETA_IPA]
96
+ end
97
+
98
+ # Only upload metadata and no binary
99
+ def metadata_only?
100
+ ENV["DELIVER_SKIP_BINARY"]
101
+ end
102
+
103
+ # Is the app already ready for sale?
104
+ # if so, we can't update the app metadata: http://www.openradar.appspot.com/18263306
105
+ def ready_for_sale?
106
+ return false if Helper.is_test?
107
+ return @ready if @checked_for_ready
108
+
109
+ @checked_for_ready = true
110
+ @ready = (app.get_app_status == App::AppStatus::READY_FOR_SALE)
111
+ end
112
+
63
113
  #####################################################
64
114
  # @!group All the methods
65
115
  #####################################################
@@ -75,10 +125,24 @@ module Deliver
75
125
  end
76
126
  end
77
127
 
78
- def fetch_information_from_ipa_file
128
+ # Tries to fetch app version and app identifier from Deliverfile
129
+ def fetch_app_key_information
79
130
  @app_version = @deploy_information[Deliverer::ValKey::APP_VERSION]
80
131
  @app_identifier = @deploy_information[Deliverer::ValKey::APP_IDENTIFIER]
132
+ fetch_app_identifier_from_app_file
133
+ end
134
+
135
+ # returns the latest app version from iTunes Connect
136
+ def get_latest_version
137
+ return nil if Helper.is_test?
81
138
 
139
+ data = itc.get_app_information(Deliver::App.new(app_identifier: @app_identifier))
140
+ return (data['version']['value'] rescue nil)
141
+ rescue
142
+ return nil
143
+ end
144
+
145
+ def fetch_information_from_ipa_file
82
146
  used_ipa_file = ENV["IPA_OUTPUT_PATH"]# if (ENV["IPA_OUTPUT_PATH"] and File.exists?(ENV["IPA_OUTPUT_PATH"]))
83
147
 
84
148
  if is_release_build?
@@ -125,7 +189,7 @@ module Deliver
125
189
  end
126
190
 
127
191
  def fetch_app_identifier_from_app_file
128
- @app_identifier = (CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) rescue nil)
192
+ @app_identifier ||= (CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) rescue nil)
129
193
  end
130
194
 
131
195
  def verify_ipa_file
@@ -216,20 +280,25 @@ module Deliver
216
280
  @app.metadata.update_price_tier(@deploy_information[Deliverer::ValKey::PRICE_TIER]) if @deploy_information[Deliverer::ValKey::PRICE_TIER]
217
281
  end
218
282
 
283
+ def screenshots_path
284
+ return @screens_path if @screens_path
219
285
 
220
- def set_screenshots
221
- screens_path = @deploy_information[Deliverer::ValKey::SCREENSHOTS_PATH]
222
-
286
+ @screens_path = @deploy_information[Deliverer::ValKey::SCREENSHOTS_PATH]
223
287
  if (ENV["DELIVER_SCREENSHOTS_PATH"] || '').length > 0
224
- Helper.log.warn "Overwriting screenshots path from config (#{screens_path}) with (#{ENV["DELIVER_SCREENSHOTS_PATH"]})".yellow
225
- screens_path = ENV["DELIVER_SCREENSHOTS_PATH"]
288
+ Helper.log.warn "Overwriting screenshots path from config (#{@screens_path}) with (#{ENV["DELIVER_SCREENSHOTS_PATH"]})".yellow
289
+ @screens_path = ENV["DELIVER_SCREENSHOTS_PATH"]
226
290
  end
227
291
 
228
- screens_path ||= "./screenshots/" # default value
229
-
292
+ @screens_path ||= "./screenshots/" # default value
293
+
294
+ return @screens_path
295
+ end
296
+
297
+ def set_screenshots
298
+ screens_path = screenshots_path
230
299
  if screens_path
231
300
  # Not using Snapfile. Not a good user.
232
- if not @app.metadata.set_all_screenshots_from_path(screens_path)
301
+ if not @app.metadata.set_all_screenshots_from_path(screens_path, use_framed_screenshots?)
233
302
  # This path does not contain folders for each language
234
303
  if screens_path.kind_of?String
235
304
  if @deploy_information[Deliverer::ValKey::DEFAULT_LANGUAGE]
@@ -240,11 +309,18 @@ module Deliver
240
309
  screens_path = nil
241
310
  end
242
311
  end
243
- @app.metadata.set_screenshots_for_each_language(screens_path) if screens_path
312
+ @app.metadata.set_screenshots_for_each_language(screens_path, use_framed_screenshots?) if screens_path
244
313
  end
245
314
  end
246
315
  end
247
316
 
317
+ # Should _framed screenshots be used for the screenshot upload?
318
+ # This will only be true if there is a Framefile, as this makes the screenshots valid
319
+ # since the resolution is only correct when using a background + title using frameit 2.0
320
+ def use_framed_screenshots?
321
+ return Dir[screenshots_path + "**/Framefile.json"].count > 0
322
+ end
323
+
248
324
  def verify_pdf_file
249
325
  if @deploy_information[Deliverer::ValKey::SKIP_PDF]
250
326
  Helper.log.debug "PDF verify was skipped"
@@ -276,9 +352,12 @@ module Deliver
276
352
  raise "Error uploading app metadata".red unless result == true
277
353
  end
278
354
 
355
+ def itc
356
+ @itc ||= ItunesConnect.new
357
+ end
358
+
279
359
  def additional_itc_information
280
360
  # e.g. rating or copyright
281
- itc = ItunesConnect.new
282
361
  itc.set_copyright!(@app, @deploy_information[Deliverer::ValKey::COPYRIGHT]) if @deploy_information[Deliverer::ValKey::COPYRIGHT]
283
362
  itc.set_app_review_information!(@app, @deploy_information[Deliverer::ValKey::APP_REVIEW_INFORMATION]) if @deploy_information[Deliverer::ValKey::APP_REVIEW_INFORMATION]
284
363
  itc.set_release_after_approval!(@app, @deploy_information[Deliverer::ValKey::AUTOMATIC_RELEASE]) if @deploy_information[Deliverer::ValKey::AUTOMATIC_RELEASE] != nil
@@ -362,17 +441,5 @@ module Deliver
362
441
  end
363
442
  return app_version
364
443
  end
365
-
366
- def skip_deployment?
367
- @deploy_information[Deliverer::ValKey::SKIP_DEPLOY]
368
- end
369
-
370
- def is_release_build?
371
- is_beta_build? == false
372
- end
373
-
374
- def is_beta_build?
375
- @deploy_information[Deliverer::ValKey::IS_BETA_IPA]
376
- end
377
444
  end
378
445
  end
@@ -91,6 +91,9 @@ module Deliver
91
91
  return publish_production_build(submit_information)
92
92
  elsif @publish_strategy == IPA_UPLOAD_STRATEGY_BETA_BUILD
93
93
  return publish_beta_build
94
+ else
95
+ Helper.log.info "deliver will **not** submit the app for Review or for TestFlight distribution".yellow
96
+ Helper.log.info "If you want to distribute the binary, don't define `skip_deploy` ".yellow
94
97
  end
95
98
  return true
96
99
  end
@@ -8,4 +8,5 @@ require 'deliver/itunes_connect/itunes_connect_app_icon'
8
8
  require 'deliver/itunes_connect/itunes_connect_apple_watch_app_icon'
9
9
  require 'deliver/itunes_connect/itunes_connect_app_rating'
10
10
  require 'deliver/itunes_connect/itunes_connect_additional'
11
- require 'deliver/itunes_connect/itunes_connect_screenshot_fetcher'
11
+ require 'deliver/itunes_connect/itunes_connect_screenshot_fetcher'
12
+ require 'deliver/itunes_connect/itunes_connect_information'
@@ -0,0 +1,34 @@
1
+ require 'open-uri'
2
+
3
+ module Deliver
4
+ # For all the information reading (e.g. version number)
5
+ class ItunesConnect < FastlaneCore::ItunesConnect
6
+ ALL_INFORMATION_URL = "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/"
7
+
8
+ # This method will download information for a given app
9
+ # @param app (Deliver::App) the app you want this information from
10
+ # @raise [ItunesConnectGeneralError] General error while executing
11
+ # this action
12
+ # @raise [ItunesConnectLoginError] Login data is wrong
13
+ def get_app_information(app)
14
+ begin
15
+ verify_app(app)
16
+
17
+ url = ALL_INFORMATION_URL + app.apple_id.to_s
18
+
19
+ # Turn off/on the async mode of jQuery
20
+ evaluate_script("jQuery.ajaxSetup({async:false});")
21
+ response = evaluate_script("$.get('#{url}').responseText")
22
+ evaluate_script("jQuery.ajaxSetup({async:true});")
23
+
24
+ raise "Could not fetch data for app" unless response
25
+
26
+ data = JSON.parse(response)
27
+
28
+ return data['data']
29
+ rescue Exception => ex
30
+ error_occured(ex)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -3,8 +3,6 @@ require 'open-uri'
3
3
  module Deliver
4
4
  # For all the information reading (e.g. version number)
5
5
  class ItunesConnect < FastlaneCore::ItunesConnect
6
- ALL_INFORMATION_URL = "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/"
7
-
8
6
  # This method will download all existing app screenshots
9
7
  # @param app (Deliver::App) the app you want this information from
10
8
  # @param folder_path (String) the path to store the screenshots in
@@ -67,12 +67,22 @@ module Deliver
67
67
  build_url = "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/#{app.apple_id}/trains/#{current_build['trainVersion']}/builds/#{current_build['buildVersion']}/testInformation"
68
68
  build_info = JSON.parse(Excon.get(build_url, headers: { "Cookie" => cookie_string } ).body)['data']
69
69
 
70
+ Helper.log.info "Setting the following information for this build:".yellow
71
+ Helper.log.info "DELIVER_WHAT_TO_TEST: '#{ENV['DELIVER_WHAT_TO_TEST']}'"
72
+ Helper.log.info "DELIVER_BETA_DESCRIPTION: '#{ENV['DELIVER_BETA_DESCRIPTION']}'"
73
+ Helper.log.info "DELIVER_BETA_FEEDBACK_EMAIL: '#{ENV['DELIVER_BETA_FEEDBACK_EMAIL']}'"
74
+
70
75
  build_info['details'][0]['whatsNew']['value'] = ENV["DELIVER_WHAT_TO_TEST"]
71
76
  build_info['details'][0]['description']['value'] = ENV["DELIVER_BETA_DESCRIPTION"]
72
77
  build_info['details'][0]['feedbackEmail']['value'] = ENV["DELIVER_BETA_FEEDBACK_EMAIL"]
73
- Excon.post(build_url, body: build_info.to_json, headers: { "Cookie" => cookie_string } )
78
+ h = Excon.post(build_url, body: build_info.to_json, headers: { "Cookie" => cookie_string } )
74
79
 
75
- Helper.log.info "Successfully distributed latest beta build 🚀".green
80
+ if h.status == 200
81
+ Helper.log.info "Successfully distributed latest beta build 🚀".green
82
+ else
83
+ Helper.log.info h.data
84
+ Helper.log.info "Some error occured marking the new builds as TestFlight build. Please do it manually on '#{current_url}'.".green
85
+ end
76
86
 
77
87
  return true
78
88
  rescue => ex
@@ -1,3 +1,3 @@
1
1
  module Deliver
2
- VERSION = "0.10.0"
2
+ VERSION = "0.11.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deliver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.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-05-10 00:00:00.000000000 Z
11
+ date: 2015-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.1.0
97
- - !ruby/object:Gem::Dependency
98
- name: prawn
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '>='
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: excon
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -258,6 +244,7 @@ files:
258
244
  - lib/deliver/itunes_connect/itunes_connect_app_icon.rb
259
245
  - lib/deliver/itunes_connect/itunes_connect_app_rating.rb
260
246
  - lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
247
+ - lib/deliver/itunes_connect/itunes_connect_information.rb
261
248
  - lib/deliver/itunes_connect/itunes_connect_new_version.rb
262
249
  - lib/deliver/itunes_connect/itunes_connect_reader.rb
263
250
  - lib/deliver/itunes_connect/itunes_connect_screenshot_fetcher.rb