module TestBoosters::Shell

Public Instance Methods

display_files(title, files) click to toggle source
# File lib/test_boosters/shell.rb, line 41
def display_files(title, files)
  puts "#{title} (#{files.count} files):"
  puts

  files.each { |file| puts "- #{file}" }

  puts "\n"
end
display_title(title) click to toggle source
# File lib/test_boosters/shell.rb, line 35
def display_title(title)
  puts
  puts "=== #{title} ===="
  puts
end
evaluate(command) click to toggle source
# File lib/test_boosters/shell.rb, line 27
def evaluate(command)
  with_clean_env { `#{command}` }
end
execute(command, options = {}) click to toggle source

:reek: TooManyStatements

# File lib/test_boosters/shell.rb, line 6
def execute(command, options = {})
  TestBoosters::Logger.info("Running command: #{command}")

  puts command unless options[:silent] == true

  with_clean_env do
    system(command)
  end

  signaled    = $?.signaled?
  termsig     = $?.termsig
  exited      = $?.exited?
  exit_status = $?.exitstatus

  TestBoosters::Logger.info("Command signaled with: #{termsig}") if signaled
  TestBoosters::Logger.info("Command exited : #{exited}")
  TestBoosters::Logger.info("Command finished, exit status : #{exit_status}")

  exit_status
end
with_clean_env() { || ... } click to toggle source
# File lib/test_boosters/shell.rb, line 31
def with_clean_env
  defined?(Bundler) ? Bundler.with_clean_env { yield } : yield
end