Use gem to get library version : gem « Development « Ruby






Use gem to get library version


require 'rubygems/remote_installer'
require 'yaml'

def format_gems(gems)
  gem_versions = gems.inject({}) { |h, gem| (h[gem.name] ||= []) << gem; h}
  gem_versions.keys.sort.each do |name|
   versions = gem_versions[name].collect { |gem| gem.version.to_s }
    puts "#{name} is available in these versions: #{versions.join(', ')}"
  end
end

format_gems(Gem::RemoteInstaller.new.search(/.*/).flatten)

 








Related examples in the same category

1.Installing RubyInline on Unix-related platforms
2.install rails
3.Finding Libraries by Searching Gem Repositories.rb
4.Loop through gems cache
5.Installing and Using a Gem
6.Uninstalling a Gem.rb