Chiliproject 2.0.0をインストールしてみた
Chiliproject 2.0.0がリリースされた。
Rails3対応とact_as_journalized、bundlerあたりがこのリリースの目玉となっているようだ。
インストールの方法はこちらに載っているのだが、
Windowsだとなかなかうまくいかなかった。色々といじってどうにか起動できたのでメモ書きとして残す。
ちなみに、同じような悩みを持っている人はいるようで
フォーラムにもこんなものがあった。(一蹴されているが)
Prepare
基本的にはChiliprojectのインストールページを参考にする。
今回は以下のような環境で行った
- Windows XP
- ruby 1.8.7 i386-mingw32
- Rails 2.3.12
- MySQL 5.5.9
今回はbundleでほとんどのgemをインストールしてくれるのでrailsとbundlerが入っていればいい...かどうかは
わからないが、すくなくともbundlerは必須なので事前に入れておく必要がある。
$ gem install bundler
Installation
インストールで詰まったのは手順の2.(ChiliProject 2.x only) Install the required gems using bundler のみ。
おそらくrmagickのインストールで失敗する。
rmagick
WindowsはWin向けのrmagickが必要で、そのためにインストールが失敗しているようだ。
下記のページからWin用のrmagickおよびimagemagickをダウンロードしてインストールする。
今回は2.12.0 binary gem for Ruby 1.8.6を使った。
しかし、bundleを実行すると頑なにrmagick 1.15.17を入れようとして失敗する。
gemとして入っていれば問題ないようなのでbundleの候補からはずしてしまう。
%chiliproject_home%\Gemfile を編集する。20行目あたりをコメントアウト。
#group :rmagick do # gem "rmagick", "~> 1.15.17" #end
Database Adapter
上記の対応を行うとbundleに成功する。しかし、そのまま進むと
6.Create the basic database structure by running the following command under the application root directory:のあたりで
$ rake db:migrate RAILS_ENV=production rake aborted! Please install the mysql adapter: `gem install mysql` (no such file to load ...
というエラーになる。
Gemfileにdatabase adapterは記述してあったのに見つからないとは之如何に?とおもったら
こんな記述があった。30行目あたり。
platforms :mri do
こちらのPLATFORMSの章を見てみると
mri Same as ruby, but not Rubinius
mingw Windows 'mingw32' platform (aka RubyInstaller)
と書いてある。というわけでplatformsを変更した。
#platforms :mri do platforms :mingw do ...
ついでにmysql2 0.2.7はWindowsに対応していないようなのでruby-mysqlに変更する。
group :mysql2 do # gem "mysql2", "~> 0.2.7" gem "ruby-mysql" end
ruby-mysqlを使った場合はMySQLサーバーのホストとしてlocalhostが指定できないらしいので変更
production: adapter: mysql database: chiliproject host: 127.0.0.1 username: password: encoding: utf8
あとは手順通りにおこなうことでChiliproject 2.0.0を動かすことが出来た。
rmagickのバージョンが異なるのが気になるが、今のところ特に問題なく動いている。
最終的なGemfileはこんな感じ。
source :rubygems gem "rails", "2.3.12" gem "coderay", "~> 0.9.7" gem "i18n", "~> 0.4.2" gem "rubytree", "~> 0.5.2", :require => 'tree' gem "rdoc", ">= 2.4.2" group :test do gem 'shoulda', '~> 2.10.3' gem 'edavis10-object_daddy', :require => 'object_daddy' gem 'mocha' end group :openid do gem "ruby-openid", '~> 2.1.4', :require => 'openid' end #group :rmagick do # gem "rmagick", "~> 1.15.17" #end # Use the commented pure ruby gems, if you have not the needed prerequisites on # board to compile the native ones. Note, that their use is discouraged, since # their integration is propbably not that well tested and their are slower in # orders of magnitude compared to their native counterparts. You have been # warned. # #platforms :mri do platforms :mingw do group :mysql do gem "mysql" # gem "ruby-mysql" end group :mysql2 do # gem "mysql2", "~> 0.2.7" gem "ruby-mysql" end group :postgres do gem "pg", "~> 0.9.0" # gem "postgres-pr" end group :sqlite do gem "sqlite3-ruby", "< 1.3", :require => "sqlite3" # please tell me, if you are fond of a pure ruby sqlite3 binding end end platforms :jruby do gem "jruby-openssl" group :mysql do gem "activerecord-jdbcmysql-adapter" end group :postgres do gem "activerecord-jdbcpostgresql-adapter" end group :sqlite do gem "activerecord-jdbcsqlite3-adapter" end end # Load plugins' Gemfiles Dir.glob File.expand_path("../vendor/plugins/*/Gemfile", __FILE__) do |file| puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` instance_eval File.read(file) end