Browse files

Resolver "gem not found" message now indicates local or remote

  • Loading branch information...
1 parent 71a518c commit 1951e724238c15c711a5e84d07270118dd092230 @indirect indirect committed Apr 3, 2010
Showing with 17 additions and 10 deletions.
  1. +2 −2 lib/bundler/cli.rb
  2. +1 −1 lib/bundler/dsl.rb
  3. +6 −0 lib/bundler/index.rb
  4. +8 −7 lib/bundler/resolver.rb
View
4 lib/bundler/cli.rb
@@ -106,11 +106,11 @@ def lock
Bundler.runtime.lock
rescue GemNotFound, VersionConflict => e
Bundler.ui.error(e.message)
- Bundler.ui.info "Run `bundle install` to install missing gems"
+ Bundler.ui.warn "Run `bundle install` to install missing gems."
exit 128
end
- desc "unlock", "Unlock the bundle. This allows gem versions to be changed"
+ desc "unlock", "Unlock the bundle. This allows gem versions to be changed."
def unlock
if locked?
remove_lockfiles
View
2 lib/bundler/dsl.rb
@@ -66,7 +66,7 @@ def group(*args, &blk)
def self.deprecate(name)
define_method(name) do |*|
- raise DeprecatedMethod, "#{name} is removed. See the README for more information"
+ raise DeprecatedMethod, "#{name} has been removed from the Gemfile DSL. See the README for more information on upgrading from Bundler 0.8."
end
end
View
6 lib/bundler/index.rb
@@ -68,6 +68,12 @@ def search(query)
end
end
+ def sources
+ @specs.values.map do |specs|
+ specs.map{|s| s.source.class }
+ end.flatten.uniq
+ end
+
alias [] search
def <<(spec)
View
15 lib/bundler/resolver.rb
@@ -148,18 +148,19 @@ def resolve(reqs, activated)
versions = @source_requirements[name][name].map { |s| s.version }
message = "Could not find gem '#{current}' in #{current.source}.\n"
if versions.any?
- message << "Source contains '#{current.name}' at: #{versions.join(', ')}"
+ message << "Source contains '#{name}' at: #{versions.join(', ')}"
else
message << "Source does not contain any versions of '#{current}'"
end
-
- raise GemNotFound, message
else
- raise GemNotFound, "Could not find gem '#{current}' in any of the sources."
+ message = "Could not find gem '#{current}' "
+ if @index.sources.include?(Bundler::Source::Rubygems)
+ message << "in any of the gem sources."
+ else
+ message << "in the gems available on this machine."

Nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ end
end
- location = current.source ? current.source.to_s : "any of the sources"
- raise GemNotFound, "Could not find gem '#{current}' in #{location}.\n" \
- "Source contains fo"
+ raise GemNotFound, message
else
@errors[current.name] = [nil, current]
end

0 comments on commit 1951e72

Please sign in to comment.