New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
2 participants
@myronmarston
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

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. :)

@myronmarston

This comment has been minimized.

Copy link
Contributor Author

myronmarston commented Jul 8, 2010

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

@indirect

This comment has been minimized.

Copy link
Member

indirect commented Jul 10, 2010

Pulled by @wycats as 5e6b094.

joevandyk pushed a commit to joevandyk/bundler that referenced this issue May 16, 2011

Raise an appropriate error when a gem is specified using a symbol.
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 bundler#434.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment