Sunday, January 7, 2007

JRuby Going Camping Tutorial

Blog application does not work as per instructions described in JRuby Going Camping Tutorial. There are two reasons 1)latest JRuby version 0.9.2 probaly has bugs and 2)latest vesrion Camping 1.5 use un-usual ruby feature that is un-supported in JRuby. To make it work we should use JRuby version 0.9.1 and Camping version 1.4.2. The installation process for MS Windows is below 1. download,install JRuby version 0.9.1 and set JRUBY_HOME to installed directory e.g.
set JRUBY_HOME=d:\jruby-0.9.1
2. download and install MySQL into e.g.
c:\Program Files\MySQL\
3. download install MySQL JDBC and set CLASSPATH to MySQL JDBC driver e.g.
set CLASSPATH=c:\Program Files\MySQL\MySQL Server 
5.0\jdbc\mysql-connector-java-5.0.4-bin.jar
3. install camping version 1.4.2
%JRUBY_HOME%\bin\gem.bat install camping --version="1.4.2" 
--no-ri --no-rdoc --include-dependencies
4. install ActiveRecord-JDBC
%JRUBY_HOME%\bin\gem.bat install ActiveRecord-JDBC 
--no-ri --no-rdoc --include-dependencies
5. download file blog.rb from here into e.g.
d:\rubyapp\blog\
6. start mysql database manager
cd C:\Program Files\MySQL\MySQL Server 5.0\bin
mysqld.exe --console 
7. create blog database and blog user in mysql database
cd c:\Program Files\MySQL\MySQL Server 5.0\bin
mysqladmin.exe -u root create blog
mysql -u root
mysql>create user blog identified by 'blog';
mysql>grant all on blog.* to blog;
mysql>exit
mysql.exe --user=blog --password=blog -D blog
mysql>show tables
mysql>exit
8. run the blog application
d:\rubyapp\blog>%JRUBY_HOME%\bin\jruby 
%JRUBY_HOME%\bin\camping blog.rb

No comments: