Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use RbConfig instead of obsolete and deprecated Config

Tags:

When I run my Rails app in WEBrick on Ubuntu, after upgrading to ruby-1.9.3-p327, I receive the following error:

[rake --tasks] /home/dsilver/.rvm/gems/ruby-1.9.3-p327/gems/em-dir-watcher-0.9.4/lib/em-dir-watcher.rb:7: Use RbConfig instead of obsolete and deprecated Config.

Any idea what's going on?

I've seen some posts connecting this to ImageMagick on Windows. I am on Ubuntu, but the app does use ImageMagick, and the ImageMagick functionality appears to have broken since the ruby upgrade from 1.9.2 to 1.9.3. I suspect a connection.

Thanks!

like image 317
dsilver829 Avatar asked Dec 03 '12 23:12

dsilver829


1 Answers

The Config module has been renamed to RbConfig. It’s still possible to use the old name, for backwards compatibility, but Ruby issues a warning if you do.

The em-dir-watcher gem uses the old name, and so you see the warning when it’s loaded. Someone has already sent a pull request fixing this, however the last update to em-dir-watcher was over two years ago so it might not get merged.

This is a warning that is generated, not an error, so your code should actually still work okay. If you really want to get rid of the warning you could add something like this before you require 'em-dir-watcher':

Object.send :remove_const, :Config
Config = RbConfig

This defines Config to be the same as RbConfig, which is what Ruby does anyway, but prevents the warning.

like image 145
matt Avatar answered Nov 06 '22 16:11

matt