This project is archived and is in readonly mode.

#4026 ✓ committed
Kieran P

Rubygems 1.3.6 warning in Rails 2.3.5

Reported by Kieran P | February 21st, 2010 @ 08:33 PM | in 2.3.6

Upgraded to Rubygems 1.3.6 and when I start rails 2.3.5, I get:

/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement

Comments and changes to this ticket

  • Phillip Koebbe

    Phillip Koebbe February 22nd, 2010 @ 08:44 PM

    Me, too.

    I worked around it by adding

    if Gem::VERSION >= "1.3.6"
        module Rails
            class GemDependency
                def requirement
                    r = super
                    (r == Gem::Requirement.default) ? nil : r
                end
            end
        end
    end
    

    between the bootstrap line and the initialization section of my environment.rb.

    Peace.

  • Balazs Nagy

    Balazs Nagy February 23rd, 2010 @ 01:23 PM

    I don't think this problem should be fixed in a client code. Where's the 'invalid' button?

  • Phillip Koebbe

    Phillip Koebbe February 23rd, 2010 @ 01:35 PM

    Oh, I don't either. I was just providing a way to work around the deprecation warning. It's quite obnoxious when running specs.

    The solution is to do just what I did, but in gem_dependency.rb: replace the call to version_requirements with super. Unfortunately, I'm not in a position where I can make and test the patch as I am not set up to do that with Rails and I don't have the bandwidth to do it right now. For anyone who is already submitting patches to Rails, this is a no-brainer.

    I just wanted to add what I could to the conversation.

    To replicate, upgrade to rubygems 1.3.6. Anything you do in Rails, whether running a test or firing up script/server, should produce the warning. I've seen it on 2.3.4 and 2.3.5.

    Peace.

  • Christoph Schiessl

    Christoph Schiessl February 23rd, 2010 @ 04:48 PM

    I agree that this deprecation message is annoying and can confirm the fix suggested by Phillip Koebbe works as advertised. I'm trying to create a patch for this - however this is my first attempt to fix a bug in Rails. So, don't expect too much from my end.

  • Christoph Schiessl

    Christoph Schiessl February 23rd, 2010 @ 05:55 PM

    I'm curious what you guys think about my first patch...

  • Prem Sichanugrist (sikachu)

    Prem Sichanugrist (sikachu) February 25th, 2010 @ 07:23 PM

    • Assigned user set to “Jeremy Kemper”
    • State changed from “new” to “verified”
    • Milestone set to 2.3.6

    I can confirm this behavior, and the patch looks fine.

  • Jeremy Kemper

    Jeremy Kemper February 25th, 2010 @ 07:31 PM

    Does the patch work with older rubygems too?

  • Prem Sichanugrist (sikachu)

    Prem Sichanugrist (sikachu) February 25th, 2010 @ 07:37 PM

    My fault, the patch doesn't work with 1.3.5. Thanks to point that out.

  • Prem Sichanugrist (sikachu)

    Prem Sichanugrist (sikachu) February 25th, 2010 @ 07:58 PM

    Jeremy, I've modified Christoph's patch with backward compatibility with gem <= 1.3.5. It's kind of hackish though, as it check the Gem::Dependency for requirement method, which wasn't available until RubyGems 1.3.6

    Credit still goes to the original patcher :)

  • Repository

    Repository February 25th, 2010 @ 08:53 PM

    • State changed from “verified” to “committed”

    (from [268c9040d5c3c7ed30f3923eee71a78eeece8a8a]) remove rubygems (version >= 1.3.6) deprecation message by replacing Gem::Dependency#version_requirements with Gem::Dependency#requirement

    [#4026 state:committed]

    Signed-off-by: Prem Sichanugrist s@sikachu.com
    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/268c9040d5c3c7ed30f3923eee71a7...

  • Christoph Schiessl

    Christoph Schiessl February 26th, 2010 @ 11:28 AM

    Cool! Thank you Prem for the quick response.

    I wonder why backward compatibility with older version of rubygems is even required? Wouldn't it be sufficient to add rubygems 1.3.6 as requirement to the railties gemspec file?

    Did anyone try this with rails 3.0.beta? I guess the core team is going merge all the 2-3-stable commits to master anyways before rails 3.0 is released, right?

  • Prem Sichanugrist (sikachu)

    Prem Sichanugrist (sikachu) February 26th, 2010 @ 02:22 PM

    Chirstoph,

    2-3-stable and master is really separate from each other now. master, in other word Rails 3, becoming more modular and lots of code and functionality has changed. It won't be merged together :)

    So, in my opinion, I would treat master as the next version of Rails, but 2-3-stable would be updated only if there's a known bug.

    Rails 3 already got this problem solved by using Bundler, so no need to fix it.

  • matt vs world

    matt vs world March 1st, 2010 @ 05:36 AM

    Quick question about the patch -- should the quoted "requirement" in line 119 actually be :requirement ?

    I'm running ruby 1.9.1, rails 2.3.5, and rubygems 1.3.6, and the patch only works if, in that line, "requirement" is a symbol rather than a string. i.e., i still got the warnings until i made this additional change.

  • Prem Sichanugrist (sikachu)

    Prem Sichanugrist (sikachu) March 1st, 2010 @ 01:06 PM

    @matt

    Actually, Jeremy did some rewrite to the patch to make more appropriate. Please take a look at changelog :)

    http://github.com/rails/rails/commit/268c9040d5c3c7ed30f3923eee71a7...

  • matt vs world

    matt vs world March 1st, 2010 @ 04:07 PM

    @prem:

    Apologies, I last checked the ticket a few days ago, and didn't follow over to the changelog when I glanced at it yesterday! Guess I assumed the posted patch ended up being the final one... wups! It appears the committed patch includes changes which resolve my "should be a symbol" issue.

    thanks!

  • Sardor

    Sardor March 11th, 2010 @ 05:10 AM

    • Assigned user cleared.

    I updated RubyGems nd I got warning like warning below when I wanted to start my server...
    Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement

    I tried to do with instruction in first lines, but I could not(

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Tickets have moved to Github

The new ticket tracker is available at https://github.com/rails/rails/issues

Shared Ticket Bins

Referenced by

Pages