Tom, Ola, and I have been working over the past week to get remaining Rails issues wrapped up. As a result of our efforts:
- ActionPack is now "practically" 100% working, minus a test or two we can't support and a few tests that are broken or that run fine in isolation (it would be nice to know *why* those fail)
- ActiveSupport is well above 95% passing
- ActiveRecord is in the 90% range passing with MySQL and in the 80% range with Derby
So here is a set of instructions on how YOU, dear reader, can help round out JRuby's support for Ruby on Rails.
- Getting a testbed set up
- Update JRuby trunk (http://svn.codehaus.org/jruby/trunk/jruby), build it (ant clean jar), love it
- Install Rake (gem install rake)
- Fetch Rails 1.2.1 from Rails SVN at http://dev.rubyonrails.org/svn/rails/tags/rel_1-2-1/
- Running the tests
- From within the module under test (like activesupport/ or actionmailer/) just run "rake". All tests should execute and a report should be provided at the end. You can usually run tests individually as well, although a few depend on the side-effects of previous tests.
- ActiveRecord requires some additional setup; I'll update this post with Tom's instructions and patches shortly.
- Reporting issues
- Reporting failures in Rails is good
- Reporting reduced test cases or clear explanations for failures in Rails is better
- Reporting reduced test cases and including patches for failures in Rails is BEST
- Don't forget to check if your issue has already been reported, and please sync up on the mailing list while you're working
- Patches will probably not be accepted without a reusable test case. We're trying to grow our regression suite as a result of this work.
- JRuby's JIRA is here: http://jira.codehaus.org/browse/JRUBY
- Caveats, things to watch for, things to try
- ActiveRecord (with the AR-JDBC adapter) could use wider DB testing. We've done quite a bit of work with MySQL and Tom has been improving Derby support, but there are lots of other databases out there. Pick your favorite database, follow Tom's instructions to get up and going, and report issues (in the JRuby JIRA at least, but also report to jruby-extras project if appropriate)
- Railties includes code that will never run under JRuby, like its fcgi-based dispatcher tests. You should confirm with us that they're expected, and then ignore or delete them for your future runs.
- Rails is a very...interesting...application to debug. Feel free to ask on-list if you simply don't get something. I've seen things in Rails code no man should have to see, so I know it can be frustrating to debug at times.
Update: A couple folks pointed out that the codebase didn't compile under Java 1.4.2. That has been corrected!
Update 2: A few folks are seeing a problem installing gems related to the %p operator to printf. We're working on that, and it's a fairly minor issue, but to avoid it there's one additional step before you install rake: set the JRUBY_HOME env var to the root of your JRuby stuff.
Charles et al,
ReplyDeleteGreat job!
I have checked out the code per your instructions and tried to compile it. I get two kinds of errors -
1) InvocationCallbackFactory.java complains that it cannot resolve symbol IllegalArgumentException. I could not find the IllegalArgumentException.java file anywhere in the code base.
2) StandardASMCompiler.java complains about the replace method on lines 137 and 963 - replace(char, char) cannot be applied to replace(String, String).
Perhaps you could refresh the code base.
Can't wait to run my Rails app on JRuby!
Thanks,
Bhanu
Thanks for all your work!
ReplyDeleteI'm not much of a java guy but I plan to run all my apps on this tonight to do some debugging. If I can get it figured out I'll post what I get.
I can't wait for this as a deployment option!
I'm also not a java guy but I love the idea of anything that might make ruby run faster.
ReplyDeleteWhat I'm not clear on is If I build jruby, will rails automatically use jruby? My ruby bin path hasn't changed post build.
@ Michael Air:
ReplyDeleteAfter you build JRuby, you need to change your path to point to the jruby bin directory. If you followed install instructions and set $JRUBY_HOME appropriately, this is done with:
export $PATH = $JRUBY_HOME / bin : $PATH
(remove extra spaces I added for readability).
The command above assumes you're in some sort of Unix environment. If on Windows, it's :
PATH = %JRUBY_HOME% \ bin ; %PATH%
(again, remove extra spaces I added for readability)
Changing the path will make sure that gem, ruby, and a few other commands are run by jruby instead of by your "normal" Ruby install.
Hi,
ReplyDeleteUpon executing gem i get the following exception:
java.lang.NoSuchMethodError: java.lang.Character.isWhitespace(I)Z
at org.jruby.RubyString.stripInternal(RubyString.java:2464)
Any ideas here on whats going on ?
Greetings,
Leo