def install_gem_from_spec(spec, standalone = false, worker = 0)
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)
Bundler.ui.info install_message
Bundler.ui.debug debug_message if debug_message
spec_info = "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
Bundler.ui.debug spec_info
end
if Bundler.settings[:bin] && standalone
generate_standalone_bundler_executable_stubs(spec)
elsif Bundler.settings[:bin]
generate_bundler_executable_stubs(spec, :force => true)
end
FileUtils.rm_rf(Bundler.tmp)
post_install_message
rescue Exception => e
raise e if e.is_a?(Bundler::InstallHookError) || e.is_a?(Bundler::SecurityError)
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