summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/definition.rb2
-rw-r--r--spec/commands/clean_spec.rb26
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 01ee86a358..d6fbb0b5b7 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -317,7 +317,7 @@ module Bundler
end
def spec_git_paths
- sources.git_sources.map {|s| File.realpath(s.path) }
+ sources.git_sources.map {|s| File.realpath(s.path) if File.exist?(s.path) }.compact
end
def groups
diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb
index 13eebd3baa..7f9f84c104 100644
--- a/spec/commands/clean_spec.rb
+++ b/spec/commands/clean_spec.rb
@@ -863,4 +863,30 @@ RSpec.describe "bundle clean" do
expect(very_simple_binary_extensions_dir).not_to exist
end
+
+ it "keeps git extension directories when excluded by group", :ruby_repo do
+ build_git "very_simple_git_binary", &:add_c_extension
+
+ revision = revision_for(lib_path("very_simple_git_binary-1.0"))
+ short_revision = revision[0..11]
+
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+
+ group :development do
+ gem "very_simple_git_binary", :git => "#{lib_path("very_simple_git_binary-1.0")}", :ref => "#{revision}"
+ end
+ G
+
+ bundle :lock
+ bundle "config set without development"
+ bundle "config set path vendor/bundle"
+ bundle! "install"
+ bundle! :clean
+
+ very_simple_binary_extensions_dir =
+ Pathname.glob("#{vendored_gems}/bundler/gems/extensions/*/*/very_simple_git_binary-1.0-#{short_revision}").first
+
+ expect(very_simple_binary_extensions_dir).to be_nil
+ end
end