Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Check for 7 char length git revision for bundle clean #1491

Merged
merged 1 commit into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 31 additions and 1 deletion.
  1. +1 −1  lib/bundler/runtime.rb
  2. +30 −0 spec/other/clean_spec.rb
View
2  lib/bundler/runtime.rb
@@ -146,7 +146,7 @@ def clean
specs.each do |spec|
spec_gem_paths << spec.full_gem_path
# need to check here in case gems are nested like for the rails git repo
- md = %r{(.+bundler/gems/.+-[a-f0-9]{12})}.match(spec.full_gem_path)
+ md = %r{(.+bundler/gems/.+-[a-f0-9]{7,12})}.match(spec.full_gem_path)
spec_git_paths << md[1] if md
spec_gem_executables << spec.executables.collect do |executable|
"#{Gem.dir}/#{spec.bindir}/#{executable}"
View
30 spec/other/clean_spec.rb
@@ -394,4 +394,34 @@ def should_not_have_gems(*gems)
out.should_not include("foo (1.0)")
out.should include("rack (1.0.0)")
end
+
+ it "cleans git gems with a 7 length git revision" do
+ build_git "foo"
+ revision = revision_for(lib_path("foo-1.0"))
+
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
+ G
+
+ bundle "install --path vendor/bundle --no-clean"
+
+ # mimic 7 length git revisions in Gemfile.lock
+ gemfile_lock = File.read(bundled_app('Gemfile.lock')).split("\n")
+ gemfile_lock.each_with_index do |line, index|
+ gemfile_lock[index] = line[0..(11 + 7)] if line.include?(" revision:")
+ end
+ File.open(bundled_app('Gemfile.lock'), 'w') do |file|
+ file.print gemfile_lock.join("\n")
+ end
+
+ bundle "install --path vendor/bundle --no-clean"
+
+ bundle :clean
+
+ out.should_not include("Removing foo (1.0 #{revision[0..6]})")
+
+ vendored_gems("bundler/gems/foo-1.0-#{revision[0..6]}").should exist
+ end
end
Something went wrong with that request. Please try again.