Search code examples
rubyrubinius

Migrating to rubinius


I'm trying to migrate my project from mri to rubinius to get concurrency advantage.

I've started the server and open first page and then got error:

Puma caught this error: undefined method `=~' for Pathname (NameError)
kernel/common/module.rb:212:in `instance_method'
kernel/common/module.rb:354:in `undef_method'
kernel/bootstrap/array.rb:66:in `each'
kernel/common/module.rb:352:in `undef_method'
...

My Gemfile

source 'https://rubygems.org'

ruby '2.1.0', :engine => "rbx", engine_version: '2.2.1'

gem "rubysl" # Ruby Standard Library meta-gem for rubinius

# Server requirements

gem 'puma'

...

What might be a problem here?

UPDATE: full stack trace


Solution

  • I examined your stack trace and looked at the Rubinius source code. The offending line is:

     class Pathname
       undef =~ # THIS IS IT
     end
    

    #=~ is an instance method on Object so normally undef =~ should work on any class... unless it has been undef'd on Object or on Pathname already.

    I'm wondering if this is happening because you have the rubysl gem in your Gemfile. I don't know Rubinius, but from what I can see, it doesn't seem to require you to specifically include this gem. Or maybe it did in past versions, but doesn't now. If the standard library is being loaded twice, that would explain why undef =~ fails the second time.

    If that doesn't help, I recommend you try temporarily removing as many gems as possible and see if the problem disappears. If so, add them back one by one until you find which one is causing the problem.