Saturday, September 3, 2011

Find an installed Ruby Gem contents folder

 #!/usr/bin/env ruby  

def find_path gem_name
`gem list #{gem_name}` =~ /(.*)\s\((.*)\)/
version = $2.split(",")[0]
"#{Gem.default_dir}/gems/#{gem_name}-#{version}"
end
puts find_path ARGV[0]