Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Bring back a spec describing the cache being updated when the bundle …
Browse files Browse the repository at this point in the history
…is updated
  • Loading branch information
Carl Lerche committed Jun 9, 2010
1 parent d4cd3bc commit c48f0ff
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions lib/bundler/cli.rb
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/runtime.rb
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions lib/bundler/source.rb
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions spec/cache/gems_spec.rb
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion spec/support/matchers.rb
Expand Up @@ -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
Expand Down

0 comments on commit c48f0ff

Please sign in to comment.