deliver 0.6.0 → 0.7.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: 1aa9678c4c8f492ca46805f1ac07c306a14c7675
4
- data.tar.gz: eb392c8ca031399725e9a106e88599356b7ae508
3
+ metadata.gz: 48fe52689d7e1c50573b7ec705ab02c338299e18
4
+ data.tar.gz: 5b85fbc851c1061a12722691d570ce361b1cb6f8
5
5
  SHA512:
6
- metadata.gz: 03ebce1c92b8cf19827ef6a70c7b6a686235e3fa424ff2ad44f46281a8f04d30d80e7077da9661448a7969b0f04afd5cf6a26e87cd4b93d0d813385138bbf0b9
7
- data.tar.gz: 5400a931ee5717062c523f47e2e0d828e0f20bf29458d80ea3340b0885899bde6a043020b0d5fbc3d78e9477607469333fdc083b29fa44168393b63c301435b7
6
+ metadata.gz: 0aa37714a00986d1d31bd4791e73d721c2e945a9f0af13cff64263314d57b400b1c34bfca734b4a3fda2bd6f5dab1025769ebcabd238b2a04454392a37cb29e6
7
+ data.tar.gz: 569d4c61f0a4fb8ec36f78a7b756f45c522d2557effa3c3bb84c921c847e56e5d96ccb9f81625e773ed757a5a6835f1cca7d199ef3273de08aa5c77cddc4b2b5
data/README.md CHANGED
@@ -36,6 +36,7 @@ Get in contact with the developer on Twitter: [@KrauseFx](https://twitter.com/Kr
36
36
  -------
37
37
  <p align="center">
38
38
  <a href="#features">Features</a> &bull;
39
+ <a href="#testflight">TestFlight</a> &bull;
39
40
  <a href="#installation">Installation</a> &bull;
40
41
  <a href="#quick-start">Quick Start</a> &bull;
41
42
  <a href="#usage">Usage</a> &bull;
@@ -56,6 +57,7 @@ Get in contact with the developer on Twitter: [@KrauseFx](https://twitter.com/Kr
56
57
  - Store the configuration in git to easily deploy from **any** computer, including your Continuous Integration server (e.g. Jenkins)
57
58
  - Get a PDF preview of the fetched metadata before uploading the app metadata and screenshots to Apple: [Example Preview](https://github.com/krausefx/deliver/blob/master/assets/PDFExample.png?raw=1)
58
59
  - Automatically create new screenshots with [Snapshot](https://github.com/KrauseFx/snapshot)
60
+ - Upload new builds to the new Apple TestFlight
59
61
 
60
62
  # Installation
61
63
 
@@ -75,6 +77,40 @@ If you don't already have homebrew installed, [install it here](http://brew.sh/)
75
77
 
76
78
  To create new screenshots automatically, check out my other open source project [Snapshot](https://github.com/KrauseFx/snapshot).
77
79
 
80
+ # TestFlight
81
+
82
+ To upload a new build to Apple `TestFlight` use the following command:
83
+
84
+ ```
85
+ deliver testflight
86
+ ```
87
+
88
+ This will auotmatically look for an ipa file in the current directory.
89
+
90
+ `deliver` currently supports **Internal Testers** only.
91
+
92
+ Make sure to increase your build number before building and uploading your app.
93
+
94
+ #### More options:
95
+
96
+ Specify the `ipa` file to be used:
97
+
98
+ ```
99
+ deliver testflight ./my_app.ipa
100
+ ```
101
+
102
+ Pass the Apple ID and App ID to be used (optional):
103
+
104
+ ```
105
+ deliver testflight -u felix@krausefx.com -a 862582703
106
+ ```
107
+
108
+ To build and upload the ipa in one step, you can use [shenzhen](https://github.com/nomad/shenzhen):
109
+
110
+ ```
111
+ ipa build && deliver testflight
112
+ ```
113
+
78
114
  # Quick Start
79
115
 
80
116
 
@@ -304,7 +340,7 @@ Detailed instructions about how to set up `deliver` and `fastlane` in `Jenkins`
304
340
  Change syntax highlighting to *Ruby*.
305
341
 
306
342
  # Need help?
307
- - If there is a technical problem with ```deliver```, submit an issue. Run ```deliver --trace``` to get the stack trace.
343
+ - If there is a technical problem with ```deliver```, submit an issue.
308
344
  - I'm available for contract work - drop me an email: deliver@krausefx.com
309
345
 
310
346
  # License
@@ -18,14 +18,15 @@ class FastlaneApplication
18
18
  program :help, 'GitHub', 'https://github.com/krausefx/deliver'
19
19
  program :help_formatter, :compact
20
20
 
21
- global_option('--verbose') { $verbose = true }
21
+ global_option '--force', 'Runs a deployment without verifying any information (PDF file). This can be used for build servers.'
22
+ global_option '--beta', 'Upload a beta build to iTunes Connect. This uses the `beta_ipa` block.'
23
+ global_option '--skip-deploy', 'Skips submission of the build on iTunes Connect. This will only upload the ipa and/or metadata.'
24
+
25
+ always_trace!
22
26
 
23
27
  command :run do |c|
24
28
  c.syntax = 'deliver'
25
29
  c.description = 'Run a deploy process using the Deliverfile in the current folder'
26
- c.option '--force', 'Runs a deployment without verifying any information (PDF file). This can be used for build servers.'
27
- c.option '--beta', 'Runs a deployment to beta build on iTunes Connect'
28
- c.option '--skip-deploy', 'Skips deployment on iTunes Connect'
29
30
  c.action do |args, options|
30
31
  path = (Deliver::Helper.fastlane_enabled?? './fastlane' : '.')
31
32
  Dir.chdir(path) do # switch the context
@@ -52,14 +53,33 @@ class FastlaneApplication
52
53
  end
53
54
  end
54
55
 
56
+ command :testflight do |c|
57
+ c.syntax = 'deliver testflight'
58
+ c.description = "Uploads a given ipa file to the new Apple TestFlight"
59
+ c.option '-a', '--app_id String', String, 'The App ID (numeric, like 956814360)'
60
+ c.option '-u', '--username String', String, 'Your Apple ID'
61
+
62
+ c.action do |args, options|
63
+ ipa_path = (args.first || determine_ipa) + '' # unfreeze the string
64
+
65
+ set_username(options.username)
66
+
67
+ Deliver::Testflight.upload!(ipa_path, options.app_id, options.skip_deploy)
68
+ end
69
+ end
55
70
 
56
71
  def set_username(username)
57
72
  user = username
58
73
  user ||= ENV["DELIVER_USERNAME"]
59
- user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
74
+ user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
60
75
  CredentialsManager::PasswordManager.shared_manager(user) if user
61
76
  end
62
77
 
78
+ def determine_ipa
79
+ return Dir['*.ipa'].first if Dir["*.ipa"].count == 1
80
+ return ask("Path to IPA file to upload: ".green)
81
+ end
82
+
63
83
  default_command :run
64
84
 
65
85
  run!
@@ -17,6 +17,8 @@ require 'deliver/pdf_generator'
17
17
  require 'deliver/deliver_process'
18
18
  require 'deliver/dependency_checker'
19
19
  require 'deliver/update_checker'
20
+ require 'deliver/ipa_file_analyser'
21
+ require 'deliver/testflight'
20
22
 
21
23
  # Third Party code
22
24
  require 'colored'
@@ -0,0 +1,44 @@
1
+ module Deliver
2
+ class IpaFileAnalyser
3
+
4
+ # Fetches the app identifier (e.g. com.facebook.Facebook) from the given ipa file.
5
+ def self.fetch_app_identifier(path)
6
+ plist = IpaFileAnalyser.fetch_info_plist_file(path)
7
+ return plist['CFBundleIdentifier'] if plist
8
+ return nil
9
+ end
10
+
11
+ # Fetches the app version from the given ipa file.
12
+ def self.fetch_app_version(path)
13
+ plist = IpaFileAnalyser.fetch_info_plist_file(path)
14
+ return plist['CFBundleShortVersionString'] if plist
15
+ return nil
16
+ end
17
+
18
+ def self.fetch_info_plist_file(path)
19
+ Zip::File.open(path) do |zipfile|
20
+ zipfile.each do |file|
21
+ if file.name.include?'.plist' and not ['.bundle', '.framework'].any? { |a| file.name.include?a }
22
+ # We can not be completely sure, that's the correct plist file, so we have to try
23
+ begin
24
+ # The XML file has to be properly unpacked first
25
+ tmp_path = "/tmp/deploytmp.plist"
26
+ File.write(tmp_path, zipfile.read(file))
27
+ system("plutil -convert xml1 #{tmp_path}")
28
+ result = Plist::parse_xml(tmp_path)
29
+ File.delete(tmp_path)
30
+
31
+ if result['CFBundleIdentifier'] or result['CFBundleVersion']
32
+ return result
33
+ end
34
+ rescue
35
+ # We don't really care, look for another XML file
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ nil
42
+ end
43
+ end
44
+ end
@@ -36,16 +36,12 @@ module Deliver
36
36
 
37
37
  # Fetches the app identifier (e.g. com.facebook.Facebook) from the given ipa file.
38
38
  def fetch_app_identifier
39
- plist = fetch_info_plist_file
40
- return plist['CFBundleIdentifier'] if plist
41
- return nil
39
+ return IpaFileAnalyser.fetch_app_identifier(@ipa_file.path)
42
40
  end
43
41
 
44
42
  # Fetches the app version from the given ipa file.
45
43
  def fetch_app_version
46
- plist = fetch_info_plist_file
47
- return plist['CFBundleShortVersionString'] if plist
48
- return nil
44
+ return IpaFileAnalyser.fetch_app_version(@ipa_file.path)
49
45
  end
50
46
 
51
47
 
@@ -70,7 +66,7 @@ module Deliver
70
66
 
71
67
  is_okay = true
72
68
  begin
73
- transporter.upload(@app, @metadata_dir)
69
+ is_okay = transporter.upload(@app, @metadata_dir)
74
70
  rescue => ex
75
71
  Helper.log.debug ex
76
72
  is_okay = ex.to_s.include?"ready exists a binary upload with build" # this just means, the ipa is already online
@@ -137,32 +133,5 @@ module Deliver
137
133
  asset = @data.xpath('//x:asset', "x" => Deliver::AppMetadata::ITUNES_NAMESPACE).first
138
134
  asset << @ipa_file.create_xml_node(@data)
139
135
  end
140
-
141
- def fetch_info_plist_file
142
- Zip::File.open(@ipa_file.path) do |zipfile|
143
- zipfile.each do |file|
144
- if file.name.include?'.plist' and not ['.bundle', '.framework'].any? { |a| file.name.include?a }
145
- # We can not be completely sure, that's the correct plist file, so we have to try
146
- begin
147
- # The XML file has to be properly unpacked first
148
- tmp_path = "/tmp/deploytmp.plist"
149
- File.write(tmp_path, zipfile.read(file))
150
- system("plutil -convert xml1 #{tmp_path}")
151
- result = Plist::parse_xml(tmp_path)
152
- File.delete(tmp_path)
153
-
154
- if result['CFBundleIdentifier'] or result['CFBundleVersion']
155
- return result
156
- end
157
- rescue
158
- # We don't really care, look for another XML file
159
- end
160
- end
161
- end
162
- end
163
-
164
- nil
165
- end
166
-
167
136
  end
168
137
  end
@@ -49,7 +49,7 @@ module Deliver
49
49
  started = Time.now
50
50
 
51
51
  # Wait, while iTunesConnect is processing the uploaded file
52
- while page.has_content?"Uploaded"
52
+ while (page.has_content?"Uploaded" or page.has_content?"Processing")
53
53
  # iTunesConnect is super slow... so we have to wait...
54
54
  Helper.log.info("Sorry, we have to wait for iTunesConnect, since it's still processing the uploaded ipa file\n" +
55
55
  "If this takes longer than 45 minutes, you have to re-upload the ipa file again.\n" +
@@ -72,7 +72,6 @@ module Deliver
72
72
 
73
73
  counter += 1
74
74
  if counter > 100
75
- Helper.log.debug page.html
76
75
  Helper.log.debug caller
77
76
  raise ItunesConnectGeneralError.new("Couldn't find element '#{name}' after waiting for quite some time")
78
77
  end
@@ -19,15 +19,16 @@ module Deliver
19
19
  end
20
20
 
21
21
  if first(".switcher.ng-binding")['class'].include?"checked"
22
- Helper.log.warn("Beta Build seems to be already active. Take a look at '#{current_url}'")
22
+ Helper.log.info("Beta is already active. Take a look at '#{current_url}'.")
23
23
  return true
24
24
  end
25
25
 
26
26
  first(".switcher.ng-binding").click
27
27
  if page.has_content?"Are you sure you want to start testing"
28
28
  click_on "Start"
29
- end
30
29
 
30
+ Helper.log.info "Successfully enabled beta builds".green
31
+ end
31
32
 
32
33
  return true
33
34
  rescue => ex
@@ -102,7 +103,7 @@ module Deliver
102
103
  Helper.log.info("App is already Waiting For Review")
103
104
  return true
104
105
  else
105
- raise "Couldn't find button with name '#{BUTTON_STRING_SUBMIT_FOR_REVIEW}'"
106
+ raise "Couldn't find button with name '#{BUTTON_STRING_SUBMIT_FOR_REVIEW}'!"
106
107
  end
107
108
  end
108
109
 
@@ -95,8 +95,7 @@ module Deliver
95
95
  if defined?@@hide_transporter_output
96
96
  # Show a one time message instead
97
97
  Helper.log.info "Waiting for iTunes Connect transporter to be finished.".green
98
- Helper.log.info "If you want upload/download logs to be enabled, remove 'hide_transporter_output' from your Deliverfile."
99
- Helper.log.info "iTunes Transporter progress...".green
98
+ Helper.log.info "iTunes Transporter progress... this might take a few minutes...".green
100
99
  end
101
100
 
102
101
  begin
@@ -0,0 +1,26 @@
1
+ module Deliver
2
+ class Testflight
3
+
4
+ # Uploads a new build to Apple TestFlight
5
+ # @param ipa_path (String) a path to the IPA to upload
6
+ # @param app_id (String) optional, the app ID
7
+ # @param skip_deploy (boolean) Should the submission be skipped?
8
+ def self.upload!(ipa_path, app_id, skip_deploy)
9
+ ItunesTransporter.hide_transporter_output
10
+
11
+ app_identifier = IpaFileAnalyser.fetch_app_identifier(ipa_path)
12
+ app_identifier ||= ask("Could not automatically find the app identifier, please enter the app's bundle identifier: ")
13
+ app_id ||= (Deliver::ItunesSearchApi.fetch_by_identifier(app_identifier)['trackId'] rescue nil)
14
+ app_id ||= ask("Could not automatically find the app ID, please enter it here (e.g. 956814360): ")
15
+ strategy = (skip_deploy ? Deliver::IPA_UPLOAD_STRATEGY_JUST_UPLOAD : Deliver::IPA_UPLOAD_STRATEGY_BETA_BUILD)
16
+
17
+ Helper.log.info "Ready to upload new build to TestFlight (#{app_identifier} - #{app_id})".green
18
+
19
+ # Got everything to replaoy
20
+ app = App.new(app_identifier: app_identifier, apple_id: app_id)
21
+ ipa = IpaUploader.new(app, '/tmp/', ipa_path, strategy)
22
+ result = ipa.upload!
23
+ raise "Error distributing new beta version!".red unless result == true
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module Deliver
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.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.6.0
4
+ version: 0.7.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-01-26 00:00:00.000000000 Z
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -305,6 +305,7 @@ files:
305
305
  - lib/deliver/deliverfile/dsl.rb
306
306
  - lib/deliver/dependency_checker.rb
307
307
  - lib/deliver/helper.rb
308
+ - lib/deliver/ipa_file_analyser.rb
308
309
  - lib/deliver/ipa_uploader.rb
309
310
  - lib/deliver/itunes_connect/itunes_connect.rb
310
311
  - lib/deliver/itunes_connect/itunes_connect_additional.rb
@@ -320,6 +321,7 @@ files:
320
321
  - lib/deliver/languages.rb
321
322
  - lib/deliver/metadata_item.rb
322
323
  - lib/deliver/pdf_generator.rb
324
+ - lib/deliver/testflight.rb
323
325
  - lib/deliver/update_checker.rb
324
326
  - lib/deliver/version.rb
325
327
  homepage: http://fastlane.tools