Reputation: 150956
In the Ruby Cookbook recipe 18.1, it is said that
Gem::RemoteInstaller.new.search('rails')
can search for gems on the remote site, defaulted to rubygems.org
but I tried in ruby 1.8.6, 1.8.7, and 1.9.2, and it all says
in `<main>': uninitialized constant Gem::RemoteInstaller (NameError)
I already tried
require 'rubygems'
and even
require 'rubygems/remote_installer'
Is there a new way to search using Gem inside of Ruby?
(please don't give answers such as system("gem list rails")
Upvotes: 1
Views: 200
Reputation: 6856
Gem::RemoteInstaller
has been removed from the rubygems since version 1.0. This was a while ago. If you are looking for the ability to set someone up with gems that they may not have, I would strongly suggest bundler
(actually I think all ruby projects should use it) http://gembundler.com
OK, you can try:
require 'rubygems'
r = Gem::SpecFetcher.new
r.suggest_gems_from_name('rails')
=> ["rails"]
Upvotes: 1