Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Rubygems 1.3.6 warning in Rails 2.3.5

#4026

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

Reported by Kieran P · February 21st, 2010 @ 08:33 PM

State: committed
Milestone: 2.3.6
Assigned to: nobody
Importance: High

Activity

  1. Phillip Koebbe
    Phillip Koebbe

    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.

    February 22nd, 2010 @ 08:44 PM

  2. Balazs Nagy
    Balazs Nagy

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

    February 23rd, 2010 @ 01:23 PM

  3. Phillip Koebbe
    Phillip Koebbe

    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.

    February 23rd, 2010 @ 01:35 PM

  4. Christoph Schiessl
    Christoph Schiessl

    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.

    February 23rd, 2010 @ 04:48 PM

  5. Christoph Schiessl
    Christoph Schiessl

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

    February 23rd, 2010 @ 05:55 PM

  6. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)
    • 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.

    February 25th, 2010 @ 07:23 PM

  7. Jeremy Kemper
    Jeremy Kemper

    Does the patch work with older rubygems too?

    February 25th, 2010 @ 07:31 PM

  8. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)

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

    February 25th, 2010 @ 07:37 PM

  9. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)

    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 :)

    February 25th, 2010 @ 07:58 PM

  10. Repository
    Repository
    • 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 Rubygems 1.3.6 warning in Rails 2.3.5 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...

    February 25th, 2010 @ 08:53 PM

  11. Christoph Schiessl
    Christoph Schiessl

    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?

    February 26th, 2010 @ 11:28 AM

  12. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)

    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.

    February 26th, 2010 @ 02:22 PM

  13. matt vs world
    matt vs world

    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.

    March 1st, 2010 @ 05:36 AM

  14. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)

    @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...

    March 1st, 2010 @ 01:06 PM

  15. matt vs world
    matt vs world

    @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!

    March 1st, 2010 @ 04:07 PM

  16. Sardor
    Sardor
    • 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(

    March 11th, 2010 @ 05:10 AM