fastlane_core 0.13.1 → 0.14.0
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 +4 -4
- data/lib/fastlane_core.rb +1 -0
- data/lib/fastlane_core/command_executor.rb +57 -0
- data/lib/fastlane_core/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c2d0f44a0527c60c0e31c662fb6e949f4942c4b2
|
|
4
|
+
data.tar.gz: 1051b6f80923c98a5f5bfa7d465738eb7a58ac83
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 871539a68657decdfb005c1eb1be865164bcba545ff88313035cfa64ac1dba093df3fd5f677dbe6fc5bfb9f938c4c0e065051d28509ea8d9e0205ea101516f35
|
|
7
|
+
data.tar.gz: 2abceff335cebc424bd54f645ba2ce84d249426c98cf635da0db472086a7f12923a5cb97a9624fc8c0a993fbb9c60f23afd5ef8ac504571cec0fd6bbec1ca3fe
|
data/lib/fastlane_core.rb
CHANGED
|
@@ -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
|
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.
|
|
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
|