The new, rewritten routes implementation in edge Rails gives JRuby a run for its money.

1.  It exposes a missing Regexp.union method in the current implementation.  Patch and tests attached for that.
2.  It uses Object#instance_eval to create special ActionController::Routing::Route#generate and #recognize methods in the singleton class of each individual Route object.  For some reason, this fails in JRuby HEAD.  Attached is a patch that fixes it, but I'm not sure if it's the correct fix.  Here's a test case that fails before and succeeds after the patch is applied (also in the attached eval-fix.patch).  It mimics the behavior of the routes code.

|  require 'test/minirunit'

|  class Foo
|    def initialize(p)
|      @prefix = p
|    end

|    def result(val)
|      redefine_result
|      result val
|    end
|   
|    def redefine_result
|      method_decl = "def result(val); \"[EMAIL PROTECTED]: \#\{val\}\"; end"
|      instance_eval method_decl, "generated code (#{__FILE__}:#{__LINE__})"
|    end
|  end

|  f = Foo.new("foo")
|  test_equal "foo: hi", f.result("hi")

|  g = Foo.new("bar")
|  test_equal "bar: hi", g.result("hi")

|  test_equal "foo: bye", f.result("bye")
|  test_equal "bar: bye", g.result("bye")

Please have a look at the fix and let me know if it's acceptable or not.

3.  Now I'm stuck for a bit.  I am able to get a bit further in Rails startup, but now I am getting a "bad file descriptor" while attempting to create a new session file:

Bad file descriptor
/Users/nicksieger/Projects/jruby/lib/ruby/1.8/pstore.rb:341:in `close'
/Users/nicksieger/Projects/jruby/lib/ruby/1.8/pstore.rb:341:in `transaction'
/Users/nicksieger/Projects/jruby/lib/ruby/1.8/cgi/session/pstore.rb:73:in `initialize'
/Users/nicksieger/Projects/jruby/lib/ruby/1.8/cgi/session.rb:273:in `new'
/Users/nicksieger/Projects/jruby/lib/ruby/1.8/cgi/session.rb:273:in `initialize'
script/../config/../vendor/rails/actionpack/lib/action_controller/cgi_process.rb:112:in `new'
script/../config/../vendor/rails/actionpack/lib/action_controller/cgi_process.rb:112:in `session'
script/../config/../vendor/rails/actionpack/lib/action_controller/base.rb:918:in `stale_session_check!'
script/../config/../vendor/rails/actionpack/lib/action_controller/cgi_process.rb:115:in `session'
script/../config/../vendor/rails/actionpack/lib/action_controller/base.rb:918:in `assign_shortcuts'
script/../config/../vendor/rails/actionpack/lib/action_controller/flash.rb:138:in `assign_shortcuts_with_flash'
script/../config/../vendor/rails/actionpack/lib/action_controller/base.rb:401:in `process'
script/../config/../vendor/rails/actionpack/lib/action_controller/filters.rb:372:in `process'
script/../config/../vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in `process_with_session_management_support'
script/../config/../vendor/rails/actionpack/lib/action_controller/base.rb:318:in `process'
script/../config/../vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch'

Any ideas about this one?  This puts me smack dab into the IO code which has seen a bit of churn lately I gather, and I'm not sure where to start looking.

Cheers,
/Nick

Attachment: regexp-union.patch
Description: Binary data

Attachment: eval-fix.patch
Description: Binary data

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jruby-devel mailing list
Jruby-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jruby-devel

Reply via email to