Im order to do it, you have to perform the following steps.
1. Install ruby interpreter into ${ruby.home} (e.g. c:\ruby-1.8.4-20).
You can download latest version for Windows from here:
http://rubyforge.org/frs/download.php/11926/ruby184-20.exe
Test it (check ruby version):
>ruby.exe -v
Ruby installation has packaging tool called gem. Test it's version:
>gem.bat -v
2. Install rails. You can do it in one command:
>gem.bat --no-rdoc --no-ri --include-dependencies install rails
If you are behind the proxy, download gems separately and then install them individually:
>gem.bat install --no-rdoc --no-ri activesupport-1.3.1.gem
>gem.bat install --no-rdoc --no-ri activerecord-1.14.4.gem
>gem.bat install --no-rdoc --no-ri actionpack-1.12.5.gem
>gem.bat install --no-rdoc --no-ri actionmailer-1.2.5.gem
>gem.bat install --no-rdoc --no-ri actionwebservice-1.1.6.gem
>gem.bat install --no-rdoc --no-ri RbYAML-0.1.0.gem
>gem.bat install --no-rdoc --no-ri rails-1.1.6.gem
All of these gem files could be downloaded from http://rubyforge.org site.
You can also update gem tool to the latest version:
>gem.bat install --no-rdoc --no-ri rubygems-update-0.9.0.gem
Test rails version:
>rails.bat -v
3. Install jruby library into ${jruby.home} folder (e.g. c:\jruby-0.9.1).
Prepare jruby.bat script file:
SET RUBY_HOME=c:\ruby-1.8.4-20
SET JRUBY_HOME=c:\jruby-0.9.1
SET CLASSPATH=%JRUBY_HOME%\lib\jruby.jar;%JRUBY_HOME%\lib\jvyaml.jar;%JRUBY_HOME%\lib\plaincharset.jar;%JRUBY_HOME%\lib\asm.jar
java -Djruby.home=%RUBY_HOME% -Djruby.shell="cmd.exe" -Djruby.script=jruby.bat -classpath %CLASSPATH% org.jruby.Main
The trick here is that we use native ruby libraries from ruby installation (not from jruby installation).
Now you can execute all commands, required for building/running Rails application.
4. Create new project (testrails). Keep in mind that the project will be created in the current directory:
>jruby.bat c:\ruby-1.8.4-20\bin\rails testrails
Newly generated project has already some commands inside, so we need to change the current directory:
>cd testrails
5. Modify testrails\config\database.yml to point to your database. By default, it's MySQL database.
6. Start the database. Create database for devepoment: testrails_development
7. Generate the model
>jruby.bat .\script\generate controller MyTest
8. Generate the controller
>jruby.bat .\script\generate controller MyTest
9. Start the WEBrick server
>start jruby.bat .\script\server
10. Test if server is started properly in the browser:
>http://localhost:3000/my_test
Now you should see your view.
Rails on JRuby is very slow. Let's wait for improvements from JRuby team.