fastlane_core 0.13.1 → 0.14.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: c55d019bd766d0ce92e3f8b3334be63e3f8a7a4d
4
- data.tar.gz: 01814e896e25c5d79501dc1c6aade3dc40fc268f
3
+ metadata.gz: c2d0f44a0527c60c0e31c662fb6e949f4942c4b2
4
+ data.tar.gz: 1051b6f80923c98a5f5bfa7d465738eb7a58ac83
5
5
  SHA512:
6
- metadata.gz: dff01817eb4e419acc64fd00b80805d95105e9d77a78db26232a96954cea8446095b89970858ae9ae83afb9f8e4190613d862fd7c4030b40326598efe2985229
7
- data.tar.gz: 8a964fe17413dac10113804263d3fd8bfc580af2cf94060d0b4586377e131c408c13a65586c72df48f3a7d52c547586bb13902b6cf474ddab7891489fc431101
6
+ metadata.gz: 871539a68657decdfb005c1eb1be865164bcba545ff88313035cfa64ac1dba093df3fd5f677dbe6fc5bfb9f938c4c0e065051d28509ea8d9e0205ea101516f35
7
+ data.tar.gz: 2abceff335cebc424bd54f645ba2ce84d249426c98cf635da0db472086a7f12923a5cb97a9624fc8c0a993fbb9c60f23afd5ef8ac504571cec0fd6bbec1ca3fe
data/lib/fastlane_core.rb CHANGED
@@ -9,6 +9,7 @@ require 'fastlane_core/cert_checker'
9
9
  require 'fastlane_core/ipa_file_analyser'
10
10
  require 'fastlane_core/itunes_transporter'
11
11
  require 'fastlane_core/provisioning_profile'
12
+ require 'fastlane_core/command_executor'
12
13
 
13
14
  # Third Party code
14
15
  require 'colored'
@@ -0,0 +1,57 @@
1
+ module FastlaneCore
2
+ # Executes commands and takes care of error handling and more
3
+ class CommandExecutor
4
+ class << self
5
+ # @param command [String] The command to be executed
6
+ # @param print_all [Boolean] Do we want to print out the command output while running?
7
+ # @param print_command [Boolean] Should we print the command that's being executed
8
+ # @param error [Block] A block that's called if an error occurs
9
+ # @return [String] All the output as string
10
+ def execute(command: nil, print_all: false, print_command: true, error: nil)
11
+ print_all = true if $verbose
12
+
13
+ output = []
14
+ command = command.join(" ")
15
+ Helper.log.info command.yellow.strip if print_command
16
+
17
+ puts "\n-----".cyan if print_all
18
+
19
+ last_length = 0
20
+ begin
21
+ PTY.spawn(command) do |stdin, stdout, pid|
22
+ stdin.each do |l|
23
+ line = l.strip # strip so that \n gets removed
24
+ output << line
25
+
26
+ next unless print_all
27
+
28
+ current_length = line.length
29
+ spaces = [last_length - current_length, 0].max
30
+ print((line + " " * spaces + "\r").cyan)
31
+ last_length = current_length
32
+ end
33
+ Process.wait(pid)
34
+ puts "-----\n".cyan if print_all
35
+ end
36
+ rescue => ex
37
+ # This could happen when the environment is wrong:
38
+ # > invalid byte sequence in US-ASCII (ArgumentError)
39
+ output << ex.to_s
40
+ o = output.join("\n")
41
+ puts o
42
+ error.call(o)
43
+ end
44
+
45
+ # Exit status for build command, should be 0 if build succeeded
46
+ # Disabled Rubocop, since $CHILD_STATUS just is not the same
47
+ status = $?.exitstatus # rubocop:disable Style/SpecialGlobalVars
48
+ if status != 0
49
+ o = output.join("\n")
50
+ puts o # the user has the right to see the raw output
51
+ Helper.log.info "Exit status: #{status}"
52
+ error.call(o)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.13.1"
2
+ VERSION = "0.14.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
@@ -287,6 +287,7 @@ files:
287
287
  - README.md
288
288
  - lib/fastlane_core.rb
289
289
  - lib/fastlane_core/cert_checker.rb
290
+ - lib/fastlane_core/command_executor.rb
290
291
  - lib/fastlane_core/configuration/commander_generator.rb
291
292
  - lib/fastlane_core/configuration/config_item.rb
292
293
  - lib/fastlane_core/configuration/configuration.rb