views:

124

answers:

5

I just installed a gem but when I type

gem_name --help

It says:

'gem_name' is not recognized as an internal or external command

However, when I type

gem list --local

the gem shows up in the list so I know it's there - I just don't know how to see what it does.

Is there a different instruction to use to find out what commands this gem offers?

+1  A: 

Gems are tricky in that aspect. They sometimes install commands (like rails), and at other times just install code that can be 'require'd by your ruby application. The best way is to read up the doc on that gem on the internet.

The gem is usually located at some place like /usr/lib/ruby/gems/... and you may want to go in and look up what it is constituted of. At this time, I would recommend reading the online documentation.

Ryan Oberoi
didn't mean it that way...
Ryan Oberoi
Just kidding. Got it working. Thanks for the suggestions.
birton
+2  A: 

Try: gem specification <gem_name>

Alternatively consult the rdoc documentation for the installed gem.

Stephen Doyle
Yep, I see the spec output and it says "rdoc true". However, when I went to see the rdoc I typed rdoc <gem_name> and then it said File not found: <gem_name>. Did I do it wrong?
birton
I wasn't using the <> around the gem_name by the way. Just in case you thought "at my level of questioning" . . .
birton
An easy way to see the rdoc for an installed gem is to use the "gem server" command, which will start up a web server displaying all the rdoc for gems installed on the local system.
Greg Campbell
@Greg - Great tip. Thanks. Unfortunately the rdoc does not seem to be up to date with the gem. My next step? Maybe unpack the gem into my app and see what it actually does.
birton
+6  A: 

Ruby gems can optionally install executable files. When you run <gem_name> --help, you're generally running the script, if any, installed by that gem, and passing it --help as a commandline parameter. By convention, most gems with executables support this parameter and output some useful information, but it's not a requirement - and, as mentioned, there are plenty of gems that don't install any executables at all.

In this case, it appears that the gem you installed doesn't provide any scripts (or, at the very least, doesn't provide any scripts with the same name as the gem). As others have suggested, looking at the rdoc for the gem might be a good way to start; you can use the gem server command to serve up all your local gems' rdoc content. Alternately, some gems host their rdoc at Rubyforge.

What is the gem in question?

Greg Campbell
Got it working. Thanks.
birton
A: 

As the other answers have stated, there isn't a direct way to do this via the gem command. In addition to the gem rdocs (which you can view using "gem server" or with bdoc - my preference), you can also look through the contents of the gem for files located in the bin folder of the gem.

gem contents somegem | grep "^bin"
Mark Morga
+1  A: 

Try this:

1- gem server

2- Point your browser to: http://localhost:8808/