rack "config.ru" do
  listen 9292
  if File.exist?('REDEPLOY')
    puts "watching REDEPLOY"
    watch 'REDEPLOY'
    Thread.new do
      require 'fileutils'
      loop do
        puts "Touching REDEPLOY"
        FileUtils.touch('REDEPLOY')
        sleep 2
      end
    end
  else
    puts "watching in dev mode"
    watch *Dir['config.ru', 'lib/**/*', 'views/**/*'].to_a
  end
end

# Local Variables:
# mode: ruby
# End:
