Wednesday February 06, 2008
TOTD #24: Getting Started with Rails 2.0.x in JRuby 1.0.3 and JRuby 1.1RC1
This TOTD (Tip Of The Day) shows how to install Rails 2.0.x in JRuby
1.0.3 and JRuby 1.1 RC1. Then it describes how a simple Rails
application can be created and deployed using WEBrick.
First, lets deal with installing Rails 2.0.x in JRuby 1.0.3 and JRuby
1.1 RC1.
Step 1: How to install Rails
2.0.x in JRuby 1.0.3 ?
jruby-1.0.3"
directory.bin/jruby -S gem install rails --include-dependencies
--no-ri --no-rdoc
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-2.0.2
Successfully installed activesupport-2.0.2
Successfully installed activerecord-2.0.2
Successfully installed actionpack-2.0.2
Successfully installed actionmailer-2.0.2
Successfully installed activeresource-2.0.2Step 2: How to install Rails 2.0.x in JRuby 1.1RC1?
jruby-1.1RC1"
directory.bin/jruby -S gem install rails --no-ri --no-rdoc
Updating metadata for 632 gems from http://gems.rubyforge.org
................................................................................................................
................................................................................................................
................................................................................................................
................................................................................................................
................................................................................................................
........................................................................
complete
Successfully installed activesupport-2.0.2
Successfully installed activerecord-2.0.2
Successfully installed actionpack-2.0.2
Successfully installed actionmailer-2.0.2
Successfully installed activeresource-2.0.2
Successfully installed rails-2.0.2
6 gems installedStep 3: How to create and deploy a trivial Rails app ?
Once Rails is installed in JRuby 1.x, then the steps to develop and deploy a simple application are exactly same and given below:jruby -S rails --database mysql hellocd hello
jruby script/generate controller say hellovi app/controllers/say_controller.rbhello" helper method to look
like:def hello
@hello_string = "Hello from Rail 2.0.2!!"
endvi app/views/say/hello.html.erb<%= @hello_string %>config.frameworks
-= [ :active_record, :action_mailer ]" in "config/environment.rb".
Follow the steps below if you prefer configuring the database:sudo /usr/local/mysql/bin/mysqld_safe --user root
Starting mysqld daemon with databases from /usr/local/mysql/datajruby -S rake db:createjruby script/server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2008-02-05 23:35:02] INFO WEBrick 1.3.1
[2008-02-05 23:35:02] INFO ruby 1.8.5 (2007-12-15) [java]
[2008-02-05 23:35:02] INFO WEBrick::HTTPServer#start:
pid=13446204 port=3000
http://localhost:3000/say/hello.
Accessing the application shows the following output in console:127.0.0.1 - - [05/Feb/2008:23:35:31 PST] "GET
/say/hello HTTP/1.1" 200 89
- -> /say/hello
127.0.0.1 - - [05/Feb/2008:23:35:32 PST] "GET /say/hello HTTP/1.1" 200
89
- -> /say/hello
127.0.0.1 - - [05/Feb/2008:23:35:32 PST] "GET /say/hello HTTP/1.1" 200
89
- -> /say/hello=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2008-02-05 23:37:43] INFO WEBrick 1.3.1
[2008-02-05 23:37:43] INFO ruby 1.8.6 (2008-01-07) [java]
[2008-02-05 23:37:43] INFO WEBrick::HTTPServer#start:
pid=2533 port=3000
127.0.0.1 - - [05/Feb/2008:23:37:51 PST] "GET /say/hello HTTP/1.1" 200
89
- -> /say/helloPlease leave suggestions on other TOTD that you'd like to see. A complete archive is available here.
Posted by Arun Gupta in web2.0 | Comments[4]
|
|
|
|
| GlassFish Day @ India Tech Days Update - Feb 29, 2008
|
|
The GlassFish Day (Feb 29) as part of India Tech Days is now shaping up. This is one full day of focused and in-depth discussions about GlassFish - The Best Open Source Application Server. Starting from state-of-the-union, excellent tools integration, performance tips and high availability/clustering support - get ready to drink from the firehose :) |
There is a session by Accenture talking about they build their SOA infrastructure on products based on GlassFish. The in-progress agenda is available here.
The agenda of the main Tech Days is now available. Here are the GlassFish related sessions in the main Tech Days event (Feb 27 & 28):
| Date/Time | Topic | Track |
| 11-11:50 | Java EE, GlassFish & Their Future | Enterprise Track |
| 2:00-2:50 | Rapid Development with Ruby, JRuby and Rails | Enterprise Track |
| 3:00-3:50 | Java Persistence API: Further Simplifying Persistence | Enterprise Track |
| 5:20-6:10 | Java EE with Spring and Seam | Enterprise Track |
| 5:20-6:10 | Building Rich Web Applications with jMaki | Rich Clients Track |
| 11:10-12pm | Metro: Everyday Web Services | Interop Track |
| 11:10-12pm | JSF and Ajax with Project Woodstock | Community Track |
| 12:10-1pm | REST-based Programming Model | Interop Track |
| 4:30-5:20pm | SOA using OpenESB, BPEL and NetBeans | SOA Track |
And of course, how can one miss eating Hyderabad Biryani :)
Technorati: conf glassfishday suntechdays hyderabad glassfish
Posted by Arun Gupta in General | Comments[1]
|
|
|
|
|
Today's Page Hits: 1157
Total # blog entries: 1002