dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

watch-tests.watchr (763B)


      1 ENV["WATCHR"] = "1"
      2 system 'clear'
      3 
      4 def run(cmd)
      5   `#{cmd}`
      6 end
      7 
      8 def run_all_tests
      9   system('clear')
     10   result = run "./run-tests.sh"
     11   puts result
     12 end
     13 
     14 def run_test(file)
     15   system('clear')
     16   result = run "./run-tests.sh #{file} --verbose"
     17   puts result
     18 end
     19 
     20 run_all_tests
     21 watch('.*.feature') { |file| run_test file }
     22 watch('.*.el') { run_all_tests }
     23 
     24 # Ctrl-\
     25 Signal.trap 'QUIT' do
     26   puts " --- Running all tests ---\n\n"
     27   run_all_tests
     28 end
     29 
     30 @interrupted = false
     31 
     32 # Ctrl-C
     33 Signal.trap 'INT' do
     34   if @interrupted then
     35     @wants_to_quit = true
     36     abort("\n")
     37   else
     38     puts "Interrupt a second time to quit"
     39     @interrupted = true
     40     Kernel.sleep 1.5
     41     # raise Interrupt, nil # let the run loop catch it
     42     run_all_tests
     43     @interrupted = false
     44   end
     45 end