It seems like that should be part of the gem spec., so I've been nosing around in some of the rubygems
gem's modules to see if there was a way to programmatically find out the right require
string. So far I haven't found anything. It seems like a hole to me; I've run into the problem you're talking about, and it's a pain. The gem-writers are the ones who know the string, so it should be in the *.gemspec file.
My recommendation is to run gem env
at the command-line, and cd
into the directories displayed for "GEM PATHS", then into the gems
directory, followed by the directory for the gem in question. Inside that directory look for README or similar files and see what they say. If nothing is found run:
grep -r require *
then look through the results for likely candidate strings. If there's a "test" directory, change the "*
" to "test
" first, to reduce the results to more-likely hits.
For instance, the Net::SSH gem is called "net-ssh", but it's gem is required using net/ssh
. Searching with grep showed a lot of instances of require 'net/ssh'
.