ふにゃるんv2

もとは、http://d.hatena.ne.jp/Wacky/

DamageControl を入れてみよう

ぼ〜っとネットを回っていたら、DamegeControl ってソフトを知る。

DamageControl_ja Wiki - FrontPage
http://hiki.prebyte.jp/DamageControl/
DamageControl? - Home
http://damagecontrol.codehaus.org/

コードをコミットしたら、リアルタイムでビルドして結果を開発者に通知するツールって事か?


まぁ、よくわからんのでインスコしてみよう。

CI / vimrc diary
http://vimrc.hp.infoseek.co.jp/diary/cat_ci.html

を参考に、Cygwinに突っ込んでみよう。

現在のCygwinには、Rubyの最新版があるので、RubyGem(http://docs.rubygems.org/)から、rubygems-0.8.11.tgz をDLする。

$ ruby -v
ruby 1.8.2 (2004-12-25) [i386-cygwin]
$ tar xzvf rubygems-0.8.11.tgz
...
$ cd rubygems-0.8.11
$ ls
ChangeLog  Releases  doc/       lib/             redist/   test/
README     TODO      examples/  pkgs/            scripts/
Rakefile   bin/      gemspecs/  post-install.rb  setup.rb
$ ruby setup.rb
---> bin
<--- bin
---> lib
---> lib/rubygems
<--- lib/rubygems
<--- lib
---> bin
adjusting shebang: gem_mirror
<--- bin
---> lib
---> lib/rubygems
<--- lib/rubygems
<--- lib
rm -f InstalledFiles
---> bin
mkdir -p /usr/bin/
install gem /usr/bin/
install gemwhich /usr/bin/
install gem_mirror /usr/bin/
install gem_server /usr/bin/
install generate_yaml_index.rb /usr/bin/
install update_rubygems /usr/bin/
<--- bin
---> lib
mkdir -p /usr/lib/ruby/site_ruby/1.8/
install gemconfigure.rb /usr/lib/ruby/site_ruby/1.8/
install rubygems.rb /usr/lib/ruby/site_ruby/1.8/
install ubygems.rb /usr/lib/ruby/site_ruby/1.8/
---> lib/rubygems
mkdir -p /usr/lib/ruby/site_ruby/1.8/rubygems
install builder.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install cmd_manager.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install command.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install config_file.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install custom_require.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install dependency_list.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install deployment.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install doc_manager.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install format.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install gem_commands.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install gem_openssl.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install gem_runner.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install installer.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install loadpath_manager.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install old_format.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install open-uri.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install package.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install remote_installer.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install rubygems_version.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install security.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install source_index.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install specification.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install timer.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install user_interaction.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install validator.rb /usr/lib/ruby/site_ruby/1.8/rubygems
install version.rb /usr/lib/ruby/site_ruby/1.8/rubygems
<--- lib/rubygems
<--- lib

As of RubyGems 0.8.0, library stubs are no longer needed.
Searching $LOAD_PATH for stubs to optionally delete (may take a while)...
...done.
No library stubs found.

  Successfully built RubyGem
  Name: sources
  Version: 0.0.1
  File: sources-0.0.1.gem

何か、あっけなく入りましたな。
…まぁ、いいや。ってんで、DamageControl を入れてみる。

$ gem install damagecontrol
Attempting local installation of 'damagecontrol'
Local gem file not found: damagecontrol*.gem
Attempting remote installation of 'damagecontrol'
Updating Gem source index for: http://gems.rubyforge.org
Install required dependency rscm? [Yn]  y
Install required dependency rails? [Yn]  y
Install required dependency rake? [Yn]  y
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
Install required dependency log4r? [Yn]  y
Install required dependency needle? [Yn]  y
Install required dependency jabber4r? [Yn]  y
Install required dependency ruby-growl? [Yn]  y
Successfully installed damagecontrol-0.5.0.1404
Successfully installed rscm-0.3.0
Successfully installed rails-0.13.1
Successfully installed rake-0.5.4
Successfully installed activesupport-1.1.1
Successfully installed activerecord-1.11.1
Successfully installed actionpack-1.9.1
Successfully installed actionmailer-1.0.1
Successfully installed actionwebservice-0.8.1
Successfully installed log4r-1.0.5
Successfully installed needle-1.2.0
Successfully installed jabber4r-0.7.0
Successfully installed ruby-growl-1.0.0
Installing RDoc documentation for damagecontrol-0.5.0.1404...
Installing RDoc documentation for rscm-0.3.0...
Installing RDoc documentation for rake-0.5.4...
Installing RDoc documentation for activesupport-1.1.1...
Installing RDoc documentation for activerecord-1.11.1...
Installing RDoc documentation for actionpack-1.9.1...
Installing RDoc documentation for actionmailer-1.0.1...
Installing RDoc documentation for actionwebservice-0.8.1...
Installing RDoc documentation for log4r-1.0.5...

src/log4r/base.rb:2:7: Unrecognized directive 'nodoc'

src/log4r/config.rb:4:0: Unrecognized directive 'nodoc'

src/log4r/lib/drbloader.rb:2:6: Unrecognized directive 'nodoc'

src/log4r/lib/xmlloader.rb:2:6: Unrecognized directive 'nodoc'

src/log4r/logevent.rb:2:6: Unrecognized directive 'nodoc'

src/log4r/loggerfactory.rb:4:0: Unrecognized directive 'nodoc'

src/log4r/outputter/consoleoutputters.rb:2:7: Unrecognized directive 'nodoc'

src/log4r/outputter/fileoutputter.rb:4:0: Unrecognized directive 'nodoc'

src/log4r/outputter/iooutputter.rb:2:7: Unrecognized directive 'nodoc'

src/log4r/outputter/outputterfactory.rb:4:0: Unrecognized directive 'nodoc'

src/log4r/outputter/remoteoutputter.rb:2:7: Unrecognized directive 'nodoc'

src/log4r/outputter/rollingfileoutputter.rb:5:0: Unrecognized directive 'nodoc'

src/log4r/outputter/staticoutputter.rb:2:6: Unrecognized directive 'nodoc'

src/log4r/repository.rb:4:0: Unrecognized directive 'nodoc'

src/log4r/staticlogger.rb:2:6: Unrecognized directive 'nodoc'
Installing RDoc documentation for needle-1.2.0...
Installing RDoc documentation for jabber4r-0.7.0...
Installing RDoc documentation for ruby-growl-1.0.0...

PerlのCPAN並みの簡単さですな。
という訳で、動かしてみる。

$ nohup damagecontrol &
[1] 204
$ nohup: appending output to `nohup.out'
[1]+  Exit 1                  nohup damagecontrol
$ damagecontrol-webrick -d
/usr/lib/ruby/gems/1.8/gems/rscm-0.3.0/lib/rscm/path_converter.rb:5: uninitializ
ed constant RSCM (NameError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `requi
re__'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `requi
re'
        from /usr/lib/ruby/gems/1.8/gems/rscm-0.3.0/lib/rscm.rb:2
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `requi
re__'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `requi
re'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:182:in `activate'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:181:in `each'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:181:in `activate'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:167:in `activate'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:166:in `each'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:166:in `activate'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:37:in `require_gem_with_opt
ions'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:31:in `require_gem'
        from /usr/bin/damagecontrol-webrick:17

…あれぇ?
まぁ、多分、何も設定してないせいだろうなぁ。

DamageControl Developer Guide |
4.1 uninitialized constant Project (NameError)
http://hieraki.lavalamp.ca/read/chapter/23#page37

あった、あった。
やっぱ、何か設定せんとNGっぽいですな。


暫くぐぐるってたら、どうもRSCM って奴の設定をしなければNGだって事が、何となくわかってきた。

RSCM - Ruby Source Control Management API
http://rscm.rubyforge.org/

何が悪いのかなぁ?と思って、 http://rscm.rubyforge.org/files/README.html のサンプルコードを実施してみる。

  require 'rscm'

  scm = RSCM::Subversion.new("svn://some.server/some/path/trunk", "trunk")

  scm.checkout("mycheckout")
  changesets = scm.changesets("mycheckout", Time.utc(2004, 11, 10, 12, 34, 22))
  changesets.each do |changeset|
    puts changeset
  end

実行。

$ ruby test.rb
test.rb:3:in `require': No such file to load -- rscm (LoadError)
        from test.rb:3

ダメじゃん。
…何か、rscm へのrequireがうまくいってない気がしてきた。

$ ruby -e 'puts $:'
/usr/lib/ruby/site_ruby/1.8
/usr/lib/ruby/site_ruby/1.8/i386-cygwin
/usr/lib/ruby/site_ruby
/usr/lib/ruby/1.8
/usr/lib/ruby/1.8/i386-cygwin
.

暫くぐぐるってたら、"require 'rubygems'が要る気がしてきた。

#!/bin/env ruby

require 'rubygems'
require 'rscm'

再実行。

$ ruby test.rb
/usr/lib/ruby/gems/1.8/gems/rscm-0.3.0/lib/rscm/path_converter.rb:5: uninitializ
ed constant RSCM (NameError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `requi
re__'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `requi
re'
        from /usr/lib/ruby/gems/1.8/gems/rscm-0.3.0/lib/rscm.rb:2
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `requi
re__'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `requi
re'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:182:in `activate'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:181:in `each'
        from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:181:in `activate'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:26:in `requi
re'
        from test.rb:4

ふむ、requireは うまく行くようになった。
ただ、RSCMがNGって状況は変化なし。


も〜、書き換えちゃう。

/usr/lib/ruby/gems/1.8/gems/rscm-0.3.0/lib/rscm/path_convert.rb:
#WINDOWS = WIN32 || CYGWIN
↓
WINDOWS = WIN32

とすると、

$ ruby test.rb
/usr/lib/ruby/1.8/fileutils.rb:841:in `fu_list': undefined method `to_str' for n
il:NilClass (NoMethodError)
        from /usr/lib/ruby/1.8/fileutils.rb:841:in `map'
        from /usr/lib/ruby/1.8/fileutils.rb:841:in `fu_list'
        from /usr/lib/ruby/1.8/fileutils.rb:173:in `mkdir_p'
        from /usr/lib/ruby/gems/1.8/gems/rscm-0.3.0/lib/rscm/scm/subversion.rb:5
3:in `checkout'
        from test.rb:8

と変換した。ふむ。
後、少しかな?