testr 14.1.3 → 14.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.markdown CHANGED
@@ -1,3 +1,19 @@
1
+ ------------------------------------------------------------------------------
2
+ Version 14.2.0 (2012-01-16)
3
+ ------------------------------------------------------------------------------
4
+
5
+ New features:
6
+
7
+ * Add ability to run `testr rails` without needing a `.testr.rb` file.
8
+
9
+ * testr(1) no longer shows command menu at startup. Press ENTER to see it.
10
+
11
+ * testr(1) now notifies you before absorbing overhead at startup.
12
+
13
+ Bug fixes:
14
+
15
+ * testr(1) now accepts death silently when Control-C is pressed.
16
+
1
17
  ------------------------------------------------------------------------------
2
18
  Version 14.1.3 (2012-01-13)
3
19
  ------------------------------------------------------------------------------
data/README.markdown CHANGED
@@ -28,29 +28,20 @@ Features
28
28
 
29
29
  * Configurable through a Ruby script in your current working directory.
30
30
 
31
- * Implemented in less than 380 lines (SLOC) of pure Ruby code! :-)
31
+ * Implemented in less than 400 lines (SLOC) of pure Ruby code! :-)
32
32
 
33
33
  ------------------------------------------------------------------------------
34
34
  Architecture
35
35
  ------------------------------------------------------------------------------
36
36
 
37
- Following UNIX philosophy, TestR is made of simple text-based programs:
37
+ Following UNIX philosophy, TestR is made of simple text-based programs: thus
38
+ you can build your own custom TestR user interface by wrapping `testr-driver`!
38
39
 
39
40
  * `testr` is an interactive command-line user interface (CLI) for driver
40
41
  * `testr-herald` monitors current directory tree and reports changed files
41
42
  * `testr-driver` tells master to run tests and keeps track of test results
42
43
  * `testr-master` absorbs test execution overhead and forks to run your tests
43
44
 
44
- You can build your own custom TestR user interface by wrapping `testr-driver`!
45
-
46
- ------------------------------------------------------------------------------
47
- Usage and theory of operation
48
- ------------------------------------------------------------------------------
49
-
50
- Run `testr` to launch the command-line user interface for `testr-driver`. It
51
- will present a menu of commands and then wait for you to input a command while
52
- the driver waits for `testr-herald` to tell it about changes in your tests.
53
-
54
45
  When the driver hears about changes in your test files, it tells the master to
55
46
  fork a worker process to run the tests affected by those changes. This is all
56
47
  performed automatically. But what if you want to manually run a test file?
@@ -85,7 +76,7 @@ As a Git clone:
85
76
 
86
77
  git clone git://github.com/sunaku/testr
87
78
  cd testr
88
- bundle install
79
+ rake install
89
80
 
90
81
  ------------------------------------------------------------------------------
91
82
  Invocation
@@ -99,6 +90,10 @@ If installed as a Git clone:
99
90
 
100
91
  bundle exec ruby -Ilib bin/testr
101
92
 
93
+ You can test with built-in support for [Ruby on Rails]:
94
+
95
+ testr rails
96
+
102
97
  You can monitor your test processes in another terminal:
103
98
 
104
99
  watch 'ps xuw | sed -n "1p; /test[r]/p" | fgrep -v sed'
@@ -245,23 +240,23 @@ accelerates your test-driven development cycle and improves productivity!
245
240
  Configuration helpers
246
241
  ------------------------------------------------------------------------------
247
242
 
248
- The following libraries assist you with configuring TestR. To use them,
249
- simply add the require() lines shown below to your configuration file.
243
+ The following libraries assist you with configuring TestR. To use them,
244
+ simply add the `require()` lines shown below to your configuration file
245
+ *or* pass their basenames to the testr(1) command, also as shown below.
250
246
 
251
- ### require 'testr/config/rails'
247
+ ### require 'testr/config/rails' # testr rails
252
248
 
253
- Support for the [Ruby on Rails](http://rubyonrails.org) web framework.
249
+ Support for the [Ruby on Rails] web framework.
254
250
 
255
- ### require 'testr/config/parallel_tests'
251
+ ### require 'testr/config/parallel_tests' # testr parallel_tests
256
252
 
257
- Support for the [parallel_tests](https://github.com/grosser/parallel_tests)
258
- library.
253
+ Support for the [parallel_tests] library.
259
254
 
260
255
  ------------------------------------------------------------------------------
261
256
  Usage tips
262
257
  ------------------------------------------------------------------------------
263
258
 
264
- ### [factory_girl](https://github.com/thoughtbot/factory_girl) factories
259
+ ### [factory_girl] factories
265
260
 
266
261
  Don't load your factories in master process (as part of your test execution
267
262
  overhead) because that would necessitate the reloading of said overhead
@@ -295,8 +290,8 @@ Known issues
295
290
  models, controllers, helpers, and other Ruby source files.
296
291
 
297
292
  * If SQLite3 raises one of the following errors, try using an [in-memory
298
- adapter for SQLite3]( https://github.com/mvz/memory_test_fix ) or use
299
- different database software (such as MySQL) for your test environment.
293
+ adapter for SQLite3][memory_test_fix] or use different database software
294
+ (such as MySQL) for your test environment.
300
295
 
301
296
  * SQLite3::BusyException: database is locked
302
297
 
@@ -307,3 +302,8 @@ License
307
302
  ------------------------------------------------------------------------------
308
303
 
309
304
  Released under the ISC license. See the LICENSE file for details.
305
+
306
+ [factory_girl]: https://github.com/thoughtbot/factory_girl
307
+ [memory_test_fix]: https://github.com/mvz/memory_test_fix
308
+ [parallel_tests]: https://github.com/grosser/parallel_tests
309
+ [Ruby on Rails]: http://rubyonrails.org
data/bin/testr CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
3
 
4
- TESTR 1 "2012-01-13" "14.1.3"
4
+ TESTR 1 "2012-01-16" "14.2.0"
5
5
  =============================
6
6
 
7
7
  NAME
@@ -12,23 +12,16 @@ testr - Continuous testing tool for Ruby
12
12
  SYNOPSIS
13
13
  --------
14
14
 
15
- `testr` [*OPTION*]...
15
+ `testr` [*OPTION*]... [*CONFIG*]...
16
16
 
17
17
  DESCRIPTION
18
18
  -----------
19
19
 
20
20
  This program is a simple command-line user interface for testr-driver(1). It
21
- demonstrates how the components of TestR work together and also serves as an
22
- example of how you can create your own TestR user interface.
23
-
24
- When run, it presents you with a menu of single-character commands that you
25
- can enter, loads the test execution overhead into testr-master(1), and
26
- finally notifies you when the master is ready to run test files.
27
-
28
- It also launches testr-herald(1) alongside testr-master(1). When the herald
29
- reports a modified file that belongs to the test execution overhead, this
30
- program notifies you accordingly and then replaces the current master with a
31
- new one that will absorb the modified test execution overhead into itself.
21
+ loads the given *CONFIG* files (which are either paths to actual files or
22
+ names of helper libraries in the testr/config/ namespace of Ruby's load path)
23
+ and then waits for you to supply interactive commands on its stdin. You may
24
+ press the ENTER key (supplying no command) to see a menu of accepted commands.
32
25
 
33
26
  OPTIONS
34
27
  -------
@@ -49,8 +42,15 @@ require 'binman'
49
42
  BinMan.help
50
43
 
51
44
  require 'json'
45
+ ENV['TESTR_CONFIGS'] = JSON.dump(ARGV)
46
+
47
+ #-----------------------------------------------------------------------------
48
+ # backend
49
+ #-----------------------------------------------------------------------------
50
+
52
51
  require 'testr/client'
53
52
 
53
+ warn 'testr: Absorbing test execution overhead...'
54
54
  @driver = TestR::Client::Transceiver.new('testr-driver') do |line|
55
55
  evstr, *details = JSON.load(line)
56
56
  event = evstr.to_sym
@@ -73,6 +73,10 @@ require 'testr/client'
73
73
  end
74
74
  end
75
75
 
76
+ #-----------------------------------------------------------------------------
77
+ # frontend
78
+ #-----------------------------------------------------------------------------
79
+
76
80
  COMMANDS = {
77
81
  'r' => :run_all_test_files,
78
82
  's' => :stop_running_test_files,
@@ -82,25 +86,23 @@ COMMANDS = {
82
86
  'q' => :quit,
83
87
  }
84
88
 
85
- def COMMANDS.show
86
- each do |key, cmd|
87
- warn "testr: Type #{key} then ENTER to #{cmd.to_s.tr('_', ' ')}."
88
- end
89
- end
90
-
91
- COMMANDS.show # instruct newbies
92
-
93
- while key = STDIN.gets.chomp
94
- if command = COMMANDS[key]
95
- if command == :quit
96
- @driver.quit
97
- break
89
+ begin
90
+ while key = STDIN.gets.chomp
91
+ if command = COMMANDS[key]
92
+ if command == :quit
93
+ @driver.quit
94
+ break
95
+ else
96
+ @driver.send [command]
97
+ end
98
98
  else
99
- @driver.send [command]
99
+ COMMANDS.each do |key, cmd|
100
+ warn "testr: Type #{key} then ENTER to #{cmd.to_s.tr('_', ' ')}."
101
+ end
100
102
  end
101
- else
102
- COMMANDS.show
103
103
  end
104
+ rescue Interrupt
105
+ # forced quit
104
106
  end
105
107
 
106
108
  Process.waitall
data/bin/testr-driver CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
3
 
4
- TESTR-DRIVER 1 "2012-01-13" "14.1.3"
4
+ TESTR-DRIVER 1 "2012-01-16" "14.2.0"
5
5
  ====================================
6
6
 
7
7
  NAME
@@ -21,6 +21,10 @@ This program reads the following single-line commands (JSON arrays) from its
21
21
  standard input stream and performs the respective actions as described below.
22
22
  It also funnels the standard output stream of testr-master(1) into its own.
23
23
 
24
+ When testr-herald(1) reports that a file belonging to the test execution
25
+ overhead has been modified, this program replaces testr-master(1) with a new
26
+ instance, which then absorbs the modified test execution overhead into itself.
27
+
24
28
  `["run_all_test_files"]`
25
29
  Runs all test files found within and beneath the current working directory.
26
30
 
@@ -49,6 +53,14 @@ FILES
49
53
  *.testr.rb*
50
54
  Optional Ruby script for configuring testr(1).
51
55
 
56
+ ENVIRONMENT
57
+ -----------
58
+
59
+ `TESTR_CONFIGS`
60
+ A single-line JSON array containing paths to actual files or names of
61
+ helper libraries in the testr/config/ namespace of Ruby's load path.
62
+ These configuration files are loaded just before *.testr.rb* is loaded.
63
+
52
64
  SEE ALSO
53
65
  --------
54
66
 
data/bin/testr-herald CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
3
 
4
- TESTR-HERALD 1 "2012-01-13" "14.1.3"
4
+ TESTR-HERALD 1 "2012-01-16" "14.2.0"
5
5
  ====================================
6
6
 
7
7
  NAME
data/bin/testr-master CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
3
 
4
- TESTR-MASTER 1 "2012-01-13" "14.1.3"
4
+ TESTR-MASTER 1 "2012-01-16" "14.2.0"
5
5
  ====================================
6
6
 
7
7
  NAME
@@ -60,6 +60,14 @@ FILES
60
60
  *.testr.rb*
61
61
  Optional Ruby script for configuring testr(1).
62
62
 
63
+ ENVIRONMENT
64
+ -----------
65
+
66
+ `TESTR_CONFIGS`
67
+ A single-line JSON array containing paths to actual files or names of
68
+ helper libraries in the testr/config/ namespace of Ruby's load path.
69
+ These configuration files are loaded just before *.testr.rb* is loaded.
70
+
63
71
  SEE ALSO
64
72
  --------
65
73
 
data/lib/testr/config.rb CHANGED
@@ -5,6 +5,10 @@ module TestR
5
5
 
6
6
  Config = OpenStruct.new
7
7
 
8
+ #---------------------------------------------------------------------------
9
+ # defaults
10
+ #---------------------------------------------------------------------------
11
+
8
12
  Config.max_forked_workers = [
9
13
  # http://stackoverflow.com/questions/891537#6420817
10
14
  'fgrep -c processor /proc/cpuinfo', # Linux
@@ -61,5 +65,19 @@ module TestR
61
65
  end
62
66
  ]
63
67
 
68
+ #---------------------------------------------------------------------------
69
+ # overrides
70
+ #---------------------------------------------------------------------------
71
+
72
+ if ENV.key? 'TESTR_CONFIGS'
73
+ JSON.load(ENV['TESTR_CONFIGS']).each do |config|
74
+ if File.exist? config
75
+ load File.expand_path(config)
76
+ else
77
+ require "testr/config/#{config}"
78
+ end
79
+ end
80
+ end
81
+
64
82
  load _user_config_file if File.exist? _user_config_file
65
83
  end
data/lib/testr/server.rb CHANGED
@@ -26,6 +26,8 @@ module Server
26
26
  end
27
27
  end
28
28
  end
29
+ rescue Interrupt
30
+ # forced quit
29
31
  end
30
32
 
31
33
  def self.extended server
data/lib/testr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TestR
2
- VERSION = "14.1.3"
2
+ VERSION = "14.2.0"
3
3
  end
@@ -1,4 +1,4 @@
1
- .TH TESTR\-DRIVER 1 "2012\-01\-13" "14.1.3"
1
+ .TH TESTR\-DRIVER 1 "2012\-01\-16" "14.2.0"
2
2
  .SH NAME
3
3
  .PP
4
4
  testr\-driver \- drives
@@ -14,6 +14,14 @@ standard input stream and performs the respective actions as described below.
14
14
  It also funnels the standard output stream of
15
15
  .BR testr\-master (1)
16
16
  into its own.
17
+ .PP
18
+ When
19
+ .BR testr\-herald (1)
20
+ reports that a file belonging to the test execution
21
+ overhead has been modified, this program replaces
22
+ .BR testr\-master (1)
23
+ with a new
24
+ instance, which then absorbs the modified test execution overhead into itself.
17
25
  .TP
18
26
  \fB\fC["run_all_test_files"]\fR
19
27
  Runs all test files found within and beneath the current working directory.
@@ -40,6 +48,12 @@ Display this help manual using
40
48
  \fI.testr.rb\fP
41
49
  Optional Ruby script for configuring
42
50
  .BR testr (1).
51
+ .SH ENVIRONMENT
52
+ .TP
53
+ \fB\fCTESTR_CONFIGS\fR
54
+ A single\-line JSON array containing paths to actual files or names of
55
+ helper libraries in the testr/config/ namespace of Ruby's load path.
56
+ These configuration files are loaded just before \fI.testr.rb\fP is loaded.
43
57
  .SH SEE ALSO
44
58
  .PP
45
59
  .BR testr (1),
@@ -1,4 +1,4 @@
1
- .TH TESTR\-HERALD 1 "2012\-01\-13" "14.1.3"
1
+ .TH TESTR\-HERALD 1 "2012\-01\-16" "14.2.0"
2
2
  .SH NAME
3
3
  .PP
4
4
  testr\-herald \- reports modified files
@@ -1,4 +1,4 @@
1
- .TH TESTR\-MASTER 1 "2012\-01\-13" "14.1.3"
1
+ .TH TESTR\-MASTER 1 "2012\-01\-16" "14.2.0"
2
2
  .SH NAME
3
3
  .PP
4
4
  testr\-master \- absorbs overhead and runs tests
@@ -47,6 +47,12 @@ Display this help manual using
47
47
  \fI.testr.rb\fP
48
48
  Optional Ruby script for configuring
49
49
  .BR testr (1).
50
+ .SH ENVIRONMENT
51
+ .TP
52
+ \fB\fCTESTR_CONFIGS\fR
53
+ A single\-line JSON array containing paths to actual files or names of
54
+ helper libraries in the testr/config/ namespace of Ruby's load path.
55
+ These configuration files are loaded just before \fI.testr.rb\fP is loaded.
50
56
  .SH SEE ALSO
51
57
  .PP
52
58
  .BR testr (1),
data/man/man1/testr.1 CHANGED
@@ -1,32 +1,19 @@
1
- .TH TESTR 1 "2012\-01\-13" "14.1.3"
1
+ .TH TESTR 1 "2012\-01\-16" "14.2.0"
2
2
  .SH NAME
3
3
  .PP
4
4
  testr \- Continuous testing tool for Ruby
5
5
  .SH SYNOPSIS
6
6
  .PP
7
- \fB\fCtestr\fR [\fIOPTION\fP]...
7
+ \fB\fCtestr\fR [\fIOPTION\fP]... [\fICONFIG\fP]...
8
8
  .SH DESCRIPTION
9
9
  .PP
10
10
  This program is a simple command\-line user interface for
11
11
  .BR testr\-driver (1).
12
12
  It
13
- demonstrates how the components of TestR work together and also serves as an
14
- example of how you can create your own TestR user interface.
15
- .PP
16
- When run, it presents you with a menu of single\-character commands that you
17
- can enter, loads the test execution overhead into
18
- .BR testr\-master (1),
19
- and
20
- finally notifies you when the master is ready to run test files.
21
- .PP
22
- It also launches
23
- .BR testr\-herald (1)
24
- alongside
25
- .BR testr\-master (1).
26
- When the herald
27
- reports a modified file that belongs to the test execution overhead, this
28
- program notifies you accordingly and then replaces the current master with a
29
- new one that will absorb the modified test execution overhead into itself.
13
+ loads the given \fICONFIG\fP files (which are either paths to actual files or
14
+ names of helper libraries in the testr/config/ namespace of Ruby's load path)
15
+ and then waits for you to supply interactive commands on its stdin. You may
16
+ press the ENTER key (supplying no command) to see a menu of accepted commands.
30
17
  .SH OPTIONS
31
18
  .TP
32
19
  \fB\fC-h\fR, \fB\fC--help\fR
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testr
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.1.3
4
+ version: 14.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,11 +13,11 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2012-01-14 00:00:00.000000000 Z
16
+ date: 2012-01-17 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: binman
20
- requirement: &24250900 !ruby/object:Gem::Requirement
20
+ requirement: &9134380 !ruby/object:Gem::Requirement
21
21
  none: false
22
22
  requirements:
23
23
  - - ~>
@@ -25,10 +25,10 @@ dependencies:
25
25
  version: '3'
26
26
  type: :runtime
27
27
  prerelease: false
28
- version_requirements: *24250900
28
+ version_requirements: *9134380
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: json
31
- requirement: &24250380 !ruby/object:Gem::Requirement
31
+ requirement: &9133860 !ruby/object:Gem::Requirement
32
32
  none: false
33
33
  requirements:
34
34
  - - ! '>='
@@ -39,10 +39,10 @@ dependencies:
39
39
  version: '2'
40
40
  type: :runtime
41
41
  prerelease: false
42
- version_requirements: *24250380
42
+ version_requirements: *9133860
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: guard
45
- requirement: &24249640 !ruby/object:Gem::Requirement
45
+ requirement: &9133120 !ruby/object:Gem::Requirement
46
46
  none: false
47
47
  requirements:
48
48
  - - ! '>='
@@ -53,10 +53,10 @@ dependencies:
53
53
  version: '1'
54
54
  type: :runtime
55
55
  prerelease: false
56
- version_requirements: *24249640
56
+ version_requirements: *9133120
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: diff-lcs
59
- requirement: &24248900 !ruby/object:Gem::Requirement
59
+ requirement: &9132380 !ruby/object:Gem::Requirement
60
60
  none: false
61
61
  requirements:
62
62
  - - ! '>='
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '2'
68
68
  type: :runtime
69
69
  prerelease: false
70
- version_requirements: *24248900
70
+ version_requirements: *9132380
71
71
  description: ''
72
72
  email:
73
73
  - sunaku@gmail.com