From 8d3f665f65a0024ade47709a1ba9d807576b8828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 28 Aug 2020 18:08:03 +0200 Subject: [PATCH] Remove warning about caching path and git dependencies Let's consider both use cases equally valid and don't warn any of them. Then change in the default will be signaled by changelog and documentation. --- bundler/lib/bundler/cli/cache.rb | 6 ------ bundler/lib/bundler/definition.rb | 4 ---- bundler/spec/cache/git_spec.rb | 26 -------------------------- bundler/spec/cache/path_spec.rb | 16 ++++++++++++++-- 4 files changed, 14 insertions(+), 38 deletions(-) diff --git a/bundler/lib/bundler/cli/cache.rb b/bundler/lib/bundler/cli/cache.rb index 6b8029e0c077..c14c8877f042 100644 --- a/bundler/lib/bundler/cli/cache.rb +++ b/bundler/lib/bundler/cli/cache.rb @@ -37,12 +37,6 @@ def setup_cache_all all = options.fetch(:all, Bundler.feature_flag.cache_all? || nil) Bundler.settings.set_command_option_if_given :cache_all, all - - if Bundler.definition.has_local_dependencies? && !Bundler.feature_flag.cache_all? - Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \ - "to cache them as well, please pass the --all flag. This will be the default " \ - "on Bundler 3.0." - end end end end diff --git a/bundler/lib/bundler/definition.rb b/bundler/lib/bundler/definition.rb index 4563764a76ec..2c6cfffaa1b6 100644 --- a/bundler/lib/bundler/definition.rb +++ b/bundler/lib/bundler/definition.rb @@ -323,10 +323,6 @@ def has_rubygems_remotes? sources.rubygems_sources.any? {|s| s.remotes.any? } end - def has_local_dependencies? - !sources.path_sources.empty? || !sources.git_sources.empty? - end - def spec_git_paths sources.git_sources.map {|s| File.realpath(s.path) if File.exist?(s.path) }.compact end diff --git a/bundler/spec/cache/git_spec.rb b/bundler/spec/cache/git_spec.rb index d481e006660e..97d73907db32 100644 --- a/bundler/spec/cache/git_spec.rb +++ b/bundler/spec/cache/git_spec.rb @@ -174,32 +174,6 @@ expect(the_bundle).to include_gems "has_submodule 1.0" end - it "displays warning message when detecting git repo in Gemfile", :bundler => "< 3" do - build_git "foo" - - install_gemfile <<-G - gem "foo", :git => '#{lib_path("foo-1.0")}' - G - - bundle :cache - - expect(err).to include("Your Gemfile contains path and git dependencies.") - end - - it "does not display warning message if cache_all is set in bundle config" do - build_git "foo" - - install_gemfile <<-G - gem "foo", :git => '#{lib_path("foo-1.0")}' - G - - bundle "config set cache_all true" - bundle :cache - bundle :cache - - expect(err).not_to include("Your Gemfile contains path and git dependencies.") - end - it "caches pre-evaluated gemspecs" do git = build_git "foo" diff --git a/bundler/spec/cache/path_spec.rb b/bundler/spec/cache/path_spec.rb index 0c84d242b572..c81dda7405e1 100644 --- a/bundler/spec/cache/path_spec.rb +++ b/bundler/spec/cache/path_spec.rb @@ -91,7 +91,7 @@ expect(bundled_app("vendor/cache/foo-1.0")).not_to exist end - it "raises a warning without --all", :bundler => "< 3" do + it "does not cache path gems by default", :bundler => "< 3" do build_lib "foo" install_gemfile <<-G @@ -99,10 +99,22 @@ G bundle :cache - expect(err).to match(/please pass the \-\-all flag/) + expect(err).to be_empty expect(bundled_app("vendor/cache/foo-1.0")).not_to exist end + it "caches path gems by default", :bundler => "3" do + build_lib "foo" + + install_gemfile <<-G + gem "foo", :path => '#{lib_path("foo-1.0")}' + G + + bundle :cache + expect(err).to be_empty + expect(bundled_app("vendor/cache/foo-1.0")).to exist + end + it "stores the given flag" do build_lib "foo"