Module: Ufo::Execute

Included in:
DockerBuilder, DockerCleaner
Defined in:
lib/ufo/execute.rb

Instance Method Summary collapse

Instance Method Details

#execute(command, local_options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ufo/execute.rb', line 3

def execute(command, local_options={})
  command = "cd #{@project_root} && #{command}"
  # local_options[:live] overrides the global @options[:noop]
  if @options[:noop] && !local_options[:live]
    say "NOOP: #{command}"
    result = true # always success with no noop for specs
  else
    if local_options[:use_system]
      result = system(command)
    else
      result = `#{command}`
    end
  end
  result
end