views:

552

answers:

3

I have some code that is using SyncEnumerator. As you can see here, SyncEnumerator requires generator.rb. To include this, the developer of this plugin has require 'generator'. This worked on my previous Rails installation but is not working since I upgraded OS X and reinstalled Rails. Now when I try to install my gems, I get:

Macintosh:mls TAmoyal$ sudo rake gems:install
(in /Users/TAmoyal/Desktop/RoR_Projects/mls)
rake aborted!
no such file to load -- generator

(See full trace by running task with --trace)

Stack Trace:

/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require': no such file to load -- generator (MissingSourceFile)
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/lib/blackbook/importer/page_scraper.rb:4:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/lib/blackbook/importer/aol.rb:1:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/lib/blackbook.rb:68:in `block in <top (required)>'
    from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/lib/blackbook.rb:68:in `each'
    from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/lib/blackbook.rb:68:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from /Users/TAmoyal/Desktop/RoR_Projects/mls/vendor/plugins/blackbook/init.rb:1:in `block in evaluate_init_rb'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:146:in `eval'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:146:in `block in evaluate_init_rb'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:142:in `evaluate_init_rb'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:48:in `load'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin/loader.rb:38:in `block in load_plugins'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin/loader.rb:37:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin/loader.rb:37:in `load_plugins'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:348:in `load_plugins'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:163:in `process'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:113:in `run'
    from /Users/TAmoyal/Desktop/RoR_Projects/mls/config/environment.rb:13:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/commands/server.rb:84:in `<top (required)>'
    from script/server:3:in `require'
    from script/server:3:in `<main>'

Anyone know how to solve this?

Thanks!

+1  A: 

The problem has nothing to do with Rails. Both SyncEnumerator and Generator are part of the Ruby Core Library. You should have both in Ruby 1.8.x.

Could you post the full exception trace?

EDIT:

In Ruby 1.9 the Generator library has been removed in favor of Fibers. See here and here.

The library you are using is not compatible with Ruby 1.9. You can try to copy the Generator and SyncEnumerator files from Ruby 1.8.x, but I don't know whether this solution will work.

Simone Carletti
Thanks for the clarification. I have Ruby 1.9.x. Stack trace is posted
Tony
Generator has been removed from Ruby 1.9. See my edit on the original response for more details.
Simone Carletti
+1  A: 

in 1.9 there's Enumerator::Generator

or you might be able to get away with creating your own file 'generator' that just does Generator = Enumerator

GL. -r

rogerdpack
+1  A: 

I had this problem with ruby 1.8 and found that my problem was that i was requiring 'generator' and that changing it to require 'generator.rb' fixed it. I believe this was because of a conflict in rails with its own Generator class

zdwiel