module Bundler

def configure_gem_home_and_path

def configure_gem_home_and_path
  if path = settings[:path]
    ENV['GEM_HOME'] = File.expand_path(path, root)
    ENV['GEM_PATH'] = ''
  else
    gem_home, gem_path = Gem.dir, Gem.path
    ENV["GEM_PATH"] = [gem_home, gem_path].flatten.compact.join(File::PATH_SEPARATOR)
    ENV["GEM_HOME"] = bundle_path.to_s
  end
  Gem.clear_paths
end