Problem with Ruby 1.9.1p243
pragdave opened this issue · comments
crowd server
Starting CloudCrowd Central Server on port 9173...
/Users/dave/tmp/cr/config.ru:18:in `block in <main>': undefined method `dirname' for Rack::File:Class (NoMethodError)
Technically I believe this is a problem with thin, but there's a simple workaround in config.ru. It's caused by thin evaling config.ru in the context of Rack, which has its own Rack::File class.
The trivial workaround is to change config.ru created by cloud to contain
CloudCrowd.configure(::File.dirname(__FILE__) + '/config.yml')
CloudCrowd.configure_database(::File.dirname(__FILE__) + '/database.yml')
that is, put a '::' in front of the two File constants.
Cheers
Dave
Thanks for the patch. I've added it to master, and it'll go out with the next release. I just have one question before closing the ticket. I can't reproduce it on my environment (Ruby 1.8.7, Thin 1.2.5, Rack 1.0.1, OSX), and haven't heard of other Ruby 1.9 folks running into it. What exactly are you running that causes this bug to come to light?
dave[tmp/cr 0:04:09] ruby1.9 -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10]
dave[tmp/cr 0:04:27] for i (thin rack cloud-crowd); do; gem1.9 list $i; done
thin (1.2.5)
rack (1.0.1)
cloud-crowd (0.3.0)
The problem also happens if you just run thin:
dave[tmp/cr 0:06:24] thin -p 8776 -R config.ru start
config.ru:18:in block in <main>': undefined method
dirname' for Rack::File:Class (NoMethodError)
I'm happy to dig further if there's something specific I can do.
Dave
Thanks -- I appreciate it. Looks like Ruby1.9/Thin is the trouble spot. I'm closing this ticket, and will let macournoyer know about it.
You really saved my life :) Thanks!