module Bundler

def configure_gem_home_and_path

def configure_gem_home_and_path
  blank_home = ENV['GEM_HOME'].nil? || ENV['GEM_HOME'].empty?
  if settings[:disable_shared_gems]
    ENV['GEM_PATH'] = ''
  elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s
    possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
    paths = possibles.flatten.compact.uniq.reject { |p| p.empty? }
    ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
  end
  configure_gem_home
  bundle_path
end