Permalink
Browse files

#1473 fix bundle clean output for git repos

  • Loading branch information...
1 parent 403e7c2 commit 8b5c9b39c4c160d84e2d9b02f844a2ba3bd3abcb @hone hone committed Nov 30, 2011
Showing with 17 additions and 18 deletions.
  1. +2 −3 lib/bundler/runtime.rb
  2. +15 −15 spec/other/clean_spec.rb
View
5 lib/bundler/runtime.rb
@@ -185,10 +185,9 @@ def clean
FileUtils.rm_rf(gem_dir)
parts = full_name.split('-')
- name = parts[0..-3].join('-')
+ name = parts[0..-2].join('-')
revision = parts[-1]
- version = parts[-2]
- output = "#{name} (#{version} #{revision})"
+ output = "#{name} (#{revision})"
Bundler.ui.info "Removing #{output}"
View
30 spec/other/clean_spec.rb
@@ -146,9 +146,9 @@ def should_not_have_gems(*gems)
end
it "removes unused git gems" do
- build_git "foo"
- revision = revision_for(lib_path("foo-1.0"))
- git_path = lib_path('foo-1.0')
+ build_git "foo", :path => lib_path("foo")
+ git_path = lib_path('foo')
+ revision = revision_for(git_path)
gemfile <<-G
source "file://#{gem_repo1}"
@@ -170,44 +170,44 @@ def should_not_have_gems(*gems)
bundle :clean
- out.should eq("Removing foo (1.0 #{revision[0..11]})")
+ out.should eq("Removing foo (#{revision[0..11]})")
vendored_gems("gems/rack-1.0.0").should exist
- vendored_gems("bundler/gems/foo-1.0-#{revision[0..11]}").should_not exist
+ vendored_gems("bundler/gems/foo-#{revision[0..11]}").should_not exist
digest = Digest::SHA1.hexdigest(git_path.to_s)
- vendored_gems("cache/bundler/git/foo-1.0-#{digest}").should_not exist
+ vendored_gems("cache/bundler/git/foo-#{digest}").should_not exist
vendored_gems("specifications/rack-1.0.0.gemspec").should exist
vendored_gems("bin/rackup").should exist
end
it "removes old git gems" do
- build_git "foo"
- revision = revision_for(lib_path("foo-1.0"))
+ build_git "foo-bar", :path => lib_path("foo-bar")
+ revision = revision_for(lib_path("foo-bar"))
gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "1.0.0"
- git "#{lib_path('foo-1.0')}" do
- gem "foo"
+ git "#{lib_path('foo-bar')}" do
+ gem "foo-bar"
end
G
bundle "install --path vendor/bundle --no-clean"
- update_git "foo"
- revision2 = revision_for(lib_path("foo-1.0"))
+ update_git "foo", :path => lib_path("foo-bar")
+ revision2 = revision_for(lib_path("foo-bar"))
bundle "update --no-clean"
bundle :clean
- out.should eq("Removing foo (1.0 #{revision[0..11]})")
+ out.should eq("Removing foo-bar (#{revision[0..11]})")
vendored_gems("gems/rack-1.0.0").should exist
- vendored_gems("bundler/gems/foo-1.0-#{revision[0..11]}").should_not exist
- vendored_gems("bundler/gems/foo-1.0-#{revision2[0..11]}").should exist
+ vendored_gems("bundler/gems/foo-bar-#{revision[0..11]}").should_not exist
+ vendored_gems("bundler/gems/foo-bar-#{revision2[0..11]}").should exist
vendored_gems("specifications/rack-1.0.0.gemspec").should exist

0 comments on commit 8b5c9b3

Please sign in to comment.