test-loop 12.0.1 → 12.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -12
- data/lib/test/loop/rails.rb +3 -3
- data/lib/test/loop.rb +3 -6
- metadata +2 -2
data/README.md
CHANGED
@@ -32,7 +32,7 @@ Features
|
|
32
32
|
|
33
33
|
* Configurable through a `.test-loop` file in your working directory.
|
34
34
|
|
35
|
-
* Implemented in less than
|
35
|
+
* Implemented in less than 215 lines (SLOC) of pure Ruby code! :-)
|
36
36
|
|
37
37
|
------------------------------------------------------------------------------
|
38
38
|
Prerequisites
|
@@ -44,9 +44,10 @@ Prerequisites
|
|
44
44
|
|
45
45
|
To check if your system qualifies, launch `irb` and enter the following:
|
46
46
|
|
47
|
-
Process.respond_to? :fork
|
47
|
+
Process.respond_to? :fork # must be true
|
48
48
|
|
49
|
-
|
49
|
+
signals = %w[INT TSTP QUIT TERM CHLD].sort
|
50
|
+
Signal.list.keys.sort & signals == signals # must be true
|
50
51
|
|
51
52
|
------------------------------------------------------------------------------
|
52
53
|
Installation
|
@@ -75,7 +76,7 @@ If installed as a Git clone:
|
|
75
76
|
|
76
77
|
You can monitor your test processes in another terminal:
|
77
78
|
|
78
|
-
watch 'ps
|
79
|
+
watch 'ps xfw | sed -n "1p; /test-loop/p" | fgrep -v sed'
|
79
80
|
|
80
81
|
If it stops responding, you can annihilate test-loop from another terminal:
|
81
82
|
|
@@ -103,17 +104,17 @@ you can query and modify the `Test::Loop` OpenStruct configuration as follows:
|
|
103
104
|
|
104
105
|
### Test::Loop.overhead_file_globs
|
105
106
|
|
106
|
-
|
107
|
-
|
107
|
+
Array of file globbing patterns that describe a set of Ruby scripts that are
|
108
|
+
loaded into the main Ruby process as overhead.
|
108
109
|
|
109
110
|
### Test::Loop.reabsorb_file_globs
|
110
111
|
|
111
|
-
|
112
|
-
|
112
|
+
Array of file globbing patterns that describe a set of files which cause the
|
113
|
+
overhead to be reabsorbed whenever they change.
|
113
114
|
|
114
115
|
### Test::Loop.test_file_matchers
|
115
116
|
|
116
|
-
|
117
|
+
Hash that maps a file globbing pattern describing a set of source files to a
|
117
118
|
lambda function yielding a file globbing pattern describing a set of test
|
118
119
|
files that need to be run. In other words, whenever the source files (the
|
119
120
|
hash key; left-hand side of the mapping) change, their associated test files
|
@@ -148,9 +149,9 @@ will return `nil`, thereby excluding those source files from being tested.
|
|
148
149
|
|
149
150
|
### Test::Loop.test_name_parser
|
150
151
|
|
151
|
-
|
152
|
-
|
153
|
-
|
152
|
+
Lambda function that is passed a line of source code to determine whether that
|
153
|
+
line can be considered as a test definition, in which case it must return the
|
154
|
+
name of the test being defined.
|
154
155
|
|
155
156
|
### Test::Loop.before_each_test
|
156
157
|
|
data/lib/test/loop/rails.rb
CHANGED
@@ -2,12 +2,12 @@ require 'test/loop'
|
|
2
2
|
|
3
3
|
Test::Loop.reabsorb_file_globs.push(
|
4
4
|
'config/**/*.{rb,yml}',
|
5
|
-
'
|
5
|
+
'db/schema.rb',
|
6
6
|
'Gemfile.lock'
|
7
7
|
)
|
8
8
|
|
9
|
-
Test::Loop.test_file_matchers['app/**/*.rb'] =
|
10
|
-
Test::Loop.test_file_matchers
|
9
|
+
Test::Loop.test_file_matchers['{app,lib,test,spec}/**/*.rb'] =
|
10
|
+
Test::Loop.test_file_matchers.delete('lib/**/*.rb')
|
11
11
|
|
12
12
|
require 'rails/railtie'
|
13
13
|
Class.new Rails::Railtie do
|
data/lib/test/loop.rb
CHANGED
@@ -223,16 +223,13 @@ module Test
|
|
223
223
|
|
224
224
|
started_at = Time.now
|
225
225
|
worker_pid = fork do
|
226
|
-
# handle signals meant for worker process
|
227
|
-
[:TERM, :CHLD].each {|sig| trap sig, 'DEFAULT' }
|
228
|
-
|
229
|
-
# ignore signals meant for master process
|
230
|
-
[:INT, :TSTP, :QUIT].each {|sig| trap sig, 'IGNORE' }
|
231
|
-
|
232
226
|
# detach worker from master's terminal device so that
|
233
227
|
# it does not receieve the user's control-key presses
|
234
228
|
Process.setsid
|
235
229
|
|
230
|
+
# unregister signal handlers inherited from master process
|
231
|
+
[:TERM, :CHLD, :INT, :TSTP, :QUIT].each {|sig| trap sig, 'DEFAULT' }
|
232
|
+
|
236
233
|
# detach worker from master's standard input stream
|
237
234
|
STDIN.reopen IO.pipe.first
|
238
235
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: test-loop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 12.0.
|
5
|
+
version: 12.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Suraj N. Kurapati
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-04-
|
14
|
+
date: 2011-04-21 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|