Created
June 10, 2009 14:29
-
-
Save localhost/127240 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# find_gem - improved by freQvibez | |
# | |
# originally hacked by Dr Nic: | |
# http://drnic.tumblr.com/post/166472/load-up-any-gem-into-editor | |
# | |
# example: mate `find_gem mongrel mongrel_cluster` | |
require 'rubygems' | |
begin | |
if ARGV.first | |
puts Gem.source_index.find_name(ARGV.shift).last.full_gem_path while gem = ARGV.first | |
else | |
puts Gem.source_index.find_name('sources').last.full_gem_path.split('sources').first | |
end | |
rescue err = NoMethodError | |
$stderr.puts "#{$0} #{gem}: No such gem" | |
retry if ARGV.first | |
end | |
exit err.nil? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment