diff options
author | Joshua Hull <joshbuddy@gmail.com> | 2010-03-26 17:13:22 -0400 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2010-03-30 10:14:05 -0700 |
commit | 128e6b2265006a0aaa652cd4f1de66daa9224af6 (patch) | |
tree | 7fca64c3384f2805a703742bc0974ad0b7cd796c | |
parent | ea9d8e1ab720d2974e507933c8d331ac81a30652 (diff) | |
download | bundler-128e6b2265006a0aaa652cd4f1de66daa9224af6.tar.gz |
Ensure git sources are checked out before using them
Fixes #221
-rw-r--r-- | lib/bundler/source.rb | 7 | ||||
-rw-r--r-- | spec/install/git_spec.rb | 12 |
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 |