Sha256: b8704a793cf35a1f2a597baeb62103baa69e9a3713ea73ca070d9d188f44bce3

Contents?: true

Size: 524 Bytes

Versions: 5

Compression:

Stored size: 524 Bytes

Contents

module Terraspace::Util
  module Sh
    # requires @mod to be set
    def sh(command, options={})
      exit_on_fail = options[:exit_on_fail].nil? ? true : options[:exit_on_fail]
      env = options[:env] || {}
      env.stringify_keys!

      logger.info "=> #{command}"
      return if ENV['TS_TEST']

      success = system(env, command, chdir: @mod.cache_dir)
      unless success
        logger.info "Error running command: #{command}".color(:red)
        exit $?.exitstatus if exit_on_fail
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
terraspace-0.2.4 lib/terraspace/util/sh.rb
terraspace-0.2.3 lib/terraspace/util/sh.rb
terraspace-0.2.2 lib/terraspace/util/sh.rb
terraspace-0.2.1 lib/terraspace/util/sh.rb
terraspace-0.2.0 lib/terraspace/util/sh.rb