deliver 0.3.1 → 0.3.2

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: 9074ee087705d2000cc56a2baa077e9361bb0506
4
- data.tar.gz: 7fa2d77af3c9db33724d3c359fbe6a409dc54e05
3
+ metadata.gz: 730cbb7ddcff1c957d5f345f8487448ef7258c30
4
+ data.tar.gz: 1f8c6bed0405116fa8e0224ea9ea80cf21313411
5
5
  SHA512:
6
- metadata.gz: d45c8ae078611d98ec7549f7fe11765cd74572877203812f5e462fff4877658d2460bd0f2d474ed5542b2dc5fa5c25c3a33c5ca6c934a7207349abcc77d4a6d9
7
- data.tar.gz: 0ecdabdc955d80a69a0f7bc1f2e3430a3cf09de1281189e78a8513d98e39466fc26200d27f1e19690499330f8438fc7ab003186eab6b6d11bed5dfe427be1fef
6
+ metadata.gz: 716d790846a95f3eb33ccd1f9233a66e92a3cd47054907b62622a86094e4d6bb0d1ada51141ed2b12cf2db0e138179ef41926039da2fb1cd7cd74b8c9f818941
7
+ data.tar.gz: 4be310b04a8de4efec25a81c9f0c18adb4f32c741a644a13e79dede102da51d64e6ba5504bf5f9b60f17ac122f5a4c3f3e2c415b41915f412054d8d1f21df8b6
data/README.md CHANGED
@@ -180,6 +180,12 @@ ipa do
180
180
  end
181
181
  ```
182
182
 
183
+ #### Hide the iTunes Transporter log
184
+ By default, the transporter log is shown, to be fully transparent. If you prefer to hide it, you can use the following option in your ```Deliverfile``` to disable it for both the upload and the download of metadata:
185
+ ```ruby
186
+ hide_transporter_log
187
+ ```
188
+
183
189
  ##### What is the ```Deliverfile```?
184
190
  As you can see, the ```Deliverfile``` is a normal Ruby file, which is executed when
185
191
  running a deployment. Therefore it's possible to fully customise the behaviour
@@ -2,6 +2,8 @@
2
2
  # Everything next to a # is a comment and will be ignored
3
3
 
4
4
  email '[[EMAIL]]'
5
+ # hide_transporter_output # remove the '#' in the beginning of the line, to hide the output while uploading
6
+
5
7
 
6
8
  ########################################
7
9
  # App Metadata
@@ -8,6 +8,7 @@
8
8
  # Everything next to a # is a comment and will be ignored
9
9
 
10
10
  email "yourappleid@company.com"
11
+ # hide_transporter_output # remove the '#' in the beginning of the line, to hide the output while uploading
11
12
 
12
13
  ########################################
13
14
  # App Metadata
Binary file
@@ -53,7 +53,7 @@ module Deliver
53
53
  if redownload_package
54
54
  # Delete the one that may exists already
55
55
  unless Helper.is_test?
56
- `rm -fr #{dir}/*.itmsp`
56
+ `rm -rf #{dir}/*.itmsp`
57
57
  end
58
58
 
59
59
  # we want to update the metadata, so first we have to download the existing one
@@ -150,12 +150,12 @@ module Deliver
150
150
  screens_path = @deploy_information[Deliverer::ValKey::SCREENSHOTS_PATH]
151
151
 
152
152
  # Check if there is a Snapfile
153
- if File.exists?('./Snapfile')
153
+ if File.exists?('./Snapfile') and not screens_path
154
154
 
155
155
  Helper.log.info("Found a Snapfile, using it to create new screenshots.".green)
156
156
  begin
157
157
  Snapshot::Runner.new.work
158
- @app.metadata.set_all_screenshots_from_path(screens_path) if screens_path
158
+ Helper.log.info("Looking for screenshots in './screenshots'.".yellow)
159
159
  @app.metadata.set_all_screenshots_from_path('./screenshots')
160
160
  rescue Exception => ex
161
161
  # There were some UI Automation errors
@@ -163,6 +163,9 @@ module Deliver
163
163
  end
164
164
 
165
165
  elsif screens_path
166
+ if File.exists?('./Snapfile')
167
+ Helper.log.info("Found a Snapfile. Ignoring it. If you want 'deliver' to automatically take new screenshots for you, remove 'screenshots_path' from your 'Deliverfile'.".yellow)
168
+ end
166
169
  # Not using Snapfile. Not a good user.
167
170
  if not @app.metadata.set_all_screenshots_from_path(screens_path)
168
171
  # This path does not contain folders for each language
@@ -107,6 +107,11 @@ module Deliver
107
107
  PasswordManager.shared_manager(value)
108
108
  end
109
109
 
110
+ # This will hide the output of the iTunes Connect transporter while uploading/downloading
111
+ def hide_transporter_log
112
+ ItunesTransporter.hide_transporter_output
113
+ end
114
+
110
115
  # Set the apps new version number.
111
116
  #
112
117
  # If you do not set this, it will automatically being fetched from the
@@ -71,6 +71,8 @@ module Deliver
71
71
 
72
72
  if is_okay
73
73
  unless Helper.is_test?
74
+ `rm -rf ./#{@app.apple_id}.itmsp` # we don't need that any more
75
+
74
76
  return publish_on_itunes_connect(submit_information)
75
77
  end
76
78
  end
@@ -90,9 +90,16 @@ module Deliver
90
90
  fill_in "accountpassword", with: password
91
91
 
92
92
  begin
93
- wait_for_elements(".enabled").first.click
94
- wait_for_elements('.ng-scope.managedWidth')
95
- rescue
93
+ (wait_for_elements(".enabled").first.click rescue nil) # Login Button
94
+ wait_for_elements('.homepageWrapper.ng-scope')
95
+
96
+ if page.has_content?"My Apps"
97
+ # Everything looks good
98
+ else
99
+ raise ItunesConnectLoginError.new("Looks like your login data was correct, but you do not have access to the apps.")
100
+ end
101
+ rescue Exception => ex
102
+ Helper.log.debug(ex)
96
103
  raise ItunesConnectLoginError.new("Error logging in user #{user} with the given password. Make sure you entered them correctly.")
97
104
  end
98
105
 
@@ -1,5 +1,5 @@
1
1
  require 'pty'
2
-
2
+ require 'shellwords'
3
3
  require 'deliver/password_manager'
4
4
 
5
5
 
@@ -18,6 +18,11 @@ module Deliver
18
18
  OUTPUT_REGEX = />\s+(.+)/
19
19
 
20
20
  private_constant :ERROR_REGEX, :WARNING_REGEX, :OUTPUT_REGEX
21
+
22
+ # This will be called from the Deliverfile, and disables the logging of the transpoter output
23
+ def self.hide_transporter_output
24
+ @@hide_transporter_output = true
25
+ end
21
26
 
22
27
  # Returns a new instance of the iTunesTranspoter.
23
28
  # If no username or password given, it will be taken from
@@ -43,8 +48,10 @@ module Deliver
43
48
 
44
49
  result = execute_transporter(command)
45
50
 
46
- if result
51
+ if result and File.directory?"/tmp/#{app.apple_id}.itmsp"
47
52
  Helper.log.info "Successfully downloaded the latest package from iTunesConnect.".green
53
+ else
54
+ Helper.log.fatal "Could not download metadata from iTunes Connect. Do you have special characters in your password (Like ' or \")?"
48
55
  end
49
56
 
50
57
  result
@@ -80,6 +87,13 @@ module Deliver
80
87
  @errors = []
81
88
  @warnings = []
82
89
 
90
+ if defined?@@hide_transporter_output
91
+ # Show a one time message instead
92
+ Helper.log.info "Waiting for iTunes Connect transpoter to be finished.".green
93
+ Helper.log.info "If you want upload/download logs to be enabled, remove 'hide_transporter_log' from your Deliverfile."
94
+ Helper.log.info "In progress...".green
95
+ end
96
+
83
97
  begin
84
98
  PTY.spawn(command) do |stdin, stdout, pid|
85
99
  stdin.each do |line|
@@ -119,7 +133,7 @@ module Deliver
119
133
  @warnings << $1
120
134
  end
121
135
 
122
- if line =~ OUTPUT_REGEX
136
+ if not defined?@@hide_transporter_output and line =~ OUTPUT_REGEX
123
137
  # General logging for debug purposes
124
138
  Helper.log.debug "[Transpoter Output]: #{$1}"
125
139
  end
@@ -147,7 +161,7 @@ module Deliver
147
161
  end
148
162
 
149
163
  def escaped_password(password)
150
- password.gsub('$', '\\$')
164
+ Shellwords.escape(password)
151
165
  end
152
166
 
153
167
  end
@@ -8,10 +8,23 @@ module Deliver
8
8
  # @param export_path (String) The path to a folder where the resulting PDF file should be stored.
9
9
  def render(deliverer, export_path = nil)
10
10
  export_path ||= '/tmp'
11
+ fontdir = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'fonts'))
11
12
 
12
13
  resulting_path = "#{export_path}/#{Time.now.to_i}.pdf"
13
14
  Prawn::Document.generate(resulting_path) do
14
15
 
16
+
17
+ # Adding Mona to handle Japanese. The Prawn docs say not to use the included Kai font so we're
18
+ # using this 3rd-party font instead.
19
+
20
+ font_families["Mona"] = {
21
+ :normal => { :file => "#{fontdir}/mona.ttf", :font => "Mona" }
22
+ }
23
+
24
+ pdf_fallback_fonts = [ "Mona" ]
25
+
26
+ font "Helvetica" # Set main document font
27
+
15
28
  counter = 0
16
29
  deliverer.app.metadata.information.each do |language, content|
17
30
  title = content[:title][:value] rescue ''
@@ -19,7 +32,7 @@ module Deliver
19
32
  Helper.log.info("[PDF] Exporting locale '#{language}' for app with title '#{title}'")
20
33
 
21
34
  font_size 20
22
- text "#{language}: #{title}"
35
+ text "#{language}: #{title}", :fallback_fonts => pdf_fallback_fonts
23
36
  stroke_horizontal_rule
24
37
  font_size 14
25
38
 
@@ -33,15 +46,15 @@ module Deliver
33
46
  # Description on right side
34
47
  bounding_box([col1, cursor], width: 340.0) do
35
48
  if content[:description] and content[:description][:value]
36
- text content[:description][:value], size: 6, color: (content[:description][:modified] ? modified_color : standard_color)
49
+ text content[:description][:value], size: 6, color: (content[:description][:modified] ? modified_color : standard_color), :fallback_fonts => pdf_fallback_fonts
37
50
  end
38
51
  move_down 10
39
52
  stroke_horizontal_rule
40
53
  move_down 10
41
- text "Changelog:", size: 8
54
+ text "Changelog:", size: 8, :fallback_fonts => pdf_fallback_fonts
42
55
  move_down 5
43
56
  if content[:version_whats_new] and content[:version_whats_new][:value]
44
- text content[:version_whats_new][:value], size: 6, color: (content[:version_whats_new][:modified] ? modified_color : standard_color)
57
+ text content[:version_whats_new][:value], size: 6, color: (content[:version_whats_new][:modified] ? modified_color : standard_color), :fallback_fonts => pdf_fallback_fonts
45
58
  end
46
59
  end
47
60
  title_bottom = cursor.to_f
@@ -63,20 +76,20 @@ module Deliver
63
76
 
64
77
  if value.kind_of?Array
65
78
  # Keywords only
66
- text "#{key}:", color: color, width: width, size: size
79
+ text "#{key}:", color: color, width: width, size: size, :fallback_fonts => pdf_fallback_fonts
67
80
  move_down 2
68
81
 
69
82
  keywords_padding_left = 5
70
83
  bounding_box([keywords_padding_left, cursor], width: (col1 - keywords_padding_left)) do
71
84
  value.each do |item|
72
- text "- #{item}", color: color, width: width, size: (size - 2)
85
+ text "- #{item}", color: color, width: width, size: (size - 2), :fallback_fonts => pdf_fallback_fonts
73
86
  end
74
87
  end
75
88
  else
76
89
  # Everything else
77
90
  next if value == nil or value.length == 0
78
91
 
79
- text "#{key}: #{value}", color: color, width: width, size: size
92
+ text "#{key}: #{value}", color: color, width: width, size: size, :fallback_fonts => pdf_fallback_fonts
80
93
  end
81
94
  end
82
95
  end
@@ -90,26 +103,29 @@ module Deliver
90
103
  move_cursor_to top
91
104
 
92
105
  if (content[:screenshots] || []).count > 0
93
- content[:screenshots].sort_by { |a| [:screen_size, :path] }.each do |screenshot|
106
+ content[:screenshots].sort{ |a, b| [a.screen_size, a.path] <=> [b.screen_size, b.path] }.each do |screenshot|
94
107
 
95
108
  if last_size and last_size != screenshot.screen_size
96
109
  # Next row (other simulator size)
97
110
  top -= (previous_image_height + padding)
98
111
  move_cursor_to top
99
112
 
100
- if top < previous_image_height
101
- start_new_page
102
- top = cursor
103
- end
104
-
105
113
  index = 0
106
114
  end
107
115
 
116
+ # Compute the image height to know how far to move down
117
+ original_size = FastImage.size(screenshot.path)
118
+ previous_image_height = (image_width.to_f / original_size[0].to_f) * original_size[1].to_f
119
+
120
+ # If there isn't enough room for this image then start a new page
121
+ if top < previous_image_height
122
+ start_new_page
123
+ top = cursor
124
+ end
125
+
108
126
  image screenshot.path, width: image_width,
109
127
  at: [(index * (image_width + padding)), top]
110
128
 
111
- original_size = FastImage.size(screenshot.path)
112
- previous_image_height = (image_width.to_f / original_size[0].to_f) * original_size[1].to_f
113
129
 
114
130
  last_size = screenshot.screen_size
115
131
  index += 1
@@ -1,3 +1,3 @@
1
1
  module Deliver
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-12 00:00:00.000000000 Z
11
+ date: 2014-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -309,6 +309,7 @@ files:
309
309
  - lib/assets/DeliverfileDefault
310
310
  - lib/assets/DeliverfileExample
311
311
  - lib/assets/ScreenshotsHelp
312
+ - lib/assets/fonts/mona.ttf
312
313
  - lib/deliver.rb
313
314
  - lib/deliver/app.rb
314
315
  - lib/deliver/app_metadata.rb