Skip to content

Instantly share code, notes, and snippets.

@dguzzo
Last active August 29, 2015 13:58
Show Gist options
  • Save dguzzo/10016670 to your computer and use it in GitHub Desktop.
Save dguzzo/10016670 to your computer and use it in GitHub Desktop.
easily open gem source directory in Textmate
# change "bundler" to the name of any installed gem (run 'gem list' to see which gems are installed.)
# change "mate" to any prefered program that can open a directory. 'open' will open the file tree in Finder on OSX, for instance.
# the regex basically strips off the "/lib/<gem-name>.rb" from the "gem which" output.
gem which bundler | sed "s/\(.*\)\(.*\/.*\/.*\.rb\)$/\1/" | xargs mate
# alternate way
gem which bundler | ruby -e "puts gets.match(/(.*)\/lib\/.*/)[1]" | xargs mate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment