class Bundler::Installer

def install_gem_from_spec(spec)

def install_gem_from_spec(spec)
  # Download the gem to get the spec, because some specs that are returned
  # by rubygems.org are broken and wrong.
  spec.source.fetch(spec) if spec.source.respond_to?(:fetch)
  # Fetch the build settings, if there are any
  settings = Bundler.settings["build.#{spec.name}"]
  Bundler.rubygems.with_build_args [settings] do
    spec.source.install(spec)
    Bundler.ui.debug "from #{spec.loaded_from} "
  end
  # newline comes after installing, some gems say "with native extensions"
  Bundler.ui.info ""
  generate_bundler_executable_stubs(spec) if Bundler.settings[:bin]
  FileUtils.rm_rf(Bundler.tmp)
rescue Exception => e
  Bundler.ui.info ""
  Bundler.ui.warn "#{e.class}: #{e.message}"
  msg = "An error occured while installing #{spec.name} (#{spec.version}),"
  msg << " and Bundler cannot continue.\nMake sure that `gem install"
  msg << " #{spec.name} -v '#{spec.version}'` succeeds before bundling."
  raise Bundler::InstallError, msg
end