diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-06-16 22:02:47 -0400 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-06-27 17:25:35 +0200 |
commit | 2c9f3272b9107e0c090ce472e4437f8b614e2d4f (patch) | |
tree | 5cc8edd8b259da03f5825f4592bb7c6d3dbe6865 | |
parent | fb3e6eac3d61b4232382d35e230cdf79ddc64a9e (diff) | |
download | bundler-2c9f3272b9107e0c090ce472e4437f8b614e2d4f.tar.gz |
Put the global gem cache behind a feature flag
-rw-r--r-- | lib/bundler/feature_flag.rb | 1 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 1 | ||||
-rw-r--r-- | lib/bundler/source/rubygems.rb | 1 | ||||
-rw-r--r-- | man/bundle-config.ronn | 3 | ||||
-rw-r--r-- | spec/install/global_cache_spec.rb | 2 |
5 files changed, 8 insertions, 0 deletions
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index ee93773c2f..b2b1ef3f99 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -29,6 +29,7 @@ module Bundler settings_flag(:allow_bundler_dependency_conflicts) { bundler_2_mode? } settings_flag(:allow_offline_install) { bundler_2_mode? } settings_flag(:error_on_stderr) { bundler_2_mode? } + settings_flag(:global_gem_cache) { bundler_2_mode? } settings_flag(:init_gems_rb) { bundler_2_mode? } settings_flag(:only_update_to_newer_versions) { bundler_2_mode? } settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") } diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 078c517919..d91f697f70 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -22,6 +22,7 @@ module Bundler frozen gem.coc gem.mit + global_gem_cache ignore_messages init_gems_rb major_deprecations diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 0be29500b4..70ec8c60f8 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -516,6 +516,7 @@ module Bundler # @return [Pathname] The global cache path. # def download_cache_path(spec) + return unless Bundler.feature_flag.global_gem_cache? return unless remote = spec.remote return unless cache_slug = remote.cache_slug diff --git a/man/bundle-config.ronn b/man/bundle-config.ronn index 9fc62edae3..de041b7ab8 100644 --- a/man/bundle-config.ronn +++ b/man/bundle-config.ronn @@ -237,6 +237,9 @@ learn more about their operation in [bundle install(1)][bundle-install]. * `allow_bundler_dependency_conflicts` (`BUNDLE_ALLOW_BUNDLER_DEPENDENCY_CONFLICTS`): Allow resolving to specifications that have dependencies on `bundler` that are incompatible with the running Bundler version. +* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`): + Whether Bundler should cache all gems globally, rather than locally to the + installing Ruby installation. In general, you should set these settings per-application by using the applicable flag to the [bundle install(1)][bundle-install] or [bundle package(1)][bundle-package] command. diff --git a/spec/install/global_cache_spec.rb b/spec/install/global_cache_spec.rb index f9c0d7146f..c48bb1bd89 100644 --- a/spec/install/global_cache_spec.rb +++ b/spec/install/global_cache_spec.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true RSpec.describe "global gem caching" do + before { bundle! "config global_gem_cache true" } + describe "using the cross-application user cache" do let(:source) { "http://localgemserver.test" } let(:source2) { "http://gemserver.example.org" } |