Module: TestBoosters::Shell

Defined in:
lib/test_boosters/shell.rb

Class Method Summary collapse

Class Method Details

.display_files(title, files) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/test_boosters/shell.rb', line 36

def display_files(title, files)
  puts "#{title} (#{files.count} files):"
  puts

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

  puts "\n"
end

.display_title(title) ⇒ Object



30
31
32
33
34
# File 'lib/test_boosters/shell.rb', line 30

def display_title(title)
  puts
  puts "=== #{title} ===="
  puts
end

.evaluate(command) ⇒ Object



22
23
24
# File 'lib/test_boosters/shell.rb', line 22

def evaluate(command)
  with_clean_env { `#{command}` }
end

.execute(command, options = {}) ⇒ Object

:reek:TooManyStatements



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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

  exit_status = $?.exitstatus

  TestBoosters::Logger.info("Command finished, exit status : #{exit_status}")

  exit_status
end

.with_clean_envObject



26
27
28
# File 'lib/test_boosters/shell.rb', line 26

def with_clean_env
  defined?(Bundler) ? Bundler.with_clean_env { yield } : yield
end