Sha256: 7057dd6e6cd7207bb00ff82917836f7f8341923f7333dd56bf291c523e58bc01

Contents?: true

Size: 749 Bytes

Versions: 2

Compression:

Stored size: 749 Bytes

Contents

require "aruba/api/environment"

module Aruba
  module Api
    module Bundler
      include Environment

      # Unset variables used by bundler
      def unset_bundler_env_vars
        empty_env = with_environment { with_unbundled_env { ENV.to_h } }
        aruba_env = aruba.environment.to_h
        (aruba_env.keys - empty_env.keys).each do |key|
          delete_environment_variable key
        end
        empty_env.each do |k, v|
          set_environment_variable k, v
        end
      end

      private

      def with_unbundled_env(&block)
        if ::Bundler.respond_to?(:with_unbundled_env)
          ::Bundler.with_unbundled_env(&block)
        else
          ::Bundler.with_clean_env(&block)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aruba-1.1.1 lib/aruba/api/bundler.rb
aruba-1.1.0 lib/aruba/api/bundler.rb