Module: Bootstrap::Db::RakeHelper

Defined in:
lib/bootstrap/db/rake_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_and_execute(command) ⇒ Object



9
10
11
12
# File 'lib/bootstrap/db/rake_helper.rb', line 9

def display_and_execute(command)
  log(command) if ENV['VERBOSE'] == 'true'
  execute_command(command)
end

#execute_command(command) ⇒ Object



14
15
16
17
18
# File 'lib/bootstrap/db/rake_helper.rb', line 14

def execute_command(command)
  output = `#{command} 2>&1`
  raise "Error : #{output}" unless $?.success?
  output
end

#log(output) ⇒ Object



5
6
7
# File 'lib/bootstrap/db/rake_helper.rb', line 5

def log(output)
  STDERR.puts "[bootstrap-db] #{output}"
end