diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index b8048e3ca4f..ae40f7fd80f 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -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." diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 7a325f0cdf4..5471aae02b5 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -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 diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 962b16c340c..0ae02546ec4 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -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 diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index b50aea07f7d..d1c98c94bdd 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -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 diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 3122aea1fdb..ab2e74e1db8 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -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