h1. find_gem
h1. → edit_gem name
h2. What
* find_gem returns the path to the latest version of a RubyGem in the cache. Used by...
* edit_gem launches a RubyGem into your editor (e.g. TextMate if environment variable EDITOR=mate)
h3. Bonus - auto-complete for gem related commands
Using bash?
You can use auto-complete for a range of gem commands, such as gem install, edit_gem and find_gem.
h2. Installing
sudo gem install find_gemh2. Usage h3. find_gem Returns the path of a RubyGem within the gem cache. That is, the location of the gem after you "gem install" it. This allows you to quickly inspect a gem's source, its tests, its examples, etc. Usage:
find_gem [gem name]
Example: find_gem newgem
If the gem name is not included, the root path of all gems is returned.
h3. edit_gem
Loads a RubyGem into your editor (uses find_gem to determine the gem's location)
Usage: edit_gem [gem name]
Example: edit_gem newgem
If the gem name is not included, the editor will attempt to load the root path for all gems.
Requires: your EDITOR environment to be set, e.g. EDITOR=mate -w
h3. auto-complete
For bash users, auto-completion help is available with 2 included scripts:
To your ~/.bashrc or ~/.profile add
complete -C gem_autocomplete -o default find_gem complete -C gem_autocomplete -o default edit_gem complete -C gem_autocomplete -o default gemAnd reload your profile:
source ~/.bashrc
Now you will be able to use TAB-auto-completion to discover RubyGems in your cache, or in the remote Gem server (for "gem install")
h4. For example:
Gem command auto-complete:
gemRemote gem server auto-complete:(double TAB) -> build contents install query specification cert dependency list rdoc uninstall check environment outdated search unpack cleanup help pristine sources update gem inst -> gem install
gem install newLocal gem cache auto-complete:-> gem install newgem # press to install this gem
edit_gem newh2. Forum "http://groups.google.com/group/drnicutilities":http://groups.google.com/group/drnicutilities h2. How to submit patches Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above. The trunk repository is-> edit_gem newgem # press to edit the gem from your cache
svn://rubyforge.org/var/svn/drnicutilities/find_gem/trunk for anonymous access.
h2. License
This code is free to use under the terms of the MIT license.
h2. Contact
Comments are welcome. Send an email to "Dr Nic Williams":mailto:drnicwilliams@gmail.com at the "forum":http://groups.google.com/group/drnicutilities