Handy trick, courtesy of Aaron Blohowiak on ruby-6:
$ gem install open_gem
$ gem open [gem_name]
The entire gem's codebase is opened into your favorite editor, as defined by the shell variable EDITOR.
$ echo EDITOR
vi
$ $EDITOR = emacs
$ echo EDITOR
emacs
My own choice is actually TextMate (mate). But fewer people have that already on their system.
By the way, if you're using the Bundler gem, your working directory includes a Gemfile file or Gemfile is further up its path, and bundle install
is current, then you can do this instead:
$ bundle open [gem_name]
Somewhat less useful to me. Sometimes I just want to poke around inside a lib. It's not necessarily one in active use at that moment. But choose whatever approach fits your workflow best.