jrubyでrails

jrubyrailsを動かす際の、導入手順のメモ。DBはMySQL

sudo port install jruby

vi ~/.zshrc
> export JRUBY_HOME=/opt/local/share/java/jruby
source ~/.zshrc

sudo jgem install rails

# JDBC用のドライバをインストール
# 詳しくは http://jruby-extras.rubyforge.org/activerecord-jdbc-adapter/
sudo jgem install activerecord-jdbc-adapter # 下のmysql用アダプタだけで大丈夫かも
sudo jgem install activerecord-jdbcmysql-adapter

sudo ln -s $JRUBY_HOME/bin/rails /opt/local/bin/jrails # 既存のものがあるかも

jrails -d mysql app_name
cd app_name

jruby script/generate jdbc

vi config/database.yml
> development:
>    adapter: jdbcmysql # mysqlから編集
>    username: app_name
>    password:
>    hostname: localhost
>    database: app_name_development

jruby script/generate scaffold memo title:string body:text
jrake db:create
jrake db:migrate
jruby script/server