Permalink
Browse files

Bring back a spec describing the cache being updated when the bundle …

…is updated
  • Loading branch information...
1 parent d4cd3bc commit c48f0ffa8c4a6c12433f1d1f07d43a294facaab4 Carl Lerche committed Jun 9, 2010
Showing with 21 additions and 5 deletions.
  1. +3 −0 lib/bundler/cli.rb
  2. +1 −1 lib/bundler/runtime.rb
  3. +14 −0 lib/bundler/source.rb
  4. +1 −3 spec/cache/gems_spec.rb
  5. +2 −1 spec/support/matchers.rb
View
@@ -129,6 +129,9 @@ def update(*gems)
end
Installer.install Bundler.root, Bundler.definition
+ cache if Bundler.root.join("vendor/cache").exist?
+ Bundler.ui.confirm "Your bundle is updated! " +
+ "Use `bundle show [gemname]` to see where a bundled gem is installed."
end
desc "lock", "Locks the bundle to the current set of dependencies, including all child dependencies."
View
@@ -20,7 +20,7 @@ def setup(*groups)
# Activate the specs
specs.each do |spec|
unless spec.loaded_from
- raise GemNotFound, "#{spec.full_name} is cached, but not installed."
+ raise GemNotFound, "#{spec.full_name} is missing. Run `bundle` to get it."
end
Gem.loaded_specs[spec.name] = spec
View
@@ -150,10 +150,22 @@ def installed_specs
@installed_specs ||= begin
idx = Index.new
Gem::SourceIndex.from_installed_gems.to_a.reverse.each do |name, spec|
+ next if name == 'bundler'
@installed[spec.full_name] = true
spec.source = self
idx << spec
end
+ # Always have bundler locally
+ bundler = Gem::Specification.new do |s|
+ s.name = 'bundler'
+ s.version = VERSION
+ s.platform = Gem::Platform::RUBY
+ s.source = self
+ # TODO: Remove this
+ s.loaded_from = 'w0t'
+ end
+ @installed[bundler.full_name] = true
+ idx << bundler
idx
end
end
@@ -163,6 +175,7 @@ def cached_specs
idx = Index.new
@caches.each do |path|
Dir["#{path}/*.gem"].each do |gemfile|
+ next if name == 'bundler'
s = Gem::Format.from_file_by_path(gemfile).spec
s.source = self
idx << s
@@ -183,6 +196,7 @@ def remote_specs
Gem.sources = ["#{uri}"]
fetch_all_remote_specs do |n,v|
v.each do |name, version, platform|
+ next if name == 'bundler'
spec = RemoteSpecification.new(name, version, platform, uri)
spec.source = self
# Temporary hack until this can be figured out better
View
@@ -92,10 +92,8 @@
end
it "adds and removes when gems are updated" do
- pending_bundle_update
update_repo2
- bundle :unlock
- bundle :install
+ bundle 'update'
cached_gem("rack-1.2").should exist
cached_gem("rack-1.0.0").should_not exist
end
View
@@ -31,7 +31,8 @@ def should_be_installed(*names)
groups << opts
names.each do |name|
name, version, platform = name.split(/\s+/)
- run "load '#{name}.rb'; puts #{Spec::Builders.constantize(name)}", *groups
+ version_const = name == 'bundler' ? 'Bundler::VERSION' : Spec::Builders.constantize(name)
+ run "require '#{name}.rb'; puts #{version_const}", *groups
actual_version, actual_platform = out.split(/\s+/)
Gem::Version.new(actual_version).should == Gem::Version.new(version)
actual_platform.should == platform

0 comments on commit c48f0ff

Please sign in to comment.