Sha256: f5330cf38bddbe31df8c929aad0c4b7bc36b8cf3f3e88c34244fd5962a33de71

Contents?: true

Size: 836 Bytes

Versions: 6

Compression:

Stored size: 836 Bytes

Contents

module HerokuTool
  module ThorUtils
    def puts_and_system(cmd)
      puts cmd
      puts "-------------"
      system_with_clean_env cmd
      puts "-------------"
    end

    protected

    def puts_and_exec(cmd)
      puts cmd
      exec_with_clean_env(cmd)
    end

    def system_with_clean_env(cmd)
      if defined?(Bundler) && Bundler.respond_to?(:with_unbundled_env)
        Bundler.with_unbundled_env { system cmd }
      elsif defined?(Bundler)
        Bundler.with_clean_env { system cmd }
      else
        system cmd
      end
    end

    def exec_with_clean_env(cmd)
      if defined?(Bundler) && Bundler.respond_to?(:with_unbundled_env)
        Bundler.with_unbundled_env { `#{cmd}` }
      elsif defined?(Bundler)
        Bundler.with_clean_env { `#{cmd}` }
      else
        `#{cmd}`
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
heroku_tool-0.8.0 lib/heroku_tool/thor_utils.rb
heroku_tool-0.7.1 lib/heroku_tool/thor_utils.rb
heroku_tool-0.7.0 lib/heroku_tool/thor_utils.rb
heroku_tool-0.6.0 lib/heroku_tool/thor_utils.rb
heroku_tool-0.5.0 lib/heroku_tool/thor_utils.rb
heroku_tool-0.4.0 lib/heroku_tool/thor_utils.rb