Permalink
Browse files

Ensure packaged path repos can be updated.

  • Loading branch information...
1 parent c8a738b commit d389686b681732fe12edc8797333b01648914a56 @josevalim josevalim committed Mar 22, 2012
Showing with 34 additions and 4 deletions.
  1. +12 −4 lib/bundler/source.rb
  2. +22 −0 spec/cache/path_spec.rb
View
@@ -314,7 +314,10 @@ def initialize(options)
@name = options["name"]
@version = options["version"]
- @path = app_cache_path if has_app_cache?
+
+ # Stores the original path. If at any point we move to the
+ # cached directory, we still have the original path to copy from.
+ @original_path = @path
end
def remote!
@@ -368,16 +371,21 @@ def install(spec)
def cache(spec)
return unless Bundler.settings[:cache_all]
- return if path.expand_path(Bundler.root).to_s.index(Bundler.root.to_s) == 0
+ return if @original_path.expand_path(Bundler.root).to_s.index(Bundler.root.to_s) == 0
FileUtils.rm_rf(app_cache_path)
- FileUtils.cp_r("#{path}/.", app_cache_path)
+ FileUtils.cp_r("#{@original_path}/.", app_cache_path)
end
def local_specs(*)
@local_specs ||= load_spec_files
end
- alias :specs :local_specs
+ def specs
+ if has_app_cache?
+ @path = app_cache_path
+ end
+ local_specs
+ end
private
View
@@ -28,6 +28,28 @@
should_be_installed "foo 1.0"
end
+ it "updates the path on each cache" do
+ build_lib "foo"
+
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
+
+ bundle "#{cmd} --all"
+
+ build_lib "foo" do |s|
+ s.write "lib/foo.rb", "puts :CACHE"
+ end
+
+ bundle "#{cmd} --all"
+
+ bundled_app("vendor/cache/foo-1.0").should exist
+ FileUtils.rm_rf lib_path("foo-1.0")
+
+ run "require 'foo'"
+ out.should == "CACHE"
+ end
+
it "raises a warning without --all" do
build_lib "foo"

0 comments on commit d389686

Please sign in to comment.