summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerence Lee <hone02@gmail.com>2012-08-08 17:25:14 -0700
committerTerence Lee <hone02@gmail.com>2012-08-08 17:25:14 -0700
commit7b7e558925ecbcf2b37d37e1f8a5da9223c73359 (patch)
tree9f8b2dce144cc3d14eff8e3915db1ade6ae41fca
parent2f5a1442142609896b86bb95510c7309a0f66648 (diff)
downloadbundler-7b7e558925ecbcf2b37d37e1f8a5da9223c73359.tar.gz
don't remove git sources with `clean`
-rw-r--r--lib/bundler/runtime.rb3
-rw-r--r--spec/other/clean_spec.rb25
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 7a759a534e..87644ccf59 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -120,7 +120,8 @@ module Bundler
gem_files = Dir["#{Gem.dir}/cache/*.gem"]
gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"]
spec_gem_paths = []
- spec_git_paths = []
+ # need to keep git sources around
+ spec_git_paths = @definition.sources.select {|s| s.is_a?(Bundler::Source::Git) }.map {|s| s.path.to_s }
spec_git_cache_dirs = []
spec_gem_executables = []
spec_cache_paths = []
diff --git a/spec/other/clean_spec.rb b/spec/other/clean_spec.rb
index aa72ab8ef6..c6219e0503 100644
--- a/spec/other/clean_spec.rb
+++ b/spec/other/clean_spec.rb
@@ -232,6 +232,31 @@ describe "bundle clean" do
vendored_gems("bundler/gems/rails-#{revision[0..11]}").should exist
end
+ it "does not remove git sources that are in without groups" do
+ build_git "foo", :path => lib_path("foo")
+ git_path = lib_path('foo')
+ revision = revision_for(git_path)
+
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack", "1.0.0"
+ group :test do
+ git "#{git_path}", :ref => "#{revision}" do
+ gem "foo"
+ end
+ end
+ G
+ bundle "install --path vendor/bundle --without test"
+
+ bundle :clean
+
+ out.should eq("")
+ vendored_gems("bundler/gems/foo-#{revision[0..11]}").should exist
+ digest = Digest::SHA1.hexdigest(git_path.to_s)
+ vendored_gems("cache/bundler/git/foo-#{digest}").should_not exist
+ end
+
it "displays an error when used without --path" do
install_gemfile <<-G
source "file://#{gem_repo1}"