Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec with rubygems 1.8.6 #145

Closed
pkmiec opened this Issue · 25 comments
@pkmiec

I am receiving tons of "Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec" messages. I thought this was fix with #70 which made it into rubygems 1.8.6. I upgraded to 1.8.6 but the warnings persist. Using bundler 1.0.15 and rake 0.9.2. It seems like ruby gems is using a method which it itself deprecated. Any ideas?

%> gem -v
1.8.6
%> rake -T
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Users/pkmiec/src/adep_trunk/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#refresh! called from /Users/pkmiec/src/adep_trunk/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:34.
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#load_gems_in called from /Users/pkmiec/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:322.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /Users/pkmiec/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /Users/pkmiec/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /Users/pkmiec/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
@zenspider
Owner

Have you tried upgrading rails? What version do you have in vendor/rails ?

@pkmiec

Ahh ... I didn't realize this is related to version of Rails. The output in my previous post is from an app on Rails 2.3.4. I tried on another app using Rails 3.0.7 and the warnings are indeed gone. Thanks!

@pkmiec pkmiec closed this
@zenspider
Owner

Just for the record... we also fixed the 2.3 series in case you need to stick to it.

@amalc

Still seems to show up on 2.3.11. On gem 1.8.8. Was the fixed pushed?

@amalc

Noticed 2.3.12 was released for this. Will try it.

@amalc

Works. Not repeating anymore. Getting two deprecation warnings instead of dozens on Rails 2.3.12.

@leifg

Using rails 2.3.14 with rubygems 1.8.13. Problem still there:

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
config.gem: Unpacked gem syslog-logger-1.6.4 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:104.
NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#search called from /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rails-2.3.14/lib/rails/vendor_gem_source_index.rb:119.
NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#search called from /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rails-2.3.14/lib/rails/vendor_gem_source_index.rb:119.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:104.
NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#search called from /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rails-2.3.14/lib/rails/vendor_gem_source_index.rb:119.
NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#search called from /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rails-2.3.14/lib/rails/vendor_gem_source_index.rb:119.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:104.
NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#search called from /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rails-2.3.14/lib/rails/vendor_gem_source_index.rb:119.
NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#search called from /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rails-2.3.14/lib/rails/vendor_gem_source_index.rb:119.
Loaded suite /home/leifg/code/prj/vendor/local/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader

@2potatocakes

Still seeing it in 2.3.14 also, using ruby-1.8.7, rubygems-1.8.15, rake-0.8.7

@paulschreiber

Also seeing this with 2.3.14, 1.8.7, 1.8.15 and rake 0.9.2.2.

@2potatocakes

I'm sure this'll be completely frowned upon but as a temporary fix I found you can suppress the warnings using Rubygems-1.8.15 if you add the following to /config/preinitializer.rb :

require "rubygems"
Gem::Deprecate.skip = true

Pretty sure this skips ALL deprecation warnings though so obviously not a fix but it'll at least help keep your sanity in check ;)

@jrochkind

yes, can someone with permission actually reopen this ticket? It is happening with rails 2.3.14, 1.8.7 and rubygems 1.8.12. And according to @paulschreiber above, also rubygems 1.8.15

This is extremely annoying. Rails 2.3 branch is still used by many.

@leifg

Tested today with 1.8.15 and can confirm it is still happening

@Niku85ru

You should downgrade your rubygems to version 1.3.7 use the command: gem update --system 1.3.7
Also have a look at http://www.redmine.org/boards/2/topics/23318

@leifg

Downgrade to 1.6.1 works as well but that does not sufficiently solve the problem as some gems require a higher rubygems version

@nilbus

It also works with 1.7.2, which is the newest that it does work. Deprecation warnings start in 1.8.0.

@logicminds

what was the final outcome of this issue?

@tenderlove
Collaborator

Can someone try with rubygems version 1.8.8 and Rails 2.3.14? @amalc reported this fixed in Rails version 2.3.12, with rubygems version 1.8.8.

I don't see any changes between 2.3.12 and 2.3.14 that would have caused this, so either I'm missing something in the Rails commits, or something changed in Rubygems.

@logicminds

I am able to load 2.3.14 with gem version 1.6.2 with no issues. gem 1.4.2 throws all the errors and 1.8.8 does not seem to work in my environment because of the following error which is probably a completely separate issue thus I am using 1.6.2.

bundler-1.1.4/lib/bundler/rubygems_integration.rb:199:inblock in stub_source_index170': undefined method skip_during' for Bundler::RubygemsIntegration::Deprecate:Class (NoMethodError)

@tenderlove
Collaborator

@logicminds I see. It looks like from your stack trace this is an issue with bundler and rubygems 1.8.8? Are you able to use Rails with Rubygems 1.8.8 but without bundler?

@jibwa

Just wanted to update this issue to mention I have the same problem when I run gem 1.8.24 with rails 2.3.14

@mhuggins

I get this problem with RubyGems v1.8.16 & Rails 2.3.14. The following deprecation warning is repeated about 20 times:

NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#search called from C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/rails/vendor_gem_source_index.rb:119.

And I get a few of these mixed in as well:

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.

and some of these:

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/rails/gem_dependency.rb:78.

@luislavena
Collaborator

@mhuggins I would suggest change to use Bundler instead and remove config.gem

config.gem is the one that triggers gem_dependency.

I moved my Rails 2.3.14 to use Bundler and only have one warning:

$ ruby script/console
Loading development environment (Rails 2.3.14)
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Users/luis/.rbenv/versions/1.8.7-p358/gemsets/krrb/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
>>
$ bundle show | wc -l
      95

Considering that if you update to a newer version of Rails, Bundler is mandatory, you can start by that...

@mhuggins

@luislavena - Thanks for the heads up. I'll have to work on getting the project moved over to Bundler. :)

@luislavena
Collaborator

I'll have to work on getting the project moved over to Bundler.

@mhuggins no pain no gain :wink:

@amicming

Currently I can't upgrade jruby & rails, we use 2.3.11 and I am getting bellow.
There is a three problems in this log, one for deprecation warning, two for Mocha deprecation warning and third for JSON initialized constant warning

Any Idea How can I fix these?

$ jruby -S bundle exec script/server
=> Booting Mongrel
=> Rails 2.3.11 application starting on http://0.0.0.0:3000
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/USERNAME/.rvm/gems/jruby-1.6.5.1@rails-2.3.11/gems/rails-2.3.11/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#refresh! called from /home/USERNAME/.rvm/gems/jruby-1.6.5.1@rails-2.3.11/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:34.
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
.
.[next 200 lines]
.
Gem::SourceIndex#add_spec called from /home/USERNAME/.rvm/rubies/jruby-1.6.5.1/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/USERNAME/.rvm/rubies/jruby-1.6.5.1/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.

Mocha deprecation warning: Test::Unit or MiniTest must be loaded before Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'

/home/USERNAME/.rvm/gems/jruby-1.6.5.1@rails-2.3.11/gems/json_pure-1.4.6/lib/json/common.rb:65 warning: already initialized constant State
/home/USERNAME/.rvm/gems/jruby-1.6.5.1@rails-2.3.11/gems/json_pure-1.4.6/lib/json/common.rb:66 warning: already initialized constant SAFE_STATE_PROTOTYPE
/home/USERNAME/.rvm/gems/jruby-1.6.5.1@rails-2.3.11/gems/json_pure-1.4.6/lib/json/common.rb:67 warning: already initialized constant FAST_STATE_PROTOTYPE
/home/USERNAME/.rvm/gems/jruby-1.6.5.1@rails-2.3.11/gems/json_pure-1.4.6/lib/json/common.rb:74 warning: already initialized constant PRETTY_STATE_PROTOTYPE
/home/USERNAME/.rvm/gems/jruby-1.6.5.1@rails-2.3.11/gems/json_pure-1.4.6/lib/json/pure.rb:76 warning: already initialized constant JSON_LOADED

@roberttdev roberttdev referenced this issue from a commit in roberttdev/dactyl
@nathanstitt nathanstitt Silence annoying: Gem::SourceIndex#search is deprecated with no repla…
…cement messages. Will attempt to figure out root cause later, since rubygems issues #145 (rubygems/rubygems#145) says it should have been fixed in 2.3.12.
975c54d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.