fastlane 2.69.0.beta.20171208010004 → 2.69.0.beta.20171209010003

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: 3b3c2b5cbef74d7bad0828ec4fe2decf402fc5fa
4
- data.tar.gz: d0ac8dcc81ba78412ed83ca48a65028dd763b919
3
+ metadata.gz: cbfa8d3d26ee4860fef743149e93dc768eef5061
4
+ data.tar.gz: ba67896158ebdc6f33944aaea9fe5c3c683f44d2
5
5
  SHA512:
6
- metadata.gz: 3f09cb8afd547b0c4f3750774e6ac16c2054feda350ab4dab37ff32cbf58c39f320d0f4112c10c100b76ec86ea2d7b63717b07546420442a4371986d468c53f0
7
- data.tar.gz: cca562e98a5de53bc8de2287ed060ede6a441dabf9348d614896ebc8ddfa703192780137d5a899bf20e105a19a28218fdff81a06e1564ad2cebc95e1d6cedbda
6
+ metadata.gz: be8e9616aa60ec5b6cdaa5db729b3b4ccd217224e16f6d8a9f7b5e11f1314e65b8e490e5aa88e442cd00572113742b2a469238978a9cf12ba83322fd18f5d908
7
+ data.tar.gz: 56b8ccaad3121ae3c778dbcceb569db50cccb0456030de4039873f63c5d8d55773aa976b9bb7801896b8e883a1d54043d1a322c95c35fc9e368105ab17b5d07a
@@ -1,4 +1,5 @@
1
1
  require 'fastlane/actions/actions_helper'
2
+ require 'forwardable'
2
3
 
3
4
  module Fastlane
4
5
  class Action
@@ -20,6 +21,11 @@ module Fastlane
20
21
 
21
22
  class << self
22
23
  attr_accessor :runner
24
+
25
+ extend Forwardable
26
+
27
+ # to allow a simple `sh` in the custom actions
28
+ def_delegator Actions, :sh_control_output, :sh
23
29
  end
24
30
 
25
31
  def self.run(params)
@@ -93,11 +99,6 @@ module Fastlane
93
99
  self.action_name
94
100
  end
95
101
 
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)
99
- end
100
-
101
102
  # Documentation category, available values defined in AVAILABLE_CATEGORIES
102
103
  def self.category
103
104
  :undefined
@@ -160,7 +160,7 @@ module Fastlane
160
160
  FastlaneCore::ConfigItem.new(key: :platform,
161
161
  short_option: "-p",
162
162
  env_name: "DOWNLOAD_DSYMS_PLATFORM",
163
- description: "The app platform for dSYMs you wish to download",
163
+ description: "The app platform for dSYMs you wish to download (ios, appletvos)",
164
164
  optional: true,
165
165
  default_value: :ios),
166
166
  FastlaneCore::ConfigItem.new(key: :version,
@@ -174,10 +174,10 @@ module Fastlane
174
174
  end
175
175
 
176
176
  # Execute shell command
177
- def sh(*command, log: true, error_callback: nil)
177
+ def sh(*command, log: true, error_callback: nil, &b)
178
178
  command_header = log ? Actions.shell_command_from_args(*command) : "shell command"
179
179
  Actions.execute_action(command_header) do
180
- Actions.sh_no_action(*command, log: log, error_callback: error_callback)
180
+ Actions.sh_no_action(*command, log: log, error_callback: error_callback, &b)
181
181
  end
182
182
  end
183
183
 
@@ -8,18 +8,22 @@ 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, &b)
12
+ sh_control_output(*command, print_command: log, print_command_output: log, error_callback: error_callback, &b)
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, &b)
16
+ sh_control_output(*command, print_command: log, print_command_output: log, error_callback: error_callback, &b)
17
17
  end
18
18
 
19
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
+ # @yield [status, result, cmd] The return status of the command, all output from the command and an equivalent shell command
24
+ # @yieldparam [Process::Status] status A Process::Status indicating the status of the completed command
25
+ # @yieldparam [String] result The complete output to stdout and stderr of the completed command
26
+ # @yieldparam [String] cmd A shell command equivalent to the arguments passed
23
27
  def self.sh_control_output(*command, print_command: true, print_command_output: true, error_callback: nil)
24
28
  print_command = print_command_output = true if $troubleshoot
25
29
  # Set the encoding first, the user might have set it wrong
@@ -31,8 +35,8 @@ module Fastlane
31
35
  UI.command(shell_command) if print_command
32
36
 
33
37
  result = ''
38
+ exit_status = nil
34
39
  if Helper.sh_enabled?
35
- exit_status = nil
36
40
 
37
41
  # The argument list is passed directly to Open3.popen2e, which
38
42
  # handles the variadic argument list in the same way as Kernel#spawn.
@@ -48,20 +52,25 @@ module Fastlane
48
52
  UI.command_output(line.strip) if print_command_output
49
53
  result << line
50
54
  end
51
- exit_status = thread.value.exitstatus
55
+ exit_status = thread.value
52
56
  end
53
57
 
54
- if exit_status != 0
58
+ # Checking Process::Status#exitstatus instead of #success? makes for more
59
+ # testable code. (Tests mock exitstatus only.) This is also consistent
60
+ # with previous implementations of sh and... probably portable to all
61
+ # relevant platforms.
62
+ if exit_status.exitstatus != 0
55
63
  message = if print_command
56
- "Exit status of command '#{shell_command}' was #{exit_status} instead of 0."
64
+ "Exit status of command '#{shell_command}' was #{exit_status.exitstatus} instead of 0."
57
65
  else
58
- "Shell command exited with exit status #{exit_status} instead of 0."
66
+ "Shell command exited with exit status #{exit_status.exitstatus} instead of 0."
59
67
  end
60
68
  message += "\n#{result}" if print_command_output
61
69
 
62
- if error_callback
70
+ if error_callback || block_given?
63
71
  UI.error(message)
64
- error_callback.call(result)
72
+ # block notified below, on success or failure
73
+ error_callback && error_callback.call(result)
65
74
  else
66
75
  UI.shell_error!(message)
67
76
  end
@@ -70,6 +79,12 @@ module Fastlane
70
79
  result << shell_command # only for the tests
71
80
  end
72
81
 
82
+ if block_given?
83
+ # Avoid yielding nil in tests. $? will be meaningless, but calls to
84
+ # it will not crash. There is no Process::Status.new. The alternative
85
+ # is to move this inside the sh_enabled? check and not yield in tests.
86
+ return yield exit_status || $?, result, shell_command
87
+ end
73
88
  result
74
89
  rescue => ex
75
90
  raise ex
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
- VERSION = '2.69.0.beta.20171208010004'.freeze
2
+ VERSION = '2.69.0.beta.20171209010003'.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
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.20171208010004
4
+ version: 2.69.0.beta.20171209010003
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-08 00:00:00.000000000 Z
18
+ date: 2017-12-09 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: slack-notifier