Ruby-on-Rails Hello World on GlassFish
By arungupta on May 15, 2007
- Create a simple "Hello World" RoR application using
6.0 M9 following this
screencast. NetBeans IDE creates a standard Rails application for you
which can be easily created using "
rails hello_demo" command as well.
- Install the "
goldspike" (nee rails-integration) plug-in by giving the following command:
script/plugin install svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration/plugins/goldspike
On a Windows machine, this command can be invoked as:
ruby script/plugin install svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration/plugins/goldspike
The correct installation of this plug-in can be confirmed by checking for the presence of "
vendor/plugins/goldspike" directory in your application directory. This plug-in's purpose is to WAR'up a RoR application.
- After the plug-in is installed, right-select the NetBeans project,
Run Rake Target", select "
Refresh Target List". This will add a new category, "
war", of rake targets. Select "
create" to create a stand-alone WAR file. This is equivalent to invoking the command "
rake war:standalone:create". This will archive the Rails framework libraries in the WAR file.
- Drop this WAR file in "
domains/domain1/autodeploy" directory of your GlassFish instance and you are done!
This is really simple. I'll add database interaction in this app and report back.
Read more on Rails Integration with JavaEE servers.