class Bundler::Installer

def install_gem_from_spec(spec, standalone = false, worker = 0)

def install_gem_from_spec(spec, standalone = false, worker = 0)
  # Fetch the build settings, if there are any
  settings             = Bundler.settings["build.#{spec.name}"]
  install_message      = nil
  post_install_message = nil
  debug_message        = nil
  Bundler.rubygems.with_build_args [settings] do
    install_message, post_install_message, debug_message = spec.source.install(spec)
    if install_message.include? 'Installing'
      Bundler.ui.confirm install_message
    else
      Bundler.ui.info install_message
    end
    Bundler.ui.debug debug_message if debug_message
    Bundler.ui.debug "#{worker}:  #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
  end
  if Bundler.settings[:bin] && standalone
    generate_standalone_bundler_executable_stubs(spec)
  elsif Bundler.settings[:bin]
    generate_bundler_executable_stubs(spec, :force => true)
  end
  post_install_message
rescue Exception => e
  # if install hook failed or gem signature is bad, just die
  raise e if e.is_a?(Bundler::InstallHookError) || e.is_a?(Bundler::SecurityError)
  # other failure, likely a native extension build failure
  Bundler.ui.info ""
  Bundler.ui.warn "#{e.class}: #{e.message}"
  msg = "An error occurred while installing #{spec.name} (#{spec.version}),"
  msg << " and Bundler cannot continue."
  unless spec.source.options["git"]
    msg << "\nMake sure that `gem install"
    msg << " #{spec.name} -v '#{spec.version}'` succeeds before bundling."
  end
  Bundler.ui.debug e.backtrace.join("\n")
  raise Bundler::InstallError, msg
end