Ruby can be run on the JVM as a war file. The Hello World is really very simple following the steps outlined by Arun Gupta.
1. Install jruby.
2. Install rails and JRuby-Jack
kstam-mbpro-2:ruby kstam$ jruby -S gem install rails warbler --no-ri --no-rdoc
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed activesupport-2.1.2
Successfully installed activerecord-2.1.2
Successfully installed actionpack-2.1.2
Successfully installed actionmailer-2.1.2
Successfully installed activeresource-2.1.2
Successfully installed rails-2.1.2
Successfully installed warbler-0.9.11
7 gems installed
3. Create a Hello Rails app: jruby -S rails hello -d mysql
4. open hello/config/environment.rb in your favorite editor and uncomment so the line looks like
config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
5. Use warble to create your war file
jruby -S warble
6. copy the hello.war to your server/default/deploy directory
7. Hit http://localhost:8080/hello in your browser.
Conclusion: A rails application is basically packaged up in the WEB-INF/ directory of the war and a ruby filter defined in the web.xml takes care of running it.
I also found that in JBoss 5, there would be no need for deploying it in a war, as the the deployer framework of JBoss-Microcontainer enables in-place native deployment of Rails applications in a way familiar to traditional rubyists.
1 comment:
Thanks for the post!
With GlassFish v3 Prelude, there is no need to bundle Rails application as WAR. It can be deployed as-is. And you can even use GlassFish gem to deploy your Rails application. And even Merb applications.
This is all explained at:
http://blogs.sun.com/arungupta/entry/screencast_26_develop_run_debug
Post a Comment