groupswikiを試す

pukiwikiを使っているサーバ様がヤバイので引越しないといけない。せっかくRailsを頑張っているのにどうしよっかなーと考えていると、Railswikiというものがあることを教えてもらった。

しかしアレだ、「イイYo!」というページは見つかるが、実際の導入手順については誰も書いていない・・・試していないのか?
 
ダウンロード
groupswikiのページから辿ってダウンロードする。*.tar.gzを解凍してみるとREADEMEが見つかる。

Rails is a web-application and persistence framework that includes everything needed to create database-backed web-applications according to the Model-View-Control pattern of separation. This pattern splits the view (also called the presentation) into "dumb" templates that are primarily responsible
for inserting pre-built data in between HTML tags. The model contains the "smart" domain objects (such as Account, Product, Person, Post) that holds all the business logic and knows how to persist themselves to a database. The controller handles the incoming requests (such as Save New Account, Update Product, Show Post) by manipulating the model and directing data to the view.
レールはウェブアプリケーションです、そして、網羅する固執枠組みは分離のModel視点コントロールパターンによると、データベースで支持されたウェブアプリケーションを作成する必要がありました。 このパターンは意見(また、プレゼンテーションと呼ばれる)を主としてHTMLタグの間でプレ組立のデータを差し込むのに原因となる「馬鹿な」テンプレートに分けます。 モデルはすべてのビジネス論理を保持して、データベースに自分たちを固持する方法を知っている「賢い」ドメイン目的(Account、Product、Person、ポストなどの)を含んでいます。 コントローラは、モデルを操作して、視点にデータを向けることによって、入って来る要求(Save New Account、Update Product、ショーポストなどの)を扱います。(by Excite翻訳)

素晴しさをアピールしているっぽい。この先も訳してみると

READMEを嫁ということだった。
 
groupswiki-revision-2フォルダ
こいつの中身が一番重要なポイントなんだと分かった。

You will need the following to use groupswiki:

* Ruby 1.8.5+
* MySQL server

C:\>ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]

こいつはOKだ
 

And the following gems:

* rails - we use version 1.2.3
* tidy - we use version 1.1.2
* minimagick or rmagick

C:\>rails -v
Rails 1.2.3

C:\>tidy -v
'tidy' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。

C:\>minimagic -v
'minimagic' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。

C:\>rmagic -v
'rmagic' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。

どうしよう?
まずはtidyから

C:\>cd Ruby

C:\Ruby>set http_proxy=http://(server name):port

C:\Ruby>gem install tidy
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed tidy-1.1.2
Installing ri documentation for tidy-1.1.2...
Installing RDoc documentation for tidy-1.1.2...

C:\Ruby>tidy -v
'tidy' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
C:\Ruby>dir tidy* /s
(いっぱい)

ディレクトリを見ると入っていた。
次にminimagicを試す

C:\Ruby>gem install minimagic
ERROR: While executing gem ... (Gem::GemNotFoundException)
Could not find minimagic (> 0) in any repository

「知らんがな」と言われてしまった。

C:\Ruby>gem install rmagic
ERROR: While executing gem ... (Gem::GemNotFoundException)
Could not find rmagic (> 0) in any repository

こっちも「知らんがな」うーむ・・・
Google先生に聞いてみると「minimagic、なにそれ」ってな感じだけど「rmagicなら知っているよ」だったので、rmagicを入れることにする。
ちなみにR-magicとは関係がない。
 
しまった、またスペルミスしていた!「知らんがな」と言われて当然だ・・・
再チャレンジ!

C:\Ruby>gem install rmagick
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby gem_extconf.rb install rmagick

sh configure

gem_extconf.rb:38: undefined method `exitstatus' for nil:NilClass (NoMethodError)

Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/rmagick-1.15.10 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/rmagick-1.15.10/gem_make.out

C:\Ruby>

gemのところでエラーになっている。Ruby ForgeのRMagickからwin32をダウンロードして展開してから試してみる

c:\Users\kenmituo\Downloads\RMagick-1.15.9_IM-6.3.5-8-Q8_prod>gem install rmagic
k-1.15.9-win32.gem
Successfully installed rmagick, version 1.15.9
c:\cd c:\Ruby
c:\Ruby>dir rmagick* /s
(いっぱい)

成功したらしい。

環境は整った!これからだ・・・と思う。
そしてMysqlとか

Once you've got these - run the following commands on the command-line to set up your installation:

mysqladmin -u root create groupswiki_production
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake db:fixtures:load
RAILS_ENV=production script/server

コノあたりが重要だろう
productionを作れと書いてあるように読めるけど、開発版としてdevelopmentで試すことにする。
 
プロジェクトを作り忘れてた
その前にAptanaIDEでRailsプロジェクトを作る。「groupswiki」って名前にしてみた。
そしてプロジェクトにダウンロードしたgroupswikiのディレクトリを全て上書きにした。
 

データベースを作る
utf8で作成しておくことにする

c:\Ruby>mysql -u root -p
Enter password: *******
Welcome to the MySQL monitor.
・・・
mysql> create database groupswiki_dev default character set utf8;
Query OK, 1 row affected (0.06 sec)

mysql>

次にRailsの「 config/database.yml 」を修正しておく

production:
adapter: mysql
database: groupswiki_production
username: root
password: ***********
encoding: utf8

 
さて、ここからが困った。AptanaIDEでRakeタスクに何も表示されていない。

c:\Ruby>gem update rake
Updating installed gems...
Need to update 2 gems from http://gems.rubyforge.org
..
complete
Attempting remote update of rake
Successfully installed rake-0.7.3
Installing ri documentation for rake-0.7.3...
Installing RDoc documentation for rake-0.7.3...
Gems: [rake] updated

rakeをアップデートしてみたけど変わらない。

c:\Aptana IDE Beta\grupswiki\db>gem update --system
Updating RubyGems...
Attempting remote update of rubygems-update
Successfully installed rubygems-update-0.9.4
Updating version of RubyGems to 0.9.4
Installing RubyGems 0.9.4
・・・
RubyGems system software updated

gemのアップデートやってみたけどかわらない。
 
直接実行してみる
AptanaIDEなんて使わずにやってやるぜ!

RAILS_ENV=production rake db:migrate

c:\Aptana IDE Beta\grupswiki\db>rake db:migrate RAILS_ENV="development"
(in c:/Aptana IDE Beta/grupswiki)
Cannot find gem for Rails ~>1.2.2.0:
Install the missing gem with 'gem install -v=1.2.2 rails', or
change environment.rb to define RAILS_GEM_VERSION with your desired version.

しかたない、言われたとおりにやってみる。

c:\Aptana IDE Beta\grupswiki\db>gem install -v=1.2.2 rails
Install required dependency activesupport? [Yn] y
Install required dependency activerecord? [Yn] Y
Install required dependency actionpack? [Yn] y
Install required dependency actionmailer? [Yn] y
Install required dependency actionwebservice? [Yn] y
Successfully installed rails-1.2.2
Successfully installed activesupport-1.4.1
Successfully installed activerecord-1.15.2
Successfully installed actionpack-1.13.2
Successfully installed actionmailer-1.3.2
Successfully installed actionwebservice-1.2.2
Installing ri documentation for activesupport-1.4.1...
Installing ri documentation for activerecord-1.15.2...
Installing ri documentation for actionpack-1.13.2...
Installing ri documentation for actionmailer-1.3.2...
Installing ri documentation for actionwebservice-1.2.2...
Installing RDoc documentation for activesupport-1.4.1...
Installing RDoc documentation for activerecord-1.15.2...
Installing RDoc documentation for actionpack-1.13.2...
Installing RDoc documentation for actionmailer-1.3.2...
Installing RDoc documentation for actionwebservice-1.2.2...

終わった。再チャレンジ!!

c:\Aptana IDE Beta\grupswiki\db>rake db:migrate RAILS_ENV="development"
(in c:/Aptana IDE Beta/grupswiki)
rake aborted!
Unable to load /usr/lib/libtidy.dylib

(See full trace by running task with --trace)

うげげ・・・ここでAptanaIDEのRakeタスクを再表示させると、直っていた!
 
こっちをつかってみるがやっぱりダメだった。
 
 
ScrAPIってものが必要らしい。

c:\Ruby>gem install scrapi
Successfully installed scrapi-1.2.0
Installing ri documentation for scrapi-1.2.0...
Installing RDoc documentation for scrapi-1.2.0...

何かが出来た。

C:\Ruby\lib\ruby\gems\1.8\gems\scrapi-1.2.0\lib\tidy\dir
2007/11/16 15:55 364,544 libtidy.dll
2007/11/16 15:55 338,761 libtidy.so

dllをgourpswiki/lib/に置く

c:\Aptana IDE Beta\grupswiki\db>rake db:migrate RAILS_ENV="development"
c:\Aptana IDE Beta\grupswiki\db>rake db:fixtures:load RAILS_ENV="development"

これで動いた!!
 
わーいわーい!!
 
動いてみて分かった事実

  • 日本語入力はできるけど、検索ができない
  • 画像の貼り付けが出来ない

orz