Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ensure git sources are checked out before using them

Fixes #221
  • Loading branch information...
commit 93d2a242400f503f04e692cb51a016d2db79b057 1 parent 33154fd
@joshbuddy joshbuddy authored indirect committed
Showing with 18 additions and 1 deletion.
  1. +6 −1 lib/bundler/source.rb
  2. +12 −0 spec/install/git_spec.rb
View
7 lib/bundler/source.rb
@@ -318,7 +318,7 @@ def cache_path
end
def cache
- if cache_path.exist?
+ if cached?
Bundler.ui.info "Updating #{uri}"
in_cache { git %|fetch --quiet "#{uri}" master:master| }
else
@@ -342,7 +342,12 @@ def revision
@revision ||= in_cache { git("rev-parse #{ref}").strip }
end
+ def cached?
+ cache_path.exist?
+ end
+
def in_cache(&blk)
+ cache unless cached?
Dir.chdir(cache_path, &blk)
end
end
View
12 spec/install/git_spec.rb
@@ -256,4 +256,16 @@
should_be_installed "foo 1.0"
end
+
+ it "notices when you change the repo url in the Gemfile" do
+ build_git "foo_one"
+ build_git "foo_two"
+ install_gemfile %|gem "foo", "1.0", :git => "#{lib_path('foo_one-1.0')}"|
+ gemfile %|gem "foo", "1.0", :git => "#{lib_path('foo_two-1.0')}"|
+ bundle :lock
+
+ err.should be_empty
+ out.should match(/could not find gem 'foo/i)
+ out.should match(/run `bundle install`/i)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.