Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

[RubyGems] Allow standalone caching of builtin gems #3610

Merged
merged 2 commits into from
May 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/bundler/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ def install_gem_from_spec(spec, standalone = false, worker = 0, force = false)
settings = Bundler.settings["build.#{spec.name}"]
messages = nil

install_options = { :force => force, :ensure_builtin_gems_cached => standalone }

if settings
# Build arguments are global, so this is mutexed
Bundler.rubygems.with_build_args [settings] do
messages = spec.source.install(spec, force)
messages = spec.source.install(spec, install_options)
end
else
messages = spec.source.install(spec, force)
messages = spec.source.install(spec, install_options)
end

install_message, post_install_message, debug_message = *messages
Expand Down
15 changes: 14 additions & 1 deletion lib/bundler/source/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,22 @@ def specs
end
end

def install(spec, force = false)
def install(spec, opts = {})
force = opts[:force]
ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]

if ensure_builtin_gems_cached && builtin_gem?(spec)
if !cached_path(spec)
cached_built_in_gem(spec) unless spec.remote
force = true
else
spec.loaded_from = loaded_from(spec)
end
end

return ["Using #{version_message(spec)}", nil] if installed_specs[spec].any? && !force


# Download the gem to get the spec, because some specs that are returned
# by rubygems.org are broken and wrong.
if spec.remote
Expand Down