tork 18.2.4 → 19.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/HISTORY.markdown +65 -0
  2. data/README.markdown +60 -298
  3. data/bin/tork +99 -62
  4. data/bin/tork-driver +124 -25
  5. data/bin/tork-engine +45 -23
  6. data/bin/tork-herald +5 -5
  7. data/bin/tork-master +79 -32
  8. data/bin/tork-notify +70 -0
  9. data/bin/tork-remote +80 -0
  10. data/lib/tork/cliapp.rb +73 -0
  11. data/lib/tork/config.rb +14 -97
  12. data/lib/tork/config/coverage/master.rb +29 -0
  13. data/lib/tork/config/coverage/worker.rb +1 -0
  14. data/lib/tork/config/cucumber/driver.rb +11 -0
  15. data/lib/tork/config/cucumber/worker.rb +14 -0
  16. data/lib/tork/config/default/config.rb +5 -0
  17. data/lib/tork/config/dotlog/onfork.rb +2 -0
  18. data/lib/tork/config/factory_girl/onfork.rb +2 -0
  19. data/lib/tork/config/factory_girl/worker.rb +1 -0
  20. data/lib/tork/config/logdir/onfork.rb +4 -0
  21. data/lib/tork/config/parallel_tests/worker.rb +4 -0
  22. data/lib/tork/config/rails/driver.rb +15 -0
  23. data/lib/tork/config/rails/master.rb +12 -0
  24. data/lib/tork/config/rails/worker.rb +21 -0
  25. data/lib/tork/config/spec/driver.rb +17 -0
  26. data/lib/tork/config/spec/master.rb +3 -0
  27. data/lib/tork/config/spec/worker.rb +3 -0
  28. data/lib/tork/config/test/driver.rb +17 -0
  29. data/lib/tork/config/test/master.rb +3 -0
  30. data/lib/tork/config/test/worker.rb +23 -0
  31. data/lib/tork/driver.rb +68 -36
  32. data/lib/tork/engine.rb +57 -44
  33. data/lib/tork/master.rb +34 -34
  34. data/lib/tork/server.rb +118 -17
  35. data/lib/tork/version.rb +1 -1
  36. data/man/man1/tork-driver.1 +165 -37
  37. data/man/man1/tork-engine.1 +50 -32
  38. data/man/man1/tork-herald.1 +5 -8
  39. data/man/man1/tork-master.1 +95 -42
  40. data/man/man1/tork-notify.1 +27 -0
  41. data/man/man1/tork-remote.1 +38 -0
  42. data/man/man1/tork.1 +116 -8
  43. data/tork.gemspec +3 -3
  44. metadata +36 -25
  45. data/lib/tork/client.rb +0 -53
  46. data/lib/tork/config/coverage.rb +0 -40
  47. data/lib/tork/config/cucumber.rb +0 -32
  48. data/lib/tork/config/dotlog.rb +0 -8
  49. data/lib/tork/config/factory_girl.rb +0 -10
  50. data/lib/tork/config/logdir.rb +0 -10
  51. data/lib/tork/config/notify.rb +0 -34
  52. data/lib/tork/config/parallel_tests.rb +0 -9
  53. data/lib/tork/config/rails.rb +0 -39
data/tork.gemspec CHANGED
@@ -13,15 +13,15 @@ Gem::Specification.new do |s|
13
13
  s.summary = 'test with fork'
14
14
  s.description = 'Runs your tests as they change, in parallel.'
15
15
 
16
- s.files = `git ls-files`.split("\n") + Dir['man/**/*']
16
+ s.files = `git ls-files`.split("\n") + Dir['man/man?/*.?']
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ['lib']
20
20
 
21
21
  s.add_runtime_dependency 'binman', '~> 3.0'
22
- s.add_runtime_dependency 'json', '>= 1.6.1', '< 2.0'
22
+ s.add_runtime_dependency 'json', '~> 1.6'
23
23
  s.add_runtime_dependency 'listen', '~> 0.5'
24
24
  s.add_runtime_dependency 'diff-lcs', '~> 1.1'
25
- s.add_development_dependency 'md2man', '~> 1.0'
25
+ s.add_development_dependency 'md2man', '~> 1.4'
26
26
  s.add_development_dependency 'rake', '~> 0.9.2.2'
27
27
  end
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: 18.2.4
4
+ version: 19.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-11 00:00:00.000000000 Z
13
+ date: 2012-10-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: binman
@@ -33,23 +33,17 @@ dependencies:
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  none: false
35
35
  requirements:
36
- - - ! '>='
37
- - !ruby/object:Gem::Version
38
- version: 1.6.1
39
- - - <
36
+ - - ~>
40
37
  - !ruby/object:Gem::Version
41
- version: '2.0'
38
+ version: '1.6'
42
39
  type: :runtime
43
40
  prerelease: false
44
41
  version_requirements: !ruby/object:Gem::Requirement
45
42
  none: false
46
43
  requirements:
47
- - - ! '>='
48
- - !ruby/object:Gem::Version
49
- version: 1.6.1
50
- - - <
44
+ - - ~>
51
45
  - !ruby/object:Gem::Version
52
- version: '2.0'
46
+ version: '1.6'
53
47
  - !ruby/object:Gem::Dependency
54
48
  name: listen
55
49
  requirement: !ruby/object:Gem::Requirement
@@ -89,7 +83,7 @@ dependencies:
89
83
  requirements:
90
84
  - - ~>
91
85
  - !ruby/object:Gem::Version
92
- version: '1.0'
86
+ version: '1.4'
93
87
  type: :development
94
88
  prerelease: false
95
89
  version_requirements: !ruby/object:Gem::Requirement
@@ -97,7 +91,7 @@ dependencies:
97
91
  requirements:
98
92
  - - ~>
99
93
  - !ruby/object:Gem::Version
100
- version: '1.0'
94
+ version: '1.4'
101
95
  - !ruby/object:Gem::Dependency
102
96
  name: rake
103
97
  requirement: !ruby/object:Gem::Requirement
@@ -124,6 +118,8 @@ executables:
124
118
  - tork-engine
125
119
  - tork-herald
126
120
  - tork-master
121
+ - tork-notify
122
+ - tork-remote
127
123
  extensions: []
128
124
  extra_rdoc_files: []
129
125
  files:
@@ -138,22 +134,37 @@ files:
138
134
  - bin/tork-engine
139
135
  - bin/tork-herald
140
136
  - bin/tork-master
141
- - lib/tork/client.rb
137
+ - bin/tork-notify
138
+ - bin/tork-remote
139
+ - lib/tork/cliapp.rb
142
140
  - lib/tork/config.rb
143
- - lib/tork/config/coverage.rb
144
- - lib/tork/config/cucumber.rb
145
- - lib/tork/config/dotlog.rb
146
- - lib/tork/config/factory_girl.rb
147
- - lib/tork/config/logdir.rb
148
- - lib/tork/config/notify.rb
149
- - lib/tork/config/parallel_tests.rb
150
- - lib/tork/config/rails.rb
141
+ - lib/tork/config/coverage/master.rb
142
+ - lib/tork/config/coverage/worker.rb
143
+ - lib/tork/config/cucumber/driver.rb
144
+ - lib/tork/config/cucumber/worker.rb
145
+ - lib/tork/config/default/config.rb
146
+ - lib/tork/config/dotlog/onfork.rb
147
+ - lib/tork/config/factory_girl/onfork.rb
148
+ - lib/tork/config/factory_girl/worker.rb
149
+ - lib/tork/config/logdir/onfork.rb
150
+ - lib/tork/config/parallel_tests/worker.rb
151
+ - lib/tork/config/rails/driver.rb
152
+ - lib/tork/config/rails/master.rb
153
+ - lib/tork/config/rails/worker.rb
154
+ - lib/tork/config/spec/driver.rb
155
+ - lib/tork/config/spec/master.rb
156
+ - lib/tork/config/spec/worker.rb
157
+ - lib/tork/config/test/driver.rb
158
+ - lib/tork/config/test/master.rb
159
+ - lib/tork/config/test/worker.rb
151
160
  - lib/tork/driver.rb
152
161
  - lib/tork/engine.rb
153
162
  - lib/tork/master.rb
154
163
  - lib/tork/server.rb
155
164
  - lib/tork/version.rb
156
165
  - tork.gemspec
166
+ - man/man1/tork-notify.1
167
+ - man/man1/tork-remote.1
157
168
  - man/man1/tork-herald.1
158
169
  - man/man1/tork-engine.1
159
170
  - man/man1/tork-master.1
@@ -173,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
184
  version: '0'
174
185
  segments:
175
186
  - 0
176
- hash: 3151820321944802472
187
+ hash: 3513287657673218143
177
188
  required_rubygems_version: !ruby/object:Gem::Requirement
178
189
  none: false
179
190
  requirements:
@@ -182,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
193
  version: '0'
183
194
  segments:
184
195
  - 0
185
- hash: 3151820321944802472
196
+ hash: 3513287657673218143
186
197
  requirements: []
187
198
  rubyforge_project:
188
199
  rubygems_version: 1.8.23
data/lib/tork/client.rb DELETED
@@ -1,53 +0,0 @@
1
- require 'thread'
2
- require 'json'
3
-
4
- module Tork
5
- module Client
6
-
7
- class Transmitter < Thread
8
- def initialize output_stream
9
- output_stream.sync = true
10
- @outbox = Queue.new
11
- super() do
12
- while command = @outbox.deq
13
- warn "#{$0}(#{$$}): SEND #{command.inspect}" if $DEBUG
14
- output_stream.puts JSON.dump(command)
15
- end
16
- end
17
- end
18
-
19
- def send command
20
- @outbox.enq command
21
- end
22
- end
23
-
24
- class Receiver < Thread
25
- def initialize input_stream
26
- super() do
27
- while command = JSON.load(input_stream.gets)
28
- warn "#{$0}(#{$$}): RECV #{command.inspect}" if $DEBUG
29
- yield command
30
- end
31
- end
32
- end
33
- end
34
-
35
- class Transceiver < Transmitter
36
- def initialize *popen_args, &receive_block
37
- popen_args[1] = 'w+'
38
- @popen_io = IO.popen(*popen_args)
39
- @receiver = Receiver.new(@popen_io, &receive_block)
40
- super @popen_io
41
- end
42
-
43
- def quit
44
- kill # stop transmit loop
45
- @receiver.kill # stop receive loop
46
- Process.kill :SIGTERM, @popen_io.pid
47
- Process.wait @popen_io.pid # reap zombie
48
- @popen_io.close # prevent further I/O
49
- end
50
- end
51
-
52
- end
53
- end
@@ -1,40 +0,0 @@
1
- require 'tork/config'
2
-
3
- begin
4
- require 'coverage'
5
-
6
- Tork::Config.after_fork_hooks << proc do
7
- Coverage.start
8
- end
9
-
10
- at_exit do
11
- if not $! or ($!.kind_of? SystemExit and $!.success?) and
12
- coverage_by_file = Coverage.result rescue nil
13
- then
14
- report = {}
15
- coverage_by_file.each do |file, coverage|
16
- # ignore files outside working directory
17
- if file.start_with? Dir.pwd
18
- nsloc = 0
19
- holes = []
20
- coverage.each_with_index do |hits, index|
21
- # ignore non-source lines of code
22
- unless hits.nil?
23
- nsloc += 1
24
- # +1 because line numbers go 1..N
25
- holes << index + 1 if hits.zero?
26
- end
27
- end
28
-
29
- grade = ((nsloc - holes.length) / nsloc.to_f) * 100
30
- report[file] = { grade: grade, nsloc: nsloc, holes: holes }
31
- end
32
- end
33
-
34
- require 'yaml'
35
- YAML.dump report, STDOUT
36
- end
37
- end
38
- rescue LoadError => error
39
- warn "tork/config/coverage: #{error.inspect}"
40
- end
@@ -1,32 +0,0 @@
1
- require 'tork/config'
2
-
3
- Tork::Config.all_test_file_globs << 'features/**/*.feature'
4
-
5
- Tork::Config.test_file_globbers.update(
6
- # source files that correspond to test files
7
- %r<^(features/(.+/)?)step_definitions/.+\.rb$> => lambda do |matches|
8
- matches[1] + '*.feature'
9
- end,
10
-
11
- # the actual test files themselves
12
- %r<^features/.+\.feature$> => lambda {|matches| matches[0] }
13
- )
14
-
15
- Tork::Config.after_fork_hooks.push lambda {
16
- |test_file, line_numbers, log_file, worker_number|
17
-
18
- if test_file.end_with? '.feature'
19
- original_argv = ARGV.dup
20
- begin
21
- # pass the feature file to cucumber(1) in ARGV
22
- ARGV.push [test_file, *line_numbers].join(':')
23
- require 'rubygems'
24
- require 'cucumber'
25
- load Gem.bin_path('cucumber', 'cucumber')
26
- ensure
27
- # Restore ARGV for other at_exit hooks. Otherwise, RSpec's hook will
28
- # try to load the non-Ruby feature file from ARGV and fail accordingly.
29
- ARGV.replace original_argv
30
- end
31
- end
32
- }
@@ -1,8 +0,0 @@
1
- require 'tork/config'
2
-
3
- Tork::Config.before_fork_hooks.unshift lambda {
4
- |test_file, line_numbers, log_file, worker_number|
5
-
6
- dirname, basename = File.split(log_file)
7
- log_file.replace File.join(dirname, '.' + basename)
8
- }
@@ -1,10 +0,0 @@
1
- require 'tork/config'
2
-
3
- Tork::Config.before_fork_hooks.push proc {
4
- require 'factory_girl'
5
- FactoryGirl.factories.clear
6
- }
7
-
8
- Tork::Config.after_fork_hooks.push proc {
9
- FactoryGirl.find_definitions
10
- }
@@ -1,10 +0,0 @@
1
- require 'tork/config'
2
- require 'fileutils'
3
-
4
- Tork::Config.before_fork_hooks.unshift lambda {
5
- |test_file, line_numbers, log_file, worker_number|
6
-
7
- dirname, basename = File.split(log_file)
8
- FileUtils.mkdir_p log_dir = File.join('log', dirname)
9
- log_file.replace File.join(log_dir, basename)
10
- }
@@ -1,34 +0,0 @@
1
- require 'tork/config'
2
- require 'set'
3
-
4
- failed_test_files = Set.new
5
-
6
- Tork::Config.test_event_hooks.push lambda {|message|
7
- event, test_file, line_numbers, log_file = message
8
-
9
- # make notifications edge-triggered: pass => fail or vice versa.
10
- # we do not care about pass => pass or fail => fail transitions.
11
- case event.to_sym
12
- when :fail
13
- if failed_test_files.add? test_file
14
- icon = 'dialog-error'
15
- end
16
- when :pass
17
- if line_numbers.empty? and failed_test_files.delete? test_file
18
- icon = 'dialog-information'
19
- end
20
- end
21
-
22
- if icon
23
- title = [event.upcase, test_file].join(' ')
24
-
25
- statistics = File.readlines(log_file).grep(/^\d+ \w+,/).join.
26
- gsub(/\e\[\d+(;\d+)?m/, '') # strip ANSI SGR escape codes
27
-
28
- Thread.new do # run in background
29
- system 'notify-send', '-i', icon, title, statistics or
30
- system 'growlnotify', '-a', 'Xcode', '-m', statistics, title or
31
- system 'xmessage', '-timeout', '5', '-title', title, statistics
32
- end
33
- end
34
- }
@@ -1,9 +0,0 @@
1
- require 'tork/config'
2
-
3
- Tork::Config.after_fork_hooks.push lambda {
4
- |test_file, line_numbers, log_file, worker_number|
5
-
6
- # for compatitibilty with parallel_tests gem,
7
- # store numbers as strings: "", "2", "3", "4"
8
- ENV['TEST_ENV_NUMBER'] = (worker_number + 1).to_s if worker_number > 0
9
- }
@@ -1,39 +0,0 @@
1
- require 'tork/config'
2
- require 'active_support/inflector'
3
-
4
- Tork::Config.reabsorb_file_greps.push(
5
- %r<^config/.+\.(rb|yml)$>,
6
- %r<^db/schema\.rb$>,
7
- %r<^Gemfile\.lock$>
8
- )
9
-
10
- Tork::Config.test_file_globbers.update(
11
- %r<^(app|lib|test|spec)/.*?([^/]+?)(_factory)?\.rb$> => lambda do |matches|
12
- single = matches[2]
13
- plural = ActiveSupport::Inflector.pluralize(single)
14
- "{test,spec}/**/{#{single},#{plural}_*}_{test,spec}.rb"
15
- end
16
- )
17
-
18
- Tork::Config.after_fork_hooks << proc do
19
- if defined? ActiveRecord::Base and
20
- ActiveRecord::Base.connection_pool.spec.config[:database] != ':memory:'
21
- then
22
- ActiveRecord::Base.connection.reconnect!
23
- end
24
- end
25
-
26
- begin
27
- require 'rails/railtie'
28
- class Tork::Railtie < Rails::Railtie
29
- config.before_initialize do |app|
30
- if app.config.cache_classes
31
- warn "tork/config/rails: Setting #{app.class}.config.cache_classes = false"
32
- app.config.cache_classes = false
33
- end
34
- end
35
- end
36
- rescue LoadError
37
- warn "tork/config/rails: Railtie not available; please manually set:\n\t"\
38
- "config.cache_classes = false"
39
- end