summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/source.rb7
-rw-r--r--spec/install/git_spec.rb12
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 92dd575a0c..1ba6f0b7f4 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -318,7 +318,7 @@ module Bundler
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 @@ module Bundler
@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
diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb
index aed101dc76..a8da7d802b 100644
--- a/spec/install/git_spec.rb
+++ b/spec/install/git_spec.rb
@@ -256,4 +256,16 @@ describe "bundle install with git sources" do
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