Skip to content
This repository has been archived by the owner. It is now read-only.

Using symbols to specify gem names results in misleading error message #434

Closed
myronmarston opened this issue Jul 5, 2010 · 3 comments
Closed

Comments

@myronmarston
Copy link
Contributor

@myronmarston myronmarston commented Jul 5, 2010

Here's my Gemfile:

source :rubygems
gem :rspec

Here's what I get when I try bundle install:

ruby-1.8.7-p299 ➜  bundler --version
Bundler version 1.0.0.beta.2
ruby-1.8.7-p299 ➜  bundle install
Fetching source index for http://rubygems.org/
Could not find gem 'rspec (>= 0, runtime)' in any of the gem sources.

If I use gem "rspec" rather than gem :rspec it works fine. It retrospect, maybe this should have been obvious to me, but I spent close to an hour trying to figure out why bundler couldn't find the rspec gem. The error message is just flat-out wrong, and it led me down the wrong to path to trying to solve the issue.

I think bundler should do one of the following, and I don't particularly care which:

  1. Support gem names specified using symbols. A simple name.to_s at the appropriate spot should work.
  2. Not support symbols, and make it obvious by raising an appropriate error message such as Bundler does not support specifying gem names using symbols. Use a string instead.

I'm willing to submit a patch that fixes this, if the bundler team will provide guidance about which solution they would prefer.

@indirect
Copy link
Member

@indirect indirect commented Jul 8, 2010

Given Ruby tradition, I am more comfortable with solution 2. If that causes problems, or raises a furor, we can always switch to option 1. If you do submit a patch, I will give this ticket priority and pull right away. :)

Loading

@myronmarston
Copy link
Contributor Author

@myronmarston myronmarston commented Jul 8, 2010

OK, I've implemented solution 2 with this commit. Thanks!

Loading

@indirect
Copy link
Member

@indirect indirect commented Jul 10, 2010

Pulled by @wycats as 5e6b094.

Loading

joevandyk pushed a commit to joevandyk/bundler that referenced this issue May 16, 2011
Previously, bundler would raise an error like "Could not find gem 'foo' in any of the gem sources", which was misleading and confusing.  This closes rubygems#434.
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants