tork 17.1.0 → 18.0.0

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.
data/lib/tork/master.rb CHANGED
@@ -2,10 +2,32 @@ require 'tork/server'
2
2
  require 'tork/config'
3
3
 
4
4
  module Tork
5
- module Master
5
+ class Master < Server
6
6
 
7
- extend Server
8
- extend self
7
+ def initialize
8
+ super
9
+
10
+ @worker_number_pool = (0 ... Config.max_forked_workers).to_a
11
+ @command_by_worker_pid = {}
12
+
13
+ # process exited child processes and report finished workers to client
14
+ trap :SIGCHLD do
15
+ begin
16
+ while wait2_array = Process.wait2(-1, Process::WNOHANG)
17
+ child_pid, child_status = wait2_array
18
+ if command = @command_by_worker_pid.delete(child_pid)
19
+ @worker_number_pool.push command.last
20
+ command[0] = if child_status.success? then :pass else :fail end
21
+ @client.send command.push(child_status.to_i, child_status.inspect)
22
+ else
23
+ warn "tork-master: unknown child exited: #{wait2_array.inspect}"
24
+ end
25
+ end
26
+ rescue SystemCallError
27
+ # raised by wait2() when there are currently no child processes
28
+ end
29
+ end
30
+ end
9
31
 
10
32
  def load paths, files
11
33
  $LOAD_PATH.unshift(*paths)
@@ -68,32 +90,9 @@ module Master
68
90
  # some workers might have already exited before we sent them the signal
69
91
  end
70
92
 
71
- def loop
72
- super
93
+ def quit
73
94
  stop
74
- end
75
-
76
- private
77
-
78
- @worker_number_pool = (0 ... Config.max_forked_workers).to_a
79
- @command_by_worker_pid = {}
80
-
81
- # process exited child processes and report finished workers to client
82
- trap :SIGCHLD do
83
- begin
84
- while wait2_array = Process.wait2(-1, Process::WNOHANG)
85
- child_pid, child_status = wait2_array
86
- if command = @command_by_worker_pid.delete(child_pid)
87
- @worker_number_pool.push command.last
88
- command[0] = if child_status.success? then :pass else :fail end
89
- @client.send command.push(child_status)
90
- else
91
- warn "tork-master: unknown child exited: #{wait2_array.inspect}"
92
- end
93
- end
94
- rescue SystemCallError
95
- # raised by wait2() when there are currently no child processes
96
- end
95
+ super
97
96
  end
98
97
 
99
98
  end
data/lib/tork/server.rb CHANGED
@@ -1,7 +1,11 @@
1
1
  require 'tork/client'
2
2
 
3
3
  module Tork
4
- module Server
4
+ class Server
5
+
6
+ def initialize
7
+ trap(:SIGTERM){ quit }
8
+ end
5
9
 
6
10
  def quit
7
11
  Thread.exit # kill Client::Receiver in loop()
@@ -22,10 +26,8 @@ module Server
22
26
  end.join
23
27
  rescue Interrupt
24
28
  # forced quit
25
- end
26
-
27
- def self.extended server
28
- trap(:SIGTERM){ server.quit }
29
+ ensure
30
+ Process.waitall
29
31
  end
30
32
 
31
33
  end
data/lib/tork/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tork
2
- VERSION = "17.1.0"
2
+ VERSION = "18.0.0"
3
3
  end
@@ -1,35 +1,36 @@
1
- .TH TORK\-DRIVER 1 2012\-01\-30 17.1.0
1
+ .TH TORK\-DRIVER 1 2012\-02\-06 18.0.0
2
2
  .SH NAME
3
3
  .PP
4
4
  tork\-driver \- drives
5
- .BR tork\-master (1)
6
- and does bookkeeping
5
+ .BR tork\-engine (1)
6
+ when files change
7
7
  .SH SYNOPSIS
8
8
  .PP
9
9
  \fB\fCtork-driver\fR [\fIOPTION\fP]...
10
10
  .SH DESCRIPTION
11
11
  .PP
12
- This program reads the following single\-line commands (JSON arrays) from its
13
- standard input stream and performs the respective actions as described below.
14
- It also funnels the standard output stream of
15
- .BR tork\-master (1)
12
+ This program drives
13
+ .BR tork\-engine (1)
14
+ according to
15
+ .BR tork\-herald (1)'
16
+ s observations.
17
+ It reads the following single\-line commands (JSON arrays) from its standard
18
+ input stream and performs the respective actions as described below. It also
19
+ funnels the standard output stream of
20
+ .BR tork\-engine (1)
16
21
  into its own.
17
22
  .TP
18
23
  \fB\fC["run_all_test_files"]\fR
19
24
  Runs all test files found within and beneath the current working directory.
20
25
  .TP
21
- \fB\fC["stop_running_test_files"]\fR
22
- Stops any test files that are currently running.
23
- .TP
24
- \fB\fC["rerun_passed_test_files"]\fR
25
- Runs all test files that have passed during their most recent run.
26
- .TP
27
26
  \fB\fC["reabsorb_overhead_files"]\fR
28
27
  Stops any test files that are currently running, reabsorbs the test
29
28
  execution overhead, and resumes running those interrupted test files.
30
29
  .TP
31
- \fB\fC["quit"]\fR
32
- Stops all tests that are currently running and exits.
30
+ \fI...\fP
31
+ This program accepts
32
+ .BR tork\-engine (1)
33
+ commands and delegates them accordingly.
33
34
  .PP
34
35
  When
35
36
  .BR tork\-herald (1)
@@ -49,8 +50,7 @@ with a new instance, because \fIoverhead_file\fP has changed.
49
50
  .SH OPTIONS
50
51
  .TP
51
52
  \fB\fC-h\fR, \fB\fC--help\fR
52
- Display this help manual using
53
- .BR man (1).
53
+ Show this help manual.
54
54
  .SH FILES
55
55
  .TP
56
56
  \fI.tork.rb\fP
@@ -65,6 +65,7 @@ These configuration files are loaded just before \fI.tork.rb\fP is loaded.
65
65
  .SH SEE ALSO
66
66
  .PP
67
67
  .BR tork (1),
68
+ .BR tork\-herald (1),
68
69
  .BR tork\-driver (1),
69
- .BR tork\-master (1),
70
- .BR tork\-herald (1)
70
+ .BR tork\-engine (1),
71
+ .BR tork\-master (1)
@@ -0,0 +1,66 @@
1
+ .TH TORK\-ENGINE 1 2012\-02\-06 18.0.0
2
+ .SH NAME
3
+ .PP
4
+ tork\-engine \- wraps
5
+ .BR tork\-master (1)
6
+ with bookkeeping
7
+ .SH SYNOPSIS
8
+ .PP
9
+ \fB\fCtork-engine\fR [\fIOPTION\fP]...
10
+ .SH DESCRIPTION
11
+ .PP
12
+ This program tells
13
+ .BR tork\-master (1)
14
+ to run your tests and keeps track of test
15
+ results. It reads the following single\-line commands (JSON arrays) from its
16
+ standard input stream and performs the respective actions as described below.
17
+ It also funnels the standard output stream of
18
+ .BR tork\-master (1)
19
+ into its own.
20
+ .TP
21
+ \fB\fC["reabsorb_overhead",\fR \fIpaths\fP\fB\fC,\fR \fIfiles\fP\fB\fC]\fR
22
+ Stops any test files that are currently running, reabsorbs the given test
23
+ execution overhead, and resumes running those interrupted test files. See
24
+ the "load" command in
25
+ .BR tork\-master (1)
26
+ for more information.
27
+ .TP
28
+ \fB\fC["run_test_file"\fR, \fItest_file\fP\fB\fC,\fR \fIline_numbers\fP\fB\fC]\fR
29
+ Runs tests that correspond to the given \fIline_numbers\fP array in the given
30
+ \fItest_file\fP. If \fIline_numbers\fP is \fB\fCnull\fR, then only those lines that have
31
+ changed since the last time the \fItest_file\fP was run will be substituted. If
32
+ \fIline_numbers\fP is an empty array, then the entire \fItest_file\fP will be run.
33
+ .TP
34
+ \fB\fC["stop_running_test_files"]\fR
35
+ Stops any test files that are currently running.
36
+ .TP
37
+ \fB\fC["rerun_passed_test_files"]\fR
38
+ Runs all test files that have passed during their most recent run.
39
+ .TP
40
+ \fB\fC["rerun_failed_test_files"]\fR
41
+ Runs all test files that have failed during their most recent run.
42
+ .TP
43
+ \fB\fC["quit"]\fR
44
+ Stops all tests that are currently running and exits.
45
+ .SH OPTIONS
46
+ .TP
47
+ \fB\fC-h\fR, \fB\fC--help\fR
48
+ Show this help manual.
49
+ .SH FILES
50
+ .TP
51
+ \fI.tork.rb\fP
52
+ Optional Ruby script for configuring
53
+ .BR tork (1).
54
+ .SH ENVIRONMENT
55
+ .TP
56
+ \fB\fCTORK_CONFIGS\fR
57
+ A single\-line JSON array containing paths to actual files or names of
58
+ helper libraries in the tork/config/ namespace of Ruby's load path.
59
+ These configuration files are loaded just before \fI.tork.rb\fP is loaded.
60
+ .SH SEE ALSO
61
+ .PP
62
+ .BR tork (1),
63
+ .BR tork\-herald (1),
64
+ .BR tork\-driver (1),
65
+ .BR tork\-engine (1),
66
+ .BR tork\-master (1)
@@ -1,4 +1,4 @@
1
- .TH TORK\-HERALD 1 2012\-01\-30 17.1.0
1
+ .TH TORK\-HERALD 1 2012\-02\-06 18.0.0
2
2
  .SH NAME
3
3
  .PP
4
4
  tork\-herald \- reports modified files
@@ -13,11 +13,11 @@ stream.
13
13
  .SH OPTIONS
14
14
  .TP
15
15
  \fB\fC-h\fR, \fB\fC--help\fR
16
- Display this help manual using
17
- .BR man (1).
16
+ Show this help manual.
18
17
  .SH SEE ALSO
19
18
  .PP
20
19
  .BR tork (1),
20
+ .BR tork\-herald (1),
21
21
  .BR tork\-driver (1),
22
- .BR tork\-master (1),
23
- .BR tork\-herald (1)
22
+ .BR tork\-engine (1),
23
+ .BR tork\-master (1)
@@ -1,4 +1,4 @@
1
- .TH TORK\-MASTER 1 2012\-01\-30 17.1.0
1
+ .TH TORK\-MASTER 1 2012\-02\-06 18.0.0
2
2
  .SH NAME
3
3
  .PP
4
4
  tork\-master \- absorbs overhead and runs tests
@@ -7,8 +7,9 @@ tork\-master \- absorbs overhead and runs tests
7
7
  \fB\fCtork-master\fR [\fIOPTION\fP]...
8
8
  .SH DESCRIPTION
9
9
  .PP
10
- This program reads the following single\-line commands (JSON arrays) from its
11
- standard input stream and performs the respective actions as described below.
10
+ This program absorbs the test execution overhead and forks to run your tests.
11
+ It reads the following single\-line commands (JSON arrays) from its standard
12
+ input stream and performs the respective actions as described below.
12
13
  .TP
13
14
  \fB\fC["load",\fR \fIpaths\fP\fB\fC,\fR \fIfiles\fP\fB\fC]\fR
14
15
  Adds the given array of \fIpaths\fP to Ruby's $LOAD_PATH, loads the given array
@@ -29,10 +30,10 @@ Test is running:
29
30
  \fB\fC["test",\fR \fItest_file\fP\fB\fC,\fR \fIline_numbers\fP\fB\fC,\fR \fIlog_file\fP\fB\fC,\fR \fIworker_number\fP\fB\fC]\fR
30
31
  .IP \(bu 2
31
32
  Test has passed:
32
- \fB\fC["pass",\fR \fItest_file\fP\fB\fC,\fR \fIline_numbers\fP\fB\fC,\fR \fIlog_file\fP\fB\fC,\fR \fIworker_number\fP\fB\fC,\fR \fIexit_status\fP\fB\fC]\fR
33
+ \fB\fC["pass",\fR \fItest_file\fP\fB\fC,\fR \fIline_numbers\fP\fB\fC,\fR \fIlog_file\fP\fB\fC,\fR \fIworker_number\fP\fB\fC,\fR \fIexit_code\fP\fB\fC,\fR \fIexit_info\fP\fB\fC]\fR
33
34
  .IP \(bu 2
34
35
  Test has failed:
35
- \fB\fC["fail",\fR \fItest_file\fP\fB\fC,\fR \fIline_numbers\fP\fB\fC,\fR \fIlog_file\fP\fB\fC,\fR \fIworker_number\fP\fB\fC,\fR \fIexit_status\fP\fB\fC]\fR
36
+ \fB\fC["fail",\fR \fItest_file\fP\fB\fC,\fR \fIline_numbers\fP\fB\fC,\fR \fIlog_file\fP\fB\fC,\fR \fIworker_number\fP\fB\fC,\fR \fIexit_code\fP\fB\fC,\fR \fIexit_info\fP\fB\fC]\fR
36
37
  .RE
37
38
  .TP
38
39
  \fB\fC["stop"]\fR
@@ -44,8 +45,7 @@ Stops all tests that are currently running and exits.
44
45
  .SH OPTIONS
45
46
  .TP
46
47
  \fB\fC-h\fR, \fB\fC--help\fR
47
- Display this help manual using
48
- .BR man (1).
48
+ Show this help manual.
49
49
  .SH FILES
50
50
  .TP
51
51
  \fI.tork.rb\fP
@@ -60,6 +60,7 @@ These configuration files are loaded just before \fI.tork.rb\fP is loaded.
60
60
  .SH SEE ALSO
61
61
  .PP
62
62
  .BR tork (1),
63
+ .BR tork\-herald (1),
63
64
  .BR tork\-driver (1),
64
- .BR tork\-master (1),
65
- .BR tork\-herald (1)
65
+ .BR tork\-engine (1),
66
+ .BR tork\-master (1)
data/man/man1/tork.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH TORK 1 2012\-01\-30 17.1.0
1
+ .TH TORK 1 2012\-02\-06 18.0.0
2
2
  .SH NAME
3
3
  .PP
4
4
  tork \- Continuous testing tool for Ruby
@@ -17,11 +17,10 @@ press the ENTER key (supplying no command) to see a menu of accepted commands.
17
17
  .SH OPTIONS
18
18
  .TP
19
19
  \fB\fC-h\fR, \fB\fC--help\fR
20
- Display this help manual using
21
- .BR man (1).
20
+ Show this help manual.
22
21
  .SH SEE ALSO
23
22
  .PP
24
23
  .BR tork (1),
25
24
  .BR tork\-driver (1),
26
25
  .BR tork\-master (1),
27
- .BR tork\-herald (1)
26
+ .BR tork\-herald (1)
data/tork.gemspec CHANGED
@@ -1,24 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "tork/version"
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'tork/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "tork"
6
+ s.name = 'tork'
7
7
  s.version = Tork::VERSION
8
8
  s.authors,
9
9
  s.email = File.read('LICENSE').scan(/Copyright \d+ (.+) <(.+?)>/).transpose
10
- s.homepage = "http://github.com/sunaku/tork"
11
- s.summary = "Test with fork."
12
- s.description = "Continuous testing tool for Ruby."
10
+ s.homepage = 'http://github.com/sunaku/tork'
11
+ s.summary = 'test with fork'
12
+ s.description = 'Runs your tests as they change, in parallel.'
13
13
 
14
- s.files = `git ls-files`.split("\n") + Dir["man/**/*"]
14
+ s.files = `git ls-files`.split("\n") + Dir['man/**/*']
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
- s.require_paths = ["lib"]
17
+ s.require_paths = ['lib']
18
18
 
19
19
  s.add_runtime_dependency 'binman', '~> 3'
20
20
  s.add_runtime_dependency 'json', '>= 1.6.1', '< 2'
21
- s.add_runtime_dependency 'guard', '>= 0.9.0', '< 1'
21
+ s.add_runtime_dependency 'guard', '~> 1'
22
22
  s.add_runtime_dependency 'diff-lcs', '>= 1.1.2', '< 2'
23
23
  s.add_development_dependency 'md2man', '~> 1'
24
24
  s.add_development_dependency 'rake', '>= 0.9.2.2', '< 1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tork
3
3
  version: !ruby/object:Gem::Version
4
- version: 17.1.0
4
+ version: 18.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-30 00:00:00.000000000 Z
13
+ date: 2012-02-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: binman
17
- requirement: &9258640 !ruby/object:Gem::Requirement
17
+ requirement: &9855300 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '3'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *9258640
25
+ version_requirements: *9855300
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: json
28
- requirement: &9258120 !ruby/object:Gem::Requirement
28
+ requirement: &9854280 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -36,24 +36,21 @@ dependencies:
36
36
  version: '2'
37
37
  type: :runtime
38
38
  prerelease: false
39
- version_requirements: *9258120
39
+ version_requirements: *9854280
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: guard
42
- requirement: &9257380 !ruby/object:Gem::Requirement
42
+ requirement: &9853540 !ruby/object:Gem::Requirement
43
43
  none: false
44
44
  requirements:
45
- - - ! '>='
46
- - !ruby/object:Gem::Version
47
- version: 0.9.0
48
- - - <
45
+ - - ~>
49
46
  - !ruby/object:Gem::Version
50
47
  version: '1'
51
48
  type: :runtime
52
49
  prerelease: false
53
- version_requirements: *9257380
50
+ version_requirements: *9853540
54
51
  - !ruby/object:Gem::Dependency
55
52
  name: diff-lcs
56
- requirement: &9256640 !ruby/object:Gem::Requirement
53
+ requirement: &9852840 !ruby/object:Gem::Requirement
57
54
  none: false
58
55
  requirements:
59
56
  - - ! '>='
@@ -64,10 +61,10 @@ dependencies:
64
61
  version: '2'
65
62
  type: :runtime
66
63
  prerelease: false
67
- version_requirements: *9256640
64
+ version_requirements: *9852840
68
65
  - !ruby/object:Gem::Dependency
69
66
  name: md2man
70
- requirement: &9255920 !ruby/object:Gem::Requirement
67
+ requirement: &9851800 !ruby/object:Gem::Requirement
71
68
  none: false
72
69
  requirements:
73
70
  - - ~>
@@ -75,10 +72,10 @@ dependencies:
75
72
  version: '1'
76
73
  type: :development
77
74
  prerelease: false
78
- version_requirements: *9255920
75
+ version_requirements: *9851800
79
76
  - !ruby/object:Gem::Dependency
80
77
  name: rake
81
- requirement: &9255380 !ruby/object:Gem::Requirement
78
+ requirement: &9851220 !ruby/object:Gem::Requirement
82
79
  none: false
83
80
  requirements:
84
81
  - - ! '>='
@@ -89,14 +86,15 @@ dependencies:
89
86
  version: '1'
90
87
  type: :development
91
88
  prerelease: false
92
- version_requirements: *9255380
93
- description: Continuous testing tool for Ruby.
89
+ version_requirements: *9851220
90
+ description: Runs your tests as they change, in parallel.
94
91
  email:
95
92
  - sunaku@gmail.com
96
93
  - burns180@gmail.com
97
94
  executables:
98
95
  - tork
99
96
  - tork-driver
97
+ - tork-engine
100
98
  - tork-herald
101
99
  - tork-master
102
100
  extensions: []
@@ -110,6 +108,7 @@ files:
110
108
  - Rakefile
111
109
  - bin/tork
112
110
  - bin/tork-driver
111
+ - bin/tork-engine
113
112
  - bin/tork-herald
114
113
  - bin/tork-master
115
114
  - lib/tork/client.rb
@@ -122,10 +121,12 @@ files:
122
121
  - lib/tork/config/parallel_tests.rb
123
122
  - lib/tork/config/rails.rb
124
123
  - lib/tork/driver.rb
124
+ - lib/tork/engine.rb
125
125
  - lib/tork/master.rb
126
126
  - lib/tork/server.rb
127
127
  - lib/tork/version.rb
128
128
  - tork.gemspec
129
+ - man/man1/tork-engine.1
129
130
  - man/man1/tork-herald.1
130
131
  - man/man1/tork-master.1
131
132
  - man/man1/tork-driver.1
@@ -153,6 +154,6 @@ rubyforge_project:
153
154
  rubygems_version: 1.8.11
154
155
  signing_key:
155
156
  specification_version: 3
156
- summary: Test with fork.
157
+ summary: test with fork
157
158
  test_files: []
158
159
  has_rdoc: