Forum: Ruby on Rails rubygems-update 1.3.0 causing rake task problems?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
lunaclaire (Guest)
on 2008-10-28 23:51
(Received via mailing list)
I'm running into problems with some of my rake tasks and I think it's
since my host updated rubygems to v 1.3.0.

Has anybody else seen this message?

   Gem::SourceIndex#search support for String patterns is deprecated

   ./script/../config/boot.rb:26 is outdated


that line of code is as follows:

   rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |
g| g.version.version }.last

I doint think it's affecting my main app code... only the rake tasks.

Any ideas on what happended? Or how to fix this?
Thomas J. (Guest)
on 2008-10-30 17:36
just replace the line with

rails_gem = Gem.cache.search(Gem::Dependency.new('rails',
"~>#{version}.0")).sort_by { |g| g.version.version }.last

Note that the two string parameters to search() are wrapped in a
Gem::Dependency object. Strange refactoring, took me quite a while.

HTH, Thomas


lunaclaire wrote:
> I'm running into problems with some of my rake tasks and I think it's
> since my host updated rubygems to v 1.3.0.
>
> Has anybody else seen this message?
>
>    Gem::SourceIndex#search support for String patterns is deprecated
>
>    ./script/../config/boot.rb:26 is outdated
>
>
> that line of code is as follows:
>
>    rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |
> g| g.version.version }.last
>
> I doint think it's affecting my main app code... only the rake tasks.
>
> Any ideas on what happended? Or how to fix this?
Thomas J. (Guest)
on 2008-10-30 18:15
(Received via mailing list)
just replace the line in boot.rb with

rails_gem = Gem.cache.search(Gem::Dependency.new('rails',
"~>#{version}.0")).sort_by { |g| g.version.version }.last

Note that the two string parameters to search() are replaced by one
parameter of type Gem::Dependency. Think of it as wrapping the strings
in the dependency object. Strange deprecation, took me quite some
time.

HTH, Thomas
This topic is locked and can not be replied to.