Module: Syncoku::Runnable

Included in:
CaptureBackup, Control, Local, LocalDb, Remote, RemoteDb
Defined in:
lib/syncoku/runnable.rb

Instance Method Summary collapse

Instance Method Details

#run_command(command) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/syncoku/runnable.rb', line 4

def run_command(command)
  Bundler.with_clean_env {
    out = `#{command}`
    if $?.success?
      out
    else
      puts "Error running command:"
      puts command
      puts out
      exit $?.exitstatus
    end
  }
end

#test_command(command) ⇒ Object



18
19
20
21
22
23
# File 'lib/syncoku/runnable.rb', line 18

def test_command(command)
  Bundler.with_clean_env {
    `#{command} 2> /dev/null`
    $?.success?
  }
end