fastlane 2.69.0.beta.20171207010003 → 2.69.0.beta.20171208010004

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: 683a48dde4c63b92cbca51350a34d5fab6bae5aa
4
- data.tar.gz: 08fe1b44414f8a5b714dcf5e08f2cdc4fa084034
3
+ metadata.gz: 3b3c2b5cbef74d7bad0828ec4fe2decf402fc5fa
4
+ data.tar.gz: d0ac8dcc81ba78412ed83ca48a65028dd763b919
5
5
  SHA512:
6
- metadata.gz: 263e9bc87a97b40aa765f4712caf7f9dff5f300cefb5af520dcabbcca74e3ed1f0b7a4d1517ae8823483b80d278d4e5e02f60b0422dd11f85338e4148a66290d
7
- data.tar.gz: 3c686d55b00176f7db095cc6e51a08817af0c4434646603ab338a8db370fe7d0cf421065602824151775e5de3a6e742849521495b9cf988a74522a1368326d45
6
+ metadata.gz: 3f09cb8afd547b0c4f3750774e6ac16c2054feda350ab4dab37ff32cbf58c39f320d0f4112c10c100b76ec86ea2d7b63717b07546420442a4371986d468c53f0
7
+ data.tar.gz: cca562e98a5de53bc8de2287ed060ede6a441dabf9348d614896ebc8ddfa703192780137d5a899bf20e105a19a28218fdff81a06e1564ad2cebc95e1d6cedbda
@@ -94,8 +94,8 @@ module Fastlane
94
94
  end
95
95
 
96
96
  # to allow a simple `sh` in the custom actions
97
- def self.sh(command, print_command: true, print_command_output: true, error_callback: nil)
98
- Fastlane::Actions.sh_control_output(command, print_command: print_command, print_command_output: print_command_output, error_callback: error_callback)
97
+ def self.sh(*command, print_command: true, print_command_output: true, error_callback: nil)
98
+ Fastlane::Actions.sh_control_output(*command, print_command: print_command, print_command_output: print_command_output, error_callback: error_callback)
99
99
  end
100
100
 
101
101
  # Documentation category, available values defined in AVAILABLE_CATEGORIES
@@ -1,7 +1,7 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  module SharedValues
4
- GIT_BRANCH_ENV_VARS = %w(GIT_BRANCH BRANCH_NAME TRAVIS_BRANCH BITRISE_GIT_BRANCH CI_BUILD_REF_NAME CI_COMMIT_REF_NAME WERCKER_GIT_BRANCH).freeze
4
+ GIT_BRANCH_ENV_VARS = %w(GIT_BRANCH BRANCH_NAME TRAVIS_BRANCH BITRISE_GIT_BRANCH CI_BUILD_REF_NAME CI_COMMIT_REF_NAME WERCKER_GIT_BRANCH BUILDKITE_BRANCH).freeze
5
5
  end
6
6
 
7
7
  class GitBranchAction < Action
@@ -54,7 +54,7 @@ module Fastlane
54
54
  def self.example_code
55
55
  [
56
56
  'sh("ls")',
57
- 'sh("git commit -m \'My message\'")'
57
+ 'sh("git", "commit", "-m", "My message")'
58
58
  ]
59
59
  end
60
60
 
@@ -174,11 +174,10 @@ module Fastlane
174
174
  end
175
175
 
176
176
  # Execute shell command
177
- def sh(command, log: true, error_callback: nil)
178
- command = Shellwords.join(command) if command.kind_of?(Array)
179
- command_header = log ? command : "shell command"
177
+ def sh(*command, log: true, error_callback: nil)
178
+ command_header = log ? Actions.shell_command_from_args(*command) : "shell command"
180
179
  Actions.execute_action(command_header) do
181
- Actions.sh_no_action(command, log: log, error_callback: error_callback)
180
+ Actions.sh_no_action(*command, log: log, error_callback: error_callback)
182
181
  end
183
182
  end
184
183
 
@@ -8,32 +8,41 @@ module Fastlane
8
8
  # When running this in tests, it will return the actual command instead of executing it
9
9
  # @param log [Boolean] should fastlane print out the executed command
10
10
  # @param error_callback [Block] a callback invoked with the command output if there is a non-zero exit status
11
- def self.sh(command, log: true, error_callback: nil)
12
- sh_control_output(command, print_command: log, print_command_output: log, error_callback: error_callback)
11
+ def self.sh(*command, log: true, error_callback: nil)
12
+ sh_control_output(*command, print_command: log, print_command_output: log, error_callback: error_callback)
13
13
  end
14
14
 
15
- def self.sh_no_action(command, log: true, error_callback: nil)
16
- sh_control_output(command, print_command: log, print_command_output: log, error_callback: error_callback)
15
+ def self.sh_no_action(*command, log: true, error_callback: nil)
16
+ sh_control_output(*command, print_command: log, print_command_output: log, error_callback: error_callback)
17
17
  end
18
18
 
19
- # @param command [String] The command to be executed
19
+ # @param command The command to be executed (variadic)
20
20
  # @param print_command [Boolean] Should we print the command that's being executed
21
21
  # @param print_command_output [Boolean] Should we print the command output during execution
22
22
  # @param error_callback [Block] A block that's called if the command exits with a non-zero status
23
- def self.sh_control_output(command, print_command: true, print_command_output: true, error_callback: nil)
23
+ def self.sh_control_output(*command, print_command: true, print_command_output: true, error_callback: nil)
24
24
  print_command = print_command_output = true if $troubleshoot
25
25
  # Set the encoding first, the user might have set it wrong
26
26
  previous_encoding = [Encoding.default_external, Encoding.default_internal]
27
27
  Encoding.default_external = Encoding::UTF_8
28
28
  Encoding.default_internal = Encoding::UTF_8
29
29
 
30
- command = Shellwords.join(command) if command.kind_of?(Array) # since it's an array of one element when running from the Fastfile
31
- UI.command(command) if print_command
30
+ shell_command = shell_command_from_args(*command)
31
+ UI.command(shell_command) if print_command
32
32
 
33
33
  result = ''
34
34
  if Helper.sh_enabled?
35
35
  exit_status = nil
36
- Open3.popen2e(command) do |stdin, io, thread|
36
+
37
+ # The argument list is passed directly to Open3.popen2e, which
38
+ # handles the variadic argument list in the same way as Kernel#spawn.
39
+ # (http://ruby-doc.org/core-2.4.2/Kernel.html#method-i-spawn) or
40
+ # Process.spawn (http://ruby-doc.org/core-2.4.2/Process.html#method-c-spawn).
41
+ #
42
+ # sh "ls -la /Applications/Xcode\ 7.3.1.app"
43
+ # sh "ls", "-la", "/Applications/Xcode 7.3.1.app"
44
+ # sh({ "FOO" => "Hello" }, "echo $FOO")
45
+ Open3.popen2e(*command) do |stdin, io, thread|
37
46
  io.sync = true
38
47
  io.each do |line|
39
48
  UI.command_output(line.strip) if print_command_output
@@ -44,7 +53,7 @@ module Fastlane
44
53
 
45
54
  if exit_status != 0
46
55
  message = if print_command
47
- "Exit status of command '#{command}' was #{exit_status} instead of 0."
56
+ "Exit status of command '#{shell_command}' was #{exit_status} instead of 0."
48
57
  else
49
58
  "Shell command exited with exit status #{exit_status} instead of 0."
50
59
  end
@@ -58,7 +67,7 @@ module Fastlane
58
67
  end
59
68
  end
60
69
  else
61
- result << command # only for the tests
70
+ result << shell_command # only for the tests
62
71
  end
63
72
 
64
73
  result
@@ -68,5 +77,37 @@ module Fastlane
68
77
  Encoding.default_external = previous_encoding.first
69
78
  Encoding.default_internal = previous_encoding.last
70
79
  end
80
+
81
+ # Used to produce a shell command string from a list of arguments that may
82
+ # be passed to methods such as Kernel#system, Kernel#spawn and Open3.popen2e
83
+ # in order to print the command to the terminal. The same *args are passed
84
+ # directly to a system call (Open3.popen2e). This interpretation is not
85
+ # used when executing a command.
86
+ #
87
+ # @param args Any number of arguments used to construct a command
88
+ # @raise [ArgumentError] If no arguments passed
89
+ # @return [String] A shell command representing the arguments passed in
90
+ def self.shell_command_from_args(*args)
91
+ raise ArgumentError, "sh requires at least one argument" unless args.count > 0
92
+
93
+ command = ""
94
+
95
+ # Optional initial environment Hash
96
+ if args.first.kind_of?(Hash)
97
+ command = args.shift.map { |k, v| "#{k}=#{v.shellescape}" }.join(" ") + " "
98
+ end
99
+
100
+ # Support [ "/usr/local/bin/foo", "foo" ], "-x", ...
101
+ if args.first.kind_of?(Array)
102
+ command += args.shift.first.shellescape + " " + args.shelljoin
103
+ command.chomp! " "
104
+ elsif args.count == 1 && args.first.kind_of?(String)
105
+ command += args.first
106
+ else
107
+ command += args.shelljoin
108
+ end
109
+
110
+ command
111
+ end
71
112
  end
72
113
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
- VERSION = '2.69.0.beta.20171207010003'.freeze
2
+ VERSION = '2.69.0.beta.20171208010004'.freeze
3
3
  DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze
4
4
  MINIMUM_XCODE_RELEASE = "7.0".freeze
5
5
  RUBOCOP_REQUIREMENT = '0.49.1'.freeze
@@ -318,6 +318,9 @@ module Frameit
318
318
  def build_title_images(max_width, max_height)
319
319
  words = [:keyword, :title].keep_if { |a| fetch_text(a) } # optional keyword/title
320
320
  results = {}
321
+ trim_boxes = {}
322
+ top_vertical_trim_offset = Float::INFINITY # Init at a large value, as the code will search for a minimal value.
323
+ bottom_vertical_trim_offset = 0
321
324
  words.each do |key|
322
325
  # Create empty background
323
326
  empty_path = File.join(Frameit::ROOT, "lib/assets/empty.png")
@@ -347,10 +350,60 @@ module Frameit
347
350
  i.interline_spacing interline_spacing if interline_spacing
348
351
  i.fill fetch_config[key.to_s]['color']
349
352
  end
350
- title_image.trim # remove white space
351
353
 
352
354
  results[key] = title_image
355
+
356
+ # Natively trimming the image with .trim will result in the loss of the common baseline between the text in all images.
357
+ # Hence retrieve the calculated trim bounding box without actually trimming:
358
+ calculated_trim_box = title_image.identify do |b|
359
+ b.format("%@") # CALCULATED: trim bounding box (without actually trimming), see: http://www.imagemagick.org/script/escape.php
360
+ end
361
+
362
+ # Create a Trimbox object from the MiniMagick .identify string with syntax "<width>x<height>+<offset_x>+<offset_y>":
363
+ trim_box = Frameit::Trimbox.new(calculated_trim_box)
364
+
365
+ # Get the minimum top offset of the trim box:
366
+ if trim_box.offset_y < top_vertical_trim_offset
367
+ top_vertical_trim_offset = trim_box.offset_y
368
+ end
369
+
370
+ # Get the maximum bottom offset of the trimbox, this is the top offset + height:
371
+ if (trim_box.offset_y + trim_box.height) > bottom_vertical_trim_offset
372
+ bottom_vertical_trim_offset = trim_box.offset_y + trim_box.height
373
+ end
374
+
375
+ # Store for the crop action:
376
+ trim_boxes[key] = trim_box
353
377
  end
378
+
379
+ # Crop images based on top_vertical_trim_offset and bottom_vertical_trim_offset to maintain text baseline:
380
+ words.each do |key|
381
+ # Get matching trim box:
382
+ trim_box = trim_boxes[key]
383
+
384
+ # Determine the trim area by maintaining the same vertical top offset based on the smallest value from all trim boxes (top_vertical_trim_offset).
385
+ # When the vertical top offset is larger than the smallest vertical top offset, the trim box needs to be adjusted:
386
+ if trim_box.offset_y > top_vertical_trim_offset
387
+ # Increase the height of the trim box with the difference in vertical top offset:
388
+ trim_box.height += trim_box.offset_y - top_vertical_trim_offset
389
+ # Change the vertical top offset to match that of the others:
390
+ trim_box.offset_y = top_vertical_trim_offset
391
+
392
+ UI.verbose("Trim box for key \"#{key}\" is adjusted to align top: #{trim_box}\n")
393
+ end
394
+
395
+ # Check if the height needs to be adjusted to reach the bottom offset:
396
+ if (trim_box.offset_y + trim_box.height) < bottom_vertical_trim_offset
397
+ # Set the height of the trim box to the difference between vertical bottom and top offset:
398
+ trim_box.height = bottom_vertical_trim_offset - trim_box.offset_y
399
+
400
+ UI.verbose("Trim box for key \"#{key}\" is adjusted to align bottom: #{trim_box}\n")
401
+ end
402
+
403
+ # Crop image with adjusted trim box parameters in MiniMagick string format:
404
+ results[key].crop(trim_box.string_format)
405
+ end
406
+
354
407
  results
355
408
  end
356
409
 
@@ -0,0 +1,33 @@
1
+ module Frameit
2
+ # Represents the MiniMagick trim bounding box for cropping a text image
3
+ class Trimbox
4
+ attr_accessor :width # width of the trim box
5
+ attr_accessor :height # height of the trim box
6
+ attr_accessor :offset_x # horizontal offset from the canvas to the trim box
7
+ attr_accessor :offset_y # vertical offset from the canvas to the trim box
8
+
9
+ # identify_string: A string with syntax "<width>x<height>+<offset_x>+<offset_y>". This is returned by MiniMagick when using function .identify with format("%@"). It is also required for the MiniMagick .crop function.
10
+ def initialize(identify_string)
11
+ UI.user_error!("Trimbox can not be initialised with an empty 'identify_string'.") unless identify_string.length > 0
12
+
13
+ # Parse the input syntax "<width>x<height>+<offset_x>+<offset_y>".
14
+ # Extract these 4 parameters into an integer array, by using multiple string separators: "x" and "+":
15
+ trim_values = identify_string.split(/[x+]/).map(&:to_i)
16
+
17
+ # If 'identify_string' doesn't have the expected syntax with 4 parameters, show error:
18
+ UI.user_error!("Trimbox is initialised with an invalid value for 'identify_string'.") unless trim_values.length == 4
19
+
20
+ # Assign instance variables:
21
+ @width = trim_values[0]
22
+ @height = trim_values[1]
23
+ @offset_x = trim_values[2]
24
+ @offset_y = trim_values[3]
25
+ end
26
+
27
+ # Get the trimbox parameters in the MiniMagick string format
28
+ def string_format
29
+ # Convert trim box parameters to string with syntax: "<width>x<height>+<offset_x>+<offset_y>":
30
+ return "#{@width}x#{@height}+#{@offset_x}+#{@offset_y}"
31
+ end
32
+ end
33
+ end
@@ -11,6 +11,7 @@ require 'frameit/strings_parser'
11
11
  require 'frameit/mac_editor'
12
12
  require 'frameit/dependency_checker'
13
13
  require 'frameit/options'
14
+ require 'frameit/trim_box'
14
15
 
15
16
  require 'fastlane_core'
16
17
 
@@ -436,8 +436,15 @@ module Spaceship
436
436
  # We use the olympus session to determine if the old session is still valid
437
437
  # As this will raise an exception if the old session has expired
438
438
  # If the old session is still valid, we don't have to do anything else in this method
439
+ # that's why we return true
439
440
  return true if fetch_olympus_session.count > 0
440
441
  rescue
442
+ # If the `fetch_olympus_session` method raises an exception
443
+ # we'll land here, and therefore continue doing a full login process
444
+ # This happens if the session we loaded from the cache isn't valid any more
445
+ # which is common, as the session automatically invalidates after x hours (we don't know x)
446
+ # In this case we don't actually care about the exact exception, and why it was failing
447
+ # because either way, we'll have to do a fresh login, where we do the actual error handling
441
448
  end
442
449
  end
443
450
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.69.0.beta.20171207010003
4
+ version: 2.69.0.beta.20171208010004
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2017-12-07 00:00:00.000000000 Z
18
+ date: 2017-12-08 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: slack-notifier
@@ -1260,6 +1260,7 @@ files:
1260
1260
  - frameit/lib/frameit/screenshot.rb
1261
1261
  - frameit/lib/frameit/strings_parser.rb
1262
1262
  - frameit/lib/frameit/template_finder.rb
1263
+ - frameit/lib/frameit/trim_box.rb
1263
1264
  - gym/README.md
1264
1265
  - gym/lib/assets/GymfileTemplate
1265
1266
  - gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh