def install_gem_from_spec(spec, standalone = false, worker = 0, force = false)
settings = Bundler.settings["build.#{spec.name}"]
install_options = { :force => force, :ensure_builtin_gems_cached => standalone }
post_install_message = nil
if settings
Bundler.rubygems.with_build_args [settings] do
post_install_message = spec.source.install(spec, install_options)
end
else
post_install_message = spec.source.install(spec, install_options)
end
Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
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 Errno::ENOSPC
raise Bundler::InstallError, "Your disk is out of space. Free some " \
"space to be able to install your bundle."
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