diff options
author | André Arko <mail@arko.net> | 2015-05-03 11:46:56 -0700 |
---|---|---|
committer | André Arko <mail@arko.net> | 2015-05-03 11:46:56 -0700 |
commit | 954388e96ec8d465249cca01571a7362df20ec84 (patch) | |
tree | 94d1ec6d99a882fe10495c3d92d41aa51f445198 | |
parent | 0c57d06335675576635d6378b9a7b8859ded2103 (diff) | |
parent | e5002e5030cc2e8142ede153afe4c28a8db21ff0 (diff) | |
download | bundler-954388e96ec8d465249cca01571a7362df20ec84.tar.gz |
Merge pull request #3610 from bundler/seg-standalone-builtin
[RubyGems] Allow standalone caching of builtin gems
-rw-r--r-- | lib/bundler/installer.rb | 6 | ||||
-rw-r--r-- | lib/bundler/source/rubygems.rb | 15 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 0e72f5a17b..d0a7dc4fda 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -102,13 +102,15 @@ module Bundler 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 diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 684c6c2062..cba3763b47 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -85,9 +85,22 @@ module Bundler 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 |