This project is archived and is in readonly mode.
Rubygems 1.3.6 warning in Rails 2.3.5
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
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.
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.
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.
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
requirementmethod, which wasn't available until RubyGems 1.3.6
Credit still goes to the original patcher :)
- 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
Signed-off-by: Prem Sichanugrist email@example.com
Signed-off-by: Jeremy Kemper firstname.lastname@example.org
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?
masteris 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
masteras the next version of Rails, but
2-3-stablewould 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.
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.
Actually, Jeremy did some rewrite to the patch to make more appropriate. Please take a look at changelog :)
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.
- 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