Module: ShellRunner

Defined in:
lib/helpers/shell_runner.rb

Class Method Summary collapse

Class Method Details

.run(title, commands) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/helpers/shell_runner.rb', line 2

def self.run(title, commands)
  return unless commands&.any?
  Printer.put_header(title)
  successful = true
  commands.each do |command|
    system(command)
    if $?.exitstatus != 0
      successful = false
      Printer.puts_failure("#{command} returned non-zero status code: #{$?.exitstatus}")
      break
    end
  end
  Printer.put_footer(successful)
  exit 1 unless successful
end