Skip to content

Commit

Permalink
Remove warning about caching path and git dependencies
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
deivid-rodriguez committed Aug 28, 2020
1 parent 127fa58 commit 8d3f665
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 38 deletions.
6 changes: 0 additions & 6 deletions bundler/lib/bundler/cli/cache.rb
Expand Up @@ -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
4 changes: 0 additions & 4 deletions bundler/lib/bundler/definition.rb
Expand Up @@ -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
Expand Down
26 changes: 0 additions & 26 deletions bundler/spec/cache/git_spec.rb
Expand Up @@ -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"

Expand Down
16 changes: 14 additions & 2 deletions bundler/spec/cache/path_spec.rb
Expand Up @@ -91,18 +91,30 @@
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
gem "foo", :path => '#{lib_path("foo-1.0")}'
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"

Expand Down

0 comments on commit 8d3f665

Please sign in to comment.