test-loop 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README.md +1 -1
  2. data/bin/test-loop +7 -12
  3. metadata +3 -3
data/README.md CHANGED
@@ -24,7 +24,7 @@ Features
24
24
  * Supports Test::Unit, RSpec, or any other testing framework that is utilized
25
25
  by your application's `test/test_helper.rb` and `spec/spec_helper.rb` files.
26
26
 
27
- * Implemented in less than 60 (SLOC) lines of code! :-)
27
+ * Implemented in less than 55 (SLOC) lines of code! :-)
28
28
 
29
29
 
30
30
  Installation
data/bin/test-loop CHANGED
@@ -57,18 +57,10 @@ begin
57
57
  end
58
58
 
59
59
  # continuously watch for and test changed code
60
+ epoch_time = Time.at(0)
60
61
  started_at = last_ran_at = Time.now
61
- never_ran_at = Time.at(0)
62
-
63
- trap :QUIT do
64
- notify 'Re-executing loop...'
65
- started_at = never_ran_at
66
- end
67
-
68
- trap :TSTP do
69
- notify 'Testing everything...'
70
- last_ran_at = never_ran_at
71
- end
62
+ trap(:QUIT) { started_at = epoch_time }
63
+ trap(:TSTP) { last_ran_at = epoch_time }
72
64
 
73
65
  notify 'Ready for testing!'
74
66
  loop do
@@ -82,6 +74,7 @@ begin
82
74
 
83
75
  # fork worker process to run the test files
84
76
  unless test_files.empty?
77
+ notify 'Running tests...'
85
78
  last_ran_at = Time.now
86
79
  fork { test_files.each {|file| notify file; load file } }
87
80
  Process.wait
@@ -90,12 +83,14 @@ begin
90
83
 
91
84
  # reabsorb test execution overhead as necessary
92
85
  if Dir[*@reabsorb_file_globs].any? {|file| File.mtime(file) > started_at }
93
- notify 'Reabsorbing overhead...'
86
+ notify 'Restarting loop...'
94
87
  exec $0, *ARGV
95
88
  end
96
89
 
97
90
  sleep 1
98
91
  end
92
+ rescue Interrupt
93
+ # user wants to quit the loop
99
94
  rescue StandardError, LoadError => error
100
95
  puts error.inspect, error.backtrace
101
96
  sleep 1 and exec $0, *ARGV
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 0
8
- - 1
9
- version: 2.0.1
8
+ - 2
9
+ version: 2.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Suraj N. Kurapati
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-01 00:00:00 -08:00
17
+ date: 2011-01-02 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies: []
20
20