デル株式会社
Apple Store(Japan)

Ubuntu + Rails + RSpec + ZenTest + Notify  Ubuntu + Rails + RSpec + ZenTest + Notify

Railsのテスト環境を改めて- MacOSX / RSpec / ZenTest / Growl:TKMR.blog.show

こちらの記事にあることと同じことをUbuntuでもやりたいと思った。できたので備忘録。

Ubuntu +Rails + Rspec + ZenTest + Notify

必要な手順は参照先とほとんど同じである。変更点は11番から。

MacのGrowlに相当するものは、UbuntuではNotifyがある。こちらを利用。

sudo apt-get install libnotify-bin

~/.autotestファイルを以下のような内容にする。

module Autotest::Notify
  def self.notify(title, message, priority='critical')
    icon = if priority == 'critical'
      'dialog-error'
    else
      'dialog-information'
    end
    system "notify-send -u #{priority} -t 10000 -i #{icon} '#{title}' '#{message.inspect}'"
  end
  
  Autotest.add_hook :ran_command do |at|
    results = [at.results].flatten.join("\\n")
    output = results.slice(/(\\d+)\\s+examples?,\\s*(\\d+)\\s+failures?(,\\s*(\\d+)\\s+pending)?/)
    if output
      if $~[2].to_i > 0
        notify "Test Results", "#{output}"
      else
        notify "Test Results", "#{output}", "low"
      end
    end
  end
end

gemパッケージにサンプルモジュールがあるが、なぜかそれは動いてくれない。なのでこれで代用。すばらしいです。

トラックバック(0)

このブログ記事を参照しているブログ一覧: Ubuntu + Rails + RSpec + ZenTest + Notify

このブログ記事に対するトラックバックURL: http://colspan.net/mt/mt-tb.cgi/215

コメントする

Sony Style(ソニースタイル)
Just MyShop(ジャストシステム)
ioPLAZA【オリジナルセット品】
Apple Store(Japan)
デル株式会社
EIZOダイレクト
NEC「得選街」
サンワダイレクト SDカード・miniSDカード・microSDカードが激安! JAL日本航空 特便割引
マウスコンピューター/G-Tune  

最近のブログ記事

LinuxでUSB外付けディスクを快適にマウントする
LinuxでUSB外付けディスクをつな…
25回目の誕生日
考えてみれば誕生日にブログを更新した記…
D945GCLF2 ファン故障
会社から自宅に帰ってくると、NASが激…

アーカイブ