Using RSpactor with Linux

April 10th, 2008Posted by benediktFiled in Agile Development, Articles, Linux, Ruby, Ruby on Rails

Andreas Wolff recently released RSpactor, a (up to now) command line tool similar to autotest. Nevertheless it differs from autotest in two points. First it’s focused on RSpec and secondly it’s using Mac OS’ FSEvents to monitor file changes. According to this it only runs on Mac OS. To get it running on Linux you’ll have to change RSpactor’s Listener class to use Linux’ equivalent to FSEvents called inotify. Luckily there’s a gem called RInotify which introduces a simple class to access the inotify events within ruby. I rewrote the Listeners class yesterday to get it running on my Linux notebook:

   1  # inotify_listener.rb
   2  
   3  class Listener
   4  
   5    def initialize(&block)
   6      require 'rinotify'
   7      begin
   8        @spec_run_time = Time.now
   9        @watching      = {}
  10  
  11        notify = RInotify.new
  12        Dir.glob(File.join(Dir.pwd, '**')).each do |dir|
  13          watch_desc = notify.add_watch(dir, RInotify::MODIFY | RInotify::CREATE | RInotify::DELETE)
  14          @watching[watch_desc] = dir
  15        end
  16  
  17        while true do
  18          changed_files = []
  19          notify.each_event do |event|
  20            changed_files << build_path_from_event(event)
  21          end
  22          changed_files.uniq!
  23          unless changed_files.empty?
  24            @spec_run_time = Time.now
  25            yield changed_files
  26          end
  27          sleep(5)
  28        end
  29      rescue Interrupt
  30        @watching.each_key { |key| notify.rm_watch(key) }
  31      end
  32    end
  33  
  34    def build_path_from_event(event)
  35      File.join(@watching[event.watch_descriptor], event.name || '')
  36    end
  37  
  38  end

To get it running you simply have to install the RInotify gem and change one line in bin/rspactor:

   1  # from
   2  require File.join(File.dirname(__FILE__), '..', 'lib', 'listener')
   3  # to
   4  require File.join(File.dirname(__FILE__), '..', 'lib', 'inotify_listener')

That’s it! RSpactor should be running on Linux now and consuming much less CPU than autotest.

(You might also want to change the system()-call in lib/resulting.rb as it’s currently using growl to notify you about the test results.)

Developer Abuse

August 21st, 2007Posted by benediktFiled in Agile Development

Watch this (sad) video on YouTube. It’s the winner of the Agile Advert video contest. The other videos are available at agileadvert.org [ via ]

Agile Development

March 8th, 2007Posted by benediktFiled in Agile Development

Since a few months I’m working on a project at university. We are creating a browser-based whiteboard-like collaboration plattform called ‘EduCs’. The university told us to use the waterfall approach. We spent the whole last term creating documents and just finished the design-phase about two weeks ago. I already hated it shortly after we started and looked for alternatives. Thanks to Rails I got to know ‘Agile Development’. (We had a lecture about software engineering which never mentioned it).

Since then I’ve been reading books, watching talks and listening to Chaosradio a lot. Agile Development seems to fit my feeling about how to do software. As I’ve to do an internship in about one year to get my bachelor degree, I’ve started to look out for companies using agile methods. I didn’t expect it to be this hard. I’ve been asking some of my friends how the projects are done in their companies. Shockingly most of them told me that their not even doing the waterfall approach or anything similar. Only one told me – while working on a half finished website, that was going to be released the next day – they had a whole bunch of people solely managing and organizing the projects.

Why is this? Are there so few companies caring about how they do their software or do I just know the “wrong” people?