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
- #execute(command, options = {}) ⇒ Object
-
#user_params ⇒ Object
TODO: remove these other metohds Custom user params from .ufo/params.yml Param keys are symbols for the aws-sdk calls.
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, ={}) log = [: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 |