Module: Ufo::Utils::Execute

Included in:
Ecr::Cleaner, Docker::Cleaner, Docker::Concerns, Hooks::Runner
Defined in:
lib/ufo/utils/execute.rb

Instance Method Summary collapse

Instance Method Details

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



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

def execute(command, options={})
  log = options[:log]
  if log
    command += " >> #{log}"
    logger.info "=> #{command}"
    FileUtils.mkdir_p(File.dirname(log))
    File.open(log, 'a') { |f| f.puts "=> #{command}" }
    out = `#{command}`
    success = $?.success?
    unless success
      logger.error out
      exit 1
    end
    out
  else
    logger.info "=> #{command}"
    system(command)
  end
end

#user_paramsObject

TODO: remove these other metohds Custom user params from .ufo/params.yml Param keys are symbols for the aws-sdk calls.



26
27
28
# File 'lib/ufo/utils/execute.rb', line 26

def user_params
  @user_params ||= Param.new.data
end