tork 19.8.2 → 19.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION.markdown +27 -0
- data/bin/tork +3 -16
- data/bin/tork-driver +2 -2
- data/bin/tork-engine +2 -2
- data/bin/tork-herald +1 -1
- data/bin/tork-master +2 -2
- data/bin/tork-notify +1 -1
- data/bin/tork-runner +1 -1
- data/lib/tork/cliapp.rb +32 -17
- data/lib/tork/config.rb +5 -5
- data/lib/tork/config/bundler/config.rb +1 -0
- data/lib/tork/config/cucumber/config.rb +1 -0
- data/lib/tork/config/devise/config.rb +1 -0
- data/lib/tork/config/factory_girl/config.rb +1 -0
- data/lib/tork/config/rails/config.rb +1 -0
- data/lib/tork/config/spec/config.rb +4 -0
- data/lib/tork/config/spec/driver.rb +5 -9
- data/lib/tork/config/spec/master.rb +1 -0
- data/lib/tork/config/spec/worker.rb +1 -1
- data/lib/tork/config/test/config.rb +10 -0
- data/lib/tork/config/test/driver.rb +5 -9
- data/lib/tork/config/test/master.rb +1 -0
- data/lib/tork/config/test/worker.rb +1 -1
- data/lib/tork/engine.rb +3 -3
- data/lib/tork/master.rb +1 -1
- data/lib/tork/version.rb +1 -1
- data/man/index.html +1 -1
- data/man/man0/README.html +1 -1
- data/man/man0/VERSION.html +126 -105
- data/man/man0/VERSION.markdown +27 -0
- data/man/man1/tork-driver.1 +2 -2
- data/man/man1/tork-driver.1.html +3 -3
- data/man/man1/tork-engine.1 +2 -2
- data/man/man1/tork-engine.1.html +3 -3
- data/man/man1/tork-herald.1 +1 -1
- data/man/man1/tork-herald.1.html +2 -2
- data/man/man1/tork-master.1 +2 -2
- data/man/man1/tork-master.1.html +3 -3
- data/man/man1/tork-notify.1 +1 -1
- data/man/man1/tork-notify.1.html +2 -2
- data/man/man1/tork-remote.1.html +1 -1
- data/man/man1/tork-runner.1 +1 -1
- data/man/man1/tork-runner.1.html +2 -2
- data/man/man1/tork.1 +9 -45
- data/man/man1/tork.1.html +4 -17
- metadata +9 -3
- data/lib/tork/config/default/config.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db7c9496a3b8d6e14495d3cf7697adbed44650d5
|
4
|
+
data.tar.gz: 1aac8ca254bc58ebe2561f7aeeef8eb7a7ee672c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a730b6a80141971a6c8eee69fa45aed9ff464ea23a4d0c85b4a91241f8e60ae7cdc3f1c05e23d0348fea55fb227784c007d4ea0d785d95ead7a52b798ae684dc
|
7
|
+
data.tar.gz: 12e0de85fbb9ca6b2075251068979b78e945e22d0b85f42c121211d9018ee4ae308476bf5a189e0b078449fbc1001c1d74c7a0fb7a68ac1d126237ed9046662d
|
data/VERSION.markdown
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
## Version 19.9.0 (2014-07-17)
|
2
|
+
|
3
|
+
### Minor:
|
4
|
+
|
5
|
+
* Add support for testing outside `test/` and `spec/` directories. This
|
6
|
+
change lets you run test files directly from the current working directory
|
7
|
+
without having to put them inside special `test/` and `spec/` directories.
|
8
|
+
|
9
|
+
This can be useful if you are learning Ruby or writing tests for simple
|
10
|
+
scripts because you need not create a directory structure that is fit for
|
11
|
+
a larger application just for the sole purpose of running your tests!
|
12
|
+
|
13
|
+
* Drop the `default` configuration helper and load the `config.rb` files of
|
14
|
+
all configuration helpers on startup instead. This way, each helper can
|
15
|
+
itself detect whether it is needed from inside its own `config.rb` file.
|
16
|
+
|
17
|
+
* Censor Tork internals from test failure backtraces so that users can
|
18
|
+
inspect them quickly to find where errors are arising in their code.
|
19
|
+
|
20
|
+
### Patch:
|
21
|
+
|
22
|
+
* Only 1 worker was being used on a dual-core system.
|
23
|
+
|
24
|
+
### Other:
|
25
|
+
|
26
|
+
* tork(1): use complete sentences in the help message.
|
27
|
+
|
1
28
|
## Version 19.8.2 (2014-07-01)
|
2
29
|
|
3
30
|
This release adds support for RSpec 3+ in the `spec` configuration helper.
|
data/bin/tork
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
=begin =======================================================================
|
3
3
|
|
4
|
-
# TORK 1 2014-07-
|
4
|
+
# TORK 1 2014-07-17 19.9.0
|
5
5
|
|
6
6
|
## NAME
|
7
7
|
|
@@ -46,7 +46,7 @@ This program can be controlled remotely by multiple tork-remote(1) instances.
|
|
46
46
|
## FILES
|
47
47
|
|
48
48
|
*.tork/config.rb*
|
49
|
-
Optional Ruby script that is loaded inside
|
49
|
+
Optional Ruby script that is loaded inside this Tork process on startup.
|
50
50
|
It can read and change the `ENV['TORK_CONFIGS']` environment variable.
|
51
51
|
|
52
52
|
## ENVIRONMENT
|
@@ -54,21 +54,7 @@ This program can be controlled remotely by multiple tork-remote(1) instances.
|
|
54
54
|
`TORK_CONFIGS`
|
55
55
|
Colon-separated (:) list of either paths to directories that contain
|
56
56
|
configuration files or names of the following configuration helpers.
|
57
|
-
If this variable is not set, then its value is assumed to be "default".
|
58
57
|
|
59
|
-
> `default`
|
60
|
-
> Loads the following configuration helpers (as appropriate) if your
|
61
|
-
> current working directory appears to utilize what they configure.
|
62
|
-
> See below for complete descriptions of these configuration helpers.
|
63
|
-
>
|
64
|
-
> * bundler
|
65
|
-
> * rails
|
66
|
-
> * devise
|
67
|
-
> * test
|
68
|
-
> * spec
|
69
|
-
> * cucumber
|
70
|
-
> * factory_girl
|
71
|
-
>
|
72
58
|
> `dotlog`
|
73
59
|
> Hides log files by prefixing their names with a period (dot).
|
74
60
|
>
|
@@ -129,6 +115,7 @@ tork-runner(1), tork-driver(1), tork-master(1)
|
|
129
115
|
|
130
116
|
=end =========================================================================
|
131
117
|
|
118
|
+
TORK_DOLLAR_ZERO = $0
|
132
119
|
$0 = File.basename(__FILE__) # for easier identification in ps(1) output
|
133
120
|
|
134
121
|
require 'binman'
|
data/bin/tork-driver
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
=begin =======================================================================
|
3
3
|
|
4
|
-
# TORK-DRIVER 1 2014-07-
|
4
|
+
# TORK-DRIVER 1 2014-07-17 19.9.0
|
5
5
|
|
6
6
|
## NAME
|
7
7
|
|
@@ -51,7 +51,7 @@ to stdout.
|
|
51
51
|
## FILES
|
52
52
|
|
53
53
|
*.tork/config.rb*
|
54
|
-
Optional Ruby script that is loaded inside
|
54
|
+
Optional Ruby script that is loaded inside this Tork process on startup.
|
55
55
|
It can read and change the `ENV['TORK_CONFIGS']` environment variable.
|
56
56
|
|
57
57
|
`.tork/driver.rb`
|
data/bin/tork-engine
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
=begin =======================================================================
|
3
3
|
|
4
|
-
# TORK-ENGINE 1 2014-07-
|
4
|
+
# TORK-ENGINE 1 2014-07-17 19.9.0
|
5
5
|
|
6
6
|
## NAME
|
7
7
|
|
@@ -76,7 +76,7 @@ to stdout.
|
|
76
76
|
## FILES
|
77
77
|
|
78
78
|
*.tork/config.rb*
|
79
|
-
Optional Ruby script that is loaded inside
|
79
|
+
Optional Ruby script that is loaded inside this Tork process on startup.
|
80
80
|
It can read and change the `ENV['TORK_CONFIGS']` environment variable.
|
81
81
|
|
82
82
|
*.tork/engine.rb*
|
data/bin/tork-herald
CHANGED
data/bin/tork-master
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
=begin =======================================================================
|
3
3
|
|
4
|
-
# TORK-MASTER 1 2014-07-
|
4
|
+
# TORK-MASTER 1 2014-07-17 19.9.0
|
5
5
|
|
6
6
|
## NAME
|
7
7
|
|
@@ -66,7 +66,7 @@ to stdout.
|
|
66
66
|
## FILES
|
67
67
|
|
68
68
|
*.tork/config.rb*
|
69
|
-
Optional Ruby script that is loaded inside
|
69
|
+
Optional Ruby script that is loaded inside this Tork process on startup.
|
70
70
|
It can read and change the `ENV['TORK_CONFIGS']` environment variable.
|
71
71
|
|
72
72
|
*.tork/master.rb*
|
data/bin/tork-notify
CHANGED
data/bin/tork-runner
CHANGED
data/lib/tork/cliapp.rb
CHANGED
@@ -3,17 +3,6 @@ require 'tork/server'
|
|
3
3
|
module Tork
|
4
4
|
class CLIApp < Server
|
5
5
|
|
6
|
-
COMMANDS = {
|
7
|
-
't' => :run_test_file,
|
8
|
-
'a' => :run_all_test_files,
|
9
|
-
's' => :stop_running_test_files,
|
10
|
-
'k' => [:stop_running_test_files, :SIGKILL],
|
11
|
-
'p' => :rerun_passed_test_files,
|
12
|
-
'f' => :rerun_failed_test_files,
|
13
|
-
'o' => :reabsorb_overhead,
|
14
|
-
'q' => :quit,
|
15
|
-
}
|
16
|
-
|
17
6
|
def loop
|
18
7
|
tell @clients, 'Absorbing test execution overhead...', false
|
19
8
|
@driver = popen('tork-driver')
|
@@ -29,6 +18,10 @@ protected
|
|
29
18
|
help client
|
30
19
|
end
|
31
20
|
|
21
|
+
BACKTRACE_CENSOR = /\n\s+(?:from\s)?#{
|
22
|
+
Regexp.union(File.expand_path('../../..', __FILE__), TORK_DOLLAR_ZERO)
|
23
|
+
}[^:]*:\d+:.+$/
|
24
|
+
|
32
25
|
def recv client, message
|
33
26
|
case client
|
34
27
|
when @driver
|
@@ -51,7 +44,12 @@ protected
|
|
51
44
|
when :fail then "\e[31m%s\e[0m" # red
|
52
45
|
end
|
53
46
|
message = color % message if color and STDOUT.tty?
|
54
|
-
|
47
|
+
|
48
|
+
if event_sym == :fail
|
49
|
+
# censor Tork internals from test failure backtraces
|
50
|
+
log = File.read(log_file).gsub(BACKTRACE_CENSOR, '')
|
51
|
+
message = [message, log, message]
|
52
|
+
end
|
55
53
|
|
56
54
|
tell @clients, message, false
|
57
55
|
end
|
@@ -69,12 +67,29 @@ protected
|
|
69
67
|
|
70
68
|
private
|
71
69
|
|
70
|
+
COMMANDS = {
|
71
|
+
't' => :run_test_file,
|
72
|
+
'a' => :run_all_test_files,
|
73
|
+
's' => :stop_running_test_files,
|
74
|
+
'k' => [:stop_running_test_files, :SIGKILL],
|
75
|
+
'p' => :rerun_passed_test_files,
|
76
|
+
'f' => :rerun_failed_test_files,
|
77
|
+
'o' => :reabsorb_overhead,
|
78
|
+
'q' => :quit,
|
79
|
+
}
|
80
|
+
|
72
81
|
def help client
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
82
|
+
tell client, <<HELP, false
|
83
|
+
Type a then ENTER to run all test files.
|
84
|
+
Type t then SPACE then a filename then ENTER to run a specific test file.
|
85
|
+
Type s then ENTER to stop currently running test files.
|
86
|
+
Type k then ENTER to stop currently running test files with SIGKILL.
|
87
|
+
Type p then ENTER to re-run passing test files.
|
88
|
+
Type f then ENTER to re-run failing test files.
|
89
|
+
Type o then ENTER to reabsorb test execution overhead.
|
90
|
+
Type h then ENTER to see this help message.
|
91
|
+
Type q then ENTER to quit.
|
92
|
+
HELP
|
78
93
|
end
|
79
94
|
|
80
95
|
end
|
data/lib/tork/config.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
module Tork
|
2
2
|
# Loads all Ruby scripts found having the given name in (1) the directories
|
3
|
-
# specified in the TORK_CONFIGS
|
3
|
+
# specified in the given $TORK_CONFIGS search path, (2) the subdirectories
|
4
4
|
# of lib/tork/config/, and (3) the user's .tork/ directory; in that order.
|
5
5
|
#
|
6
6
|
# @return [Array] paths of Ruby scripts that were loaded
|
7
7
|
#
|
8
|
-
def self.config name
|
9
|
-
dirs =
|
8
|
+
def self.config name, search_path=ENV['TORK_CONFIGS']
|
9
|
+
dirs = search_path.to_s.strip.split(/:+/).reject(&:empty?).uniq.
|
10
10
|
map {|dir| [dir, __FILE__.sub(/\.rb$/, "/#{dir}")] }.flatten
|
11
11
|
|
12
12
|
Dir["{#{dirs.join(',')},.tork}/#{name}.rb"].each {|script| load script }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
ENV['TORK_CONFIGS'] ||=
|
17
|
-
Tork.config :config
|
16
|
+
ENV['TORK_CONFIGS'] ||= String.new.freeze # ENV values come frozen by default
|
17
|
+
Tork.config :config, '*'
|
@@ -0,0 +1 @@
|
|
1
|
+
ENV['TORK_CONFIGS'] += ':bundler' if Dir['Gemfile{,.lock}'].any?
|
@@ -0,0 +1 @@
|
|
1
|
+
ENV['TORK_CONFIGS'] += ':cucumber' if File.directory? 'features'
|
@@ -0,0 +1 @@
|
|
1
|
+
ENV['TORK_CONFIGS'] += ':devise' if File.exist? 'config/initializers/devise.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
ENV['TORK_CONFIGS'] += ':factory_girl' if Dir['{test,spec}/factories/'].any?
|
@@ -0,0 +1 @@
|
|
1
|
+
ENV['TORK_CONFIGS'] += ':rails' if Dir['script/{rails,console}'].any?
|
@@ -1,17 +1,13 @@
|
|
1
|
-
Tork::Driver::REABSORB_FILE_GREPS.push
|
1
|
+
Tork::Driver::REABSORB_FILE_GREPS.push /\bspec_helper\.rb$/
|
2
2
|
|
3
|
-
Tork::Driver::ALL_TEST_FILE_GLOBS.push
|
3
|
+
Tork::Driver::ALL_TEST_FILE_GLOBS.push $tork_config_spec_glob
|
4
4
|
|
5
5
|
Tork::Driver::TEST_FILE_GLOBBERS.update(
|
6
6
|
# source files that correspond to test files
|
7
|
-
%r{
|
8
|
-
|
9
|
-
"spec/**/{spec_#{target},#{target}_spec}.rb"
|
7
|
+
%r{([^/]+)\.rb$} => lambda do |matches|
|
8
|
+
$tork_config_spec_glob.gsub(/(?<=_)\*|\*(?=_)/, matches[1])
|
10
9
|
end,
|
11
10
|
|
12
11
|
# the actual test files themselves
|
13
|
-
|
14
|
-
target = matches[0]
|
15
|
-
target if File.basename(target) =~ /^spec_|_spec\./
|
16
|
-
end
|
12
|
+
$tork_config_spec_grep => lambda {|matches| matches[0] }
|
17
13
|
)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
$LOAD_PATH.unshift 'spec' unless $LOAD_PATH.include? 'spec'
|
2
2
|
$LOAD_PATH.unshift 'lib' unless $LOAD_PATH.include? 'lib'
|
3
3
|
require 'spec_helper' if File.exist? 'spec/spec_helper.rb'
|
4
|
+
require './spec_helper' if File.exist? 'spec_helper.rb'
|
4
5
|
require 'rspec/autorun' if defined? RSpec
|
@@ -5,7 +5,7 @@ rescue LoadError, NameError
|
|
5
5
|
# ignore
|
6
6
|
end
|
7
7
|
|
8
|
-
if $
|
8
|
+
if $tork_line_numbers.any? and $tork_test_file =~ $tork_config_spec_grep
|
9
9
|
if rspec_version and rspec_version >= '3.0'
|
10
10
|
ARGV.push [$tork_test_file, *$tork_line_numbers].join(':')
|
11
11
|
else
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# people generally prefix or suffix their test file names with these labels
|
2
|
+
# https://en.wikibooks.org/wiki/Ruby_Programming/Unit_testing#Naming_Conventions
|
3
|
+
labels = %w[ test ts tc t ]
|
4
|
+
labels_glob = '{' + labels.join(',') + '}'
|
5
|
+
labels_grep = '(' + labels.join('|') + ')'
|
6
|
+
|
7
|
+
$tork_config_test_glob = "**/{#{labels_glob}_*,*_#{labels_glob}}.rb"
|
8
|
+
$tork_config_test_grep = %r{.*(\b#{labels_grep}_[^/]+|[^/]+_#{labels_grep})\.rb$}
|
9
|
+
|
10
|
+
ENV['TORK_CONFIGS'] += ':test' if Dir['test/', $tork_config_test_glob].any?
|
@@ -1,17 +1,13 @@
|
|
1
|
-
Tork::Driver::REABSORB_FILE_GREPS.push
|
1
|
+
Tork::Driver::REABSORB_FILE_GREPS.push /\btest_helper\.rb$/
|
2
2
|
|
3
|
-
Tork::Driver::ALL_TEST_FILE_GLOBS.push
|
3
|
+
Tork::Driver::ALL_TEST_FILE_GLOBS.push $tork_config_test_glob
|
4
4
|
|
5
5
|
Tork::Driver::TEST_FILE_GLOBBERS.update(
|
6
6
|
# source files that correspond to test files
|
7
|
-
%r{
|
8
|
-
|
9
|
-
"test/**/{test_#{target},#{target}_test}.rb"
|
7
|
+
%r{([^/]+)\.rb$} => lambda do |matches|
|
8
|
+
$tork_config_test_glob.gsub(/(?<=_)\*|\*(?=_)/, matches[1])
|
10
9
|
end,
|
11
10
|
|
12
11
|
# the actual test files themselves
|
13
|
-
|
14
|
-
target = matches[0]
|
15
|
-
target if File.basename(target) =~ /^test_|_test\./
|
16
|
-
end
|
12
|
+
$tork_config_test_grep => lambda {|matches| matches[0] }
|
17
13
|
)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
$LOAD_PATH.unshift 'test' unless $LOAD_PATH.include? 'test'
|
2
2
|
$LOAD_PATH.unshift 'lib' unless $LOAD_PATH.include? 'lib'
|
3
3
|
require 'test_helper' if File.exist? 'test/test_helper.rb'
|
4
|
+
require './test_helper' if File.exist? 'test_helper.rb'
|
4
5
|
require 'minitest/autorun' if defined? MiniTest
|
data/lib/tork/engine.rb
CHANGED
@@ -51,7 +51,7 @@ class Engine < Server
|
|
51
51
|
|
52
52
|
def stop_running_test_files signal=nil
|
53
53
|
if @running_test_files.empty?
|
54
|
-
tell @client, 'There are no
|
54
|
+
tell @client, 'There are no test files currently running.'
|
55
55
|
else
|
56
56
|
send @master, [:stop, signal].compact
|
57
57
|
@running_test_files.clear
|
@@ -60,7 +60,7 @@ class Engine < Server
|
|
60
60
|
|
61
61
|
def rerun_passed_test_files
|
62
62
|
if @passed_test_files.empty?
|
63
|
-
tell @client, 'There are no
|
63
|
+
tell @client, 'There are no passing test files to re-run.'
|
64
64
|
else
|
65
65
|
run_test_files @passed_test_files
|
66
66
|
end
|
@@ -68,7 +68,7 @@ class Engine < Server
|
|
68
68
|
|
69
69
|
def rerun_failed_test_files
|
70
70
|
if @failed_test_files.empty?
|
71
|
-
tell @client, 'There are no
|
71
|
+
tell @client, 'There are no failing test files to re-run.'
|
72
72
|
else
|
73
73
|
run_test_files @failed_test_files
|
74
74
|
end
|
data/lib/tork/master.rb
CHANGED
@@ -31,7 +31,7 @@ class Master < Server
|
|
31
31
|
|
32
32
|
def test test_file, line_numbers
|
33
33
|
# throttle forking rate to meet the maximum concurrent workers limit
|
34
|
-
sleep 1 until @command_by_worker_pid.size
|
34
|
+
sleep 1 until @command_by_worker_pid.size <= @worker_number_pool.size
|
35
35
|
|
36
36
|
$tork_test_file = test_file
|
37
37
|
$tork_line_numbers = line_numbers
|
data/lib/tork/version.rb
CHANGED
data/man/index.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
5
|
-
<meta name="generator" content="md2man 3.0.
|
5
|
+
<meta name="generator" content="md2man 3.0.1 https://github.com/sunaku/md2man" />
|
6
6
|
<title>man/index</title>
|
7
7
|
<link rel="stylesheet" href="style.css"/>
|
8
8
|
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|