From 815c67b158400562aeeaca9ce6a96f806b8af5d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 28 Aug 2020 18:05:10 +0200 Subject: [PATCH 1/3] Remove unnecessary backslash --- bundler/lib/bundler/cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundler/lib/bundler/cli.rb b/bundler/lib/bundler/cli.rb index 203f0539cb5d..3f5948dec709 100644 --- a/bundler/lib/bundler/cli.rb +++ b/bundler/lib/bundler/cli.rb @@ -838,7 +838,7 @@ def flag_deprecation(name, flag_name, option) value = options[name] value = value.join(" ").to_s if option.type == :array - Bundler::SharedHelpers.major_deprecation 2,\ + Bundler::SharedHelpers.major_deprecation 2, "The `#{flag_name}` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no longer " \ "do in future versions. Instead please use `bundle config set --local #{name.tr("-", "_")} " \ From 4d802459a60efc44d30f382ab5596351e628e483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 28 Aug 2020 18:05:23 +0200 Subject: [PATCH 2/3] Deprecate `bundle package --all` flag --- bundler/lib/bundler/cli.rb | 6 ++++++ bundler/spec/other/major_deprecation_spec.rb | 22 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/bundler/lib/bundler/cli.rb b/bundler/lib/bundler/cli.rb index 3f5948dec709..8d30001bd480 100644 --- a/bundler/lib/bundler/cli.rb +++ b/bundler/lib/bundler/cli.rb @@ -461,6 +461,12 @@ def outdated(*gems) bundle without having to download any additional gems. D def cache + SharedHelpers.major_deprecation 2, + "The `--all` flag is deprecated because it relies on being " \ + "remembered across bundler invocations, which bundler will no longer " \ + "do in future versions. Instead please use `bundle config set cache_all true`, " \ + "and stop using this flag" if ARGV.include?("--all") + require_relative "cli/cache" Cache.new(options).run end diff --git a/bundler/spec/other/major_deprecation_spec.rb b/bundler/spec/other/major_deprecation_spec.rb index e8884a40b25c..d061ca7064bb 100644 --- a/bundler/spec/other/major_deprecation_spec.rb +++ b/bundler/spec/other/major_deprecation_spec.rb @@ -143,6 +143,28 @@ pending "should fail with a helpful error", :bundler => "3" end + context "bundle cache --all" do + before do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" + G + + bundle "cache --all", :raise_on_error => false + end + + it "should print a deprecation warning", :bundler => "2" do + expect(deprecations).to include( + "The `--all` flag is deprecated because it relies on being " \ + "remembered across bundler invocations, which bundler will no " \ + "longer do in future versions. Instead please use `bundle config set " \ + "cache_all true`, and stop using this flag" + ) + end + + pending "should fail with a helpful error", :bundler => "3" + end + describe "bundle config" do describe "old list interface" do before do From 31f32c744d099096f0353f7646cb249e0c605e04 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 3/3] 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 003ba63ee4f3..c464650592af 100644 --- a/bundler/lib/bundler/definition.rb +++ b/bundler/lib/bundler/definition.rb @@ -319,10 +319,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"