How do I fix Rubygems recent deprecation warning?

2019-01-17 16:06发布

I have recently run updates:

gem update --system
gem update

Now, I come with a lot of deprecation warnings each time I load a gem. For example, rails console:

NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Users/user/.rvm/gems/ruby-1.9.2-p180@global/specifications/rake-0.8.7.gemspec:10.
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Users/user/.rvm/gems/ruby-1.9.2-p180@global/specifications/rake-0.8.7.gemspec:10.
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Users/user/.rvm/gems/ruby-1.9.2p180@global/specifications/rake-0.8.7.gemspec:10.
Loading development environment (Rails 3.0.7)
ruby-1.9.2-p180 :001 > exit

I use RVM, Ruby 1.9.2 and Rubygems 1.8.1. Any way to get around this problem? Revert to an older version of rubygems?

11条回答
Animai°情兽
2楼-- · 2019-01-17 16:57

Simpler: Add the following to environment.rb

ActiveSupport::Deprecation.silenced = true
查看更多
做自己的国王
3楼-- · 2019-01-17 17:02

It looks like you're ok, It is just a warning where rake-0.8.7.gemspec will not meet new standard of RubyGems.

I'm sure rake's creator will get this sync.

查看更多
手持菜刀,她持情操
4楼-- · 2019-01-17 17:05

I had to downgrade to 1.6.2. Those notices are absolutely ridiculous. They make the latest version completely unusable. There should really be a way to disable them, but until then:

sudo gem update --system 1.6.2

查看更多
老娘就宠你
5楼-- · 2019-01-17 17:05

I can confirm that 1.8.10 has removed these deprecation warnings in a Rails 3.1 environment as well.

Simply run

gem update --system
查看更多
唯我独甜
6楼-- · 2019-01-17 17:08

Installing rubygems version 1.8.4 gets rid of the gem spec deprecation warnings:

$ gem update --system

=== 1.8.4 / 2011-05-25

  • 1 minor enhancement:

    • Removed default_executable deprecations from Specification.
查看更多
登录 后发表回答