Learning JRuby on Rails on Windows
I haven’t figured out how to put RoR on a USB stick, but JRuby with an embedded server seems to be a reasonable place to start, while not having to download so many files.
With thanks to JRuby on Rails 3 Step by Step
Step #1: http://jruby.org/download
>mkdir JRuby
>cd JRuby
>copy con jruby.bat
SET GEM_HOME=%~dp0
"C:Program Files (x86)Javajre6binjava.exe" -jar %~dp0jruby-complete-1.5.0.jar %*
^Z
>REM activerecord 3 beta install fails on RDoc, so we specify --no-rdoc
>jruby -S gem install rails --pre -i lib --no-ri --no-rdoc
>jruby -S gem install activerecord-jdbc-adapter -i lib
>
>jruby -S libbinrails rails_3_app
>cd rails_3_app
To support H2 database, do the following
>jruby -S gem install activerecord-jdbch2-adapter -i lib
The Gemfile has to be modified as such, note that activerecord-jdbc-adapter should be at least 0.9.6
#gem 'sqlite3-ruby', :require => 'sqlite3' gem "activerecord-jdbc-adapter", :require =>'jdbc_adapter' if defined?(JRUBY_VERSION)
>..jruby -S ..libbinbundle install
Modify the configdatabase.yml
development:
adapter: jdbch2
database: /home/$yourusername/dev/db/myapp_dev
username: sa
http://github.com/kim/jruby-rack
jruby -S rake db:migrate
jruby -S script/server
Learning notes
I can't just install a gem and use it in your Rails 3 application. Case in point: I decided to use jdbcsqlite3 instead, and dutifully installed jdcsqlite3 using the "gem install command"
jruby.bat -S gem install activerecord-jdbcsqlite3-adapter
However, Rails wouldn't load the gem
jruby.bat rake db:create rake aborted! Please install the jdbcsqlite3 adapter: `gem install activerecord-jdbcsqlite3-adapter` (no such file to load -- active_record/connection_adapters/jdbcsqlite3_adapter)
Instead, the jdbcsqlite3 adapter must be explicitly specified in the Gemfile
gem 'activerecord-jdbcsqlite3-adapter', :require => 'jdbc-sqlite3', :require =>'jdbc_adapter' if defined (JRUBY_VERSION)
About this entry
You’re currently reading “ Learning JRuby on Rails on Windows ,” an entry on Chui's Counterpoint
- Published:
- 5.19.10 / 10pm
- Category:
- Java
Comments are closed
Comments are currently closed on this entry.