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

Beginner-friendly error message for misspelled or non-existent gem names #3564

Closed
sealocal opened this issue Apr 13, 2015 · 3 comments
Closed

Comments

@sealocal
Copy link
Contributor

Let's say I'm new to Ruby, Rails, Bundler, RubyGems, etc. Clear error messages are a huge help.

Given a Gemfile:

source 'https://rubygems.org'
gem 'rails'
gem 'misspelled-gem-name'

Bundling will report that the 'misspelled-gem-name' is not available on "this machine":

$ bundle
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/..
Could not find gem 'misspelled-gem-name (>= 0) ruby' in the gems available on this machine.

I think this message could be improved by adding a line that says the gem could not be found in RubyGems, when the source for a Gemfile includes rubygems.org. For example:

Could not find gem 'misspelled-gem-name (>= 0) ruby' at https://rubygems.org/.

Does anyone else think this is would be a welcome improvement?

For further illustration, this spec fails:

  describe "failed bundle install" do
    before :each do
      gemfile <<-G
        source 'https://rubygems.org/'
        gem "rails"
        gem "misspelled-gem-name", :group => :development
      G
    end

    it "should report a helpufl error message" do
      bundle :install
      expect(out).to include("Fetching gem metadata from https://rubygems.org/")
      expect(out).to include("Could not find gem 'misspelled-gem-name (>= 0) ruby' at https://rubygems.org/.")
    end
  end
Failure/Error: expect(out).to include("Could not find gem 'misspelled-gem-name (>= 0) ruby' at https://rubygems.org/.")
       expected "Fetching gem metadata from https://rubygems.org/...........\nFetching version metadata from https://rubygems.org/..\nCould not find gem 'misspelled-gem-name (>= 0) ruby' in the gems available on this machine." to include "Could not find gem 'misspelled-gem-name (>= 0) ruby' at https://rubygems.org/."
@indirect
Copy link
Member

I think "in any of the sources listed in your Gemfile or installed on this machine" is the most correct error message. How do you feel about that?

@sealocal
Copy link
Contributor Author

I think that's reasonable.

@sealocal
Copy link
Contributor Author

Resolved through #3566

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants