bahuvrihi-tap 0.10.7 → 0.10.8
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +0 -2
- data/README +20 -31
- data/bin/rap +18 -8
- data/cgi/run.rb +47 -37
- data/cmd/console.rb +1 -1
- data/cmd/destroy.rb +3 -3
- data/cmd/generate.rb +3 -3
- data/cmd/manifest.rb +61 -53
- data/cmd/run.rb +1 -1
- data/doc/Class Reference +119 -110
- data/doc/Command Reference +76 -123
- data/doc/Syntax Reference +290 -0
- data/doc/Tutorial +307 -237
- data/lib/tap.rb +1 -12
- data/lib/tap/app.rb +46 -71
- data/lib/tap/constants.rb +1 -1
- data/lib/tap/declarations.rb +110 -100
- data/lib/tap/env.rb +141 -173
- data/lib/tap/exe.rb +5 -5
- data/lib/tap/file_task.rb +2 -2
- data/lib/tap/generator/base.rb +0 -4
- data/lib/tap/generator/destroy.rb +8 -12
- data/lib/tap/generator/generate.rb +19 -14
- data/lib/tap/generator/generators/command/command_generator.rb +1 -1
- data/lib/tap/generator/generators/config/config_generator.rb +3 -3
- data/lib/tap/generator/generators/file_task/file_task_generator.rb +1 -1
- data/lib/tap/generator/generators/generator/generator_generator.rb +27 -0
- data/lib/tap/generator/generators/generator/templates/task.erb +27 -0
- data/lib/tap/generator/generators/root/root_generator.rb +12 -12
- data/lib/tap/generator/generators/root/templates/Rakefile +1 -2
- data/lib/tap/generator/generators/root/templates/tapfile +11 -8
- data/lib/tap/generator/generators/task/task_generator.rb +1 -3
- data/lib/tap/generator/generators/task/templates/test.erb +1 -3
- data/lib/tap/root.rb +4 -2
- data/lib/tap/support/aggregator.rb +16 -3
- data/lib/tap/support/assignments.rb +10 -9
- data/lib/tap/support/audit.rb +58 -62
- data/lib/tap/support/class_configuration.rb +32 -43
- data/lib/tap/support/combinator.rb +7 -7
- data/lib/tap/support/configurable.rb +13 -14
- data/lib/tap/support/configurable_class.rb +6 -30
- data/lib/tap/support/configuration.rb +36 -9
- data/lib/tap/support/constant.rb +75 -13
- data/lib/tap/support/constant_manifest.rb +115 -0
- data/lib/tap/support/dependencies.rb +27 -67
- data/lib/tap/support/dependency.rb +44 -0
- data/lib/tap/support/executable.rb +78 -109
- data/lib/tap/support/executable_queue.rb +1 -1
- data/lib/tap/support/gems.rb +6 -0
- data/lib/tap/support/gems/rack.rb +197 -84
- data/lib/tap/support/instance_configuration.rb +29 -3
- data/lib/tap/support/intern.rb +46 -0
- data/lib/tap/support/join.rb +67 -11
- data/lib/tap/support/joins.rb +2 -0
- data/lib/tap/support/joins/fork.rb +1 -0
- data/lib/tap/support/joins/merge.rb +3 -1
- data/lib/tap/support/joins/sequence.rb +2 -2
- data/lib/tap/support/joins/switch.rb +3 -1
- data/lib/tap/support/joins/sync_merge.rb +6 -0
- data/lib/tap/support/lazy_attributes.rb +16 -1
- data/lib/tap/support/lazydoc.rb +21 -21
- data/lib/tap/support/lazydoc/comment.rb +59 -55
- data/lib/tap/support/lazydoc/definition.rb +36 -0
- data/lib/tap/support/lazydoc/document.rb +37 -13
- data/lib/tap/support/manifest.rb +120 -131
- data/lib/tap/support/minimap.rb +90 -0
- data/lib/tap/support/node.rb +4 -6
- data/lib/tap/support/parser.rb +63 -6
- data/lib/tap/support/schema.rb +11 -2
- data/lib/tap/support/shell_utils.rb +3 -5
- data/lib/tap/support/string_ext.rb +60 -0
- data/lib/tap/support/tdoc.rb +2 -2
- data/lib/tap/support/templater.rb +29 -15
- data/lib/tap/support/validation.rb +22 -11
- data/lib/tap/task.rb +155 -156
- data/lib/tap/tasks/load.rb +95 -8
- data/lib/tap/test/extensions.rb +2 -1
- data/lib/tap/test/script_tester.rb +7 -1
- data/template/index.erb +39 -32
- metadata +13 -13
- data/lib/tap/generator/generators/root/templates/test/tapfile_test.rb +0 -15
- data/lib/tap/patches/rake/rake_test_loader.rb +0 -8
- data/lib/tap/patches/rake/testtask.rb +0 -57
- data/lib/tap/patches/ruby19/backtrace_filter.rb +0 -51
- data/lib/tap/patches/ruby19/parsedate.rb +0 -16
- data/lib/tap/spec.rb +0 -42
- data/lib/tap/spec/adapter.rb +0 -25
- data/lib/tap/spec/inheritable_class_test_root.rb +0 -9
- data/lib/tap/support/constant_utils.rb +0 -127
- data/lib/tap/support/summary.rb +0 -30
data/lib/tap/tasks/load.rb
CHANGED
@@ -7,18 +7,105 @@ module Tap
|
|
7
7
|
# used as a gateway task to other tasks.
|
8
8
|
#
|
9
9
|
# % tap run -- load FILEPATH --: [task]
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
#
|
11
|
+
# Load can select items from Hash or Array objects using one or
|
12
|
+
# more keys when only a subset is desired. By default items are
|
13
|
+
# selected using []. For more flexible selection, use match.
|
14
|
+
#
|
15
|
+
# Match converts each of the keys to a Regexp. For hashes, all
|
16
|
+
# values with a matching key will be selected. For arrays, any
|
17
|
+
# item matching a regexp will be selected.
|
18
|
+
#
|
19
|
+
# Use the flags to flatten, compact, sort (etc) results before
|
20
|
+
# passing them on to the next task.
|
21
|
+
class Load < Tap::Task
|
22
|
+
|
23
|
+
config :match, false, :short => :m, &c.switch # match keys
|
24
|
+
config :flatten, false, :short => :f, &c.switch # flatten results
|
25
|
+
config :compact, false, :short => :c, &c.switch # compact results
|
26
|
+
config :unique, false, :short => :u, &c.switch # uniq results
|
27
|
+
config :sort, false, :short => :s, &c.switch # sort results
|
28
|
+
#config :preview, false, :short => :p, &c.switch # logs result
|
29
|
+
|
30
|
+
# Loads the input as YAML and selects objects using keys. Input may
|
31
|
+
# be an IO, StringIO, or a filepath. If keys are empty, the loaded
|
32
|
+
# object is returned directly.
|
33
|
+
#
|
34
|
+
# ==== Key Selection
|
35
|
+
# Keys select items from the loaded object using [] (ie obj[key]).
|
36
|
+
# If match==true, the behavior is different; each string key is
|
37
|
+
# converted into a Regexp and then arrays select items that match
|
38
|
+
# key:
|
39
|
+
#
|
40
|
+
# results = []
|
41
|
+
# array.each {|i| results << i if i =~ key}
|
42
|
+
#
|
43
|
+
# While hashes select values where the key matches key:
|
44
|
+
#
|
45
|
+
# results = []
|
46
|
+
# hash.each_pair {|k,v| results << v if k =~ key}
|
47
|
+
#
|
48
|
+
# Other objects raise an error when match is true.
|
49
|
+
#
|
50
|
+
# ==== Post Processing
|
51
|
+
# After loading/key selection, the results may be processed (in this
|
52
|
+
# order) using flatten, compact, unique, and sort, each performing as
|
53
|
+
# you would expect.
|
54
|
+
#
|
55
|
+
def process(input, *keys)
|
56
|
+
|
57
|
+
# load the input
|
14
58
|
obj = case input
|
15
|
-
when StringIO
|
59
|
+
when StringIO, IO
|
60
|
+
YAML.load(input.read)
|
16
61
|
else
|
17
62
|
log :load, input
|
18
63
|
YAML.load_file(input)
|
19
|
-
end
|
20
|
-
|
21
|
-
|
64
|
+
end
|
65
|
+
|
66
|
+
# select results by key
|
67
|
+
results = case
|
68
|
+
when keys.empty? then obj
|
69
|
+
when match
|
70
|
+
regexps = keys.collect {|key| Regexp.new(key.to_s) }
|
71
|
+
select_matching(obj, regexps)
|
72
|
+
else
|
73
|
+
keys.collect do |key|
|
74
|
+
index = key.kind_of?(String) ? YAML.load(key) : key
|
75
|
+
obj[index]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# post-process results
|
80
|
+
results = results.flatten if flatten
|
81
|
+
results = results.compact if compact
|
82
|
+
results = results.uniq if unique
|
83
|
+
results = results.sort if sort
|
84
|
+
|
85
|
+
#if preview
|
86
|
+
# should be a log or something
|
87
|
+
#puts results.inspect
|
88
|
+
#end
|
89
|
+
|
90
|
+
results
|
91
|
+
end
|
92
|
+
|
93
|
+
protected
|
94
|
+
|
95
|
+
# selects items from obj which match one of the regexps.
|
96
|
+
def select_matching(obj, regexps) # :nodoc:
|
97
|
+
case obj
|
98
|
+
when Array
|
99
|
+
obj.select {|item| regexps.any? {|r| item =~ r} }
|
100
|
+
when Hash
|
101
|
+
results = []
|
102
|
+
obj.each_pair do |key, value|
|
103
|
+
results << value if regexps.any? {|r| key =~ r}
|
104
|
+
end
|
105
|
+
results
|
106
|
+
else
|
107
|
+
raise ArgumentError, "cannot match keys from a #{obj.class}"
|
108
|
+
end
|
22
109
|
end
|
23
110
|
end
|
24
111
|
end
|
data/lib/tap/test/extensions.rb
CHANGED
@@ -8,7 +8,8 @@ module Tap
|
|
8
8
|
autoload(:FileTest, 'tap/test/file_test')
|
9
9
|
autoload(:TapTest, 'tap/test/tap_test')
|
10
10
|
autoload(:ScriptTest, 'tap/test/script_test')
|
11
|
-
|
11
|
+
autoload(:Utils, 'tap/test/utils')
|
12
|
+
|
12
13
|
module Extensions
|
13
14
|
def acts_as_subset_test
|
14
15
|
include Tap::Test::SubsetTest
|
@@ -16,6 +16,8 @@ module Tap
|
|
16
16
|
|
17
17
|
attr_reader :stepwise, :run_block
|
18
18
|
|
19
|
+
NIL_VALIDATION = lambda {|*args|}
|
20
|
+
|
19
21
|
def initialize(command_path=nil, stepwise=false, &run_block)
|
20
22
|
@command_path = command_path
|
21
23
|
@commands = []
|
@@ -50,7 +52,7 @@ module Tap
|
|
50
52
|
end
|
51
53
|
|
52
54
|
def time(msg, command)
|
53
|
-
run([command, msg, nil,
|
55
|
+
run([command, msg, nil, NIL_VALIDATION])
|
54
56
|
end
|
55
57
|
|
56
58
|
def check(msg, command, use_regexp_escapes=true, &validation)
|
@@ -75,6 +77,10 @@ module Tap
|
|
75
77
|
|
76
78
|
def run(*commands)
|
77
79
|
commands.each_with_index do |(cmd, msg, expected, validation), i|
|
80
|
+
unless expected || validation
|
81
|
+
raise ArgumentError, "no expectation or validation set for: #{cmd}"
|
82
|
+
end
|
83
|
+
|
78
84
|
start = Time.now
|
79
85
|
result = capture_sh(cmd) {|ok, status, tempfile_path| }
|
80
86
|
elapsed = Time.now - start
|
data/template/index.erb
CHANGED
@@ -1,42 +1,49 @@
|
|
1
|
+
<% env_names = {} %>
|
2
|
+
<% env.manifest(:envs, true).minimize.each do |name, environment| %>
|
3
|
+
<% env_names[environment] = name %>
|
4
|
+
<% end %>
|
1
5
|
<html>
|
2
6
|
<head>
|
3
|
-
|
7
|
+
<title>Tap::Manifest</title>
|
4
8
|
</head>
|
5
9
|
<body>
|
6
|
-
<h1><a href="<%= Tap::WEBSITE %>">Tap (<ins>T</ins>ask <ins>Ap</ins>plication) <%= Tap::VERSION %> </a></h1>
|
7
|
-
|
8
|
-
<% server.manifest(:envs, true).minimize.each do |(env_key, env)|
|
9
|
-
cgi_manifest = env.manifest(:cgis, true).minimize
|
10
|
-
task_manifest = env.manifest(:tasks, true).minimize
|
11
|
-
next if cgi_manifest.empty? && task_manifest.empty? %>
|
12
|
-
<h2><%= env_key %></h2>
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
lazydoc = Tap::Support::Lazydoc[path]
|
18
|
-
lazydoc.resolve
|
19
|
-
summary = lazydoc.default_attributes['summary']
|
20
|
-
%>
|
21
|
-
<li><a href="<%= cgi_key %>"><%= cgi_key %></a>: <%= summary %></li>
|
22
|
-
<% end %>
|
23
|
-
</ul>
|
24
|
-
<% end %>
|
11
|
+
<div id="branding">
|
12
|
+
<h1><a href="<%= Tap::WEBSITE %>">Tap (<ins>T</ins>ask <ins>Ap</ins>plication) <%= Tap::VERSION %> </a></h1>
|
13
|
+
</div>
|
25
14
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
15
|
+
<div id="content_main">
|
16
|
+
<dl id="envs" class="manifest">
|
17
|
+
<% env.each do |current| %>
|
18
|
+
<dt class="key"><%= env_names[current] %> (<%= current.root.root %>)</dt>
|
19
|
+
<dd class="value">
|
20
|
+
<% manifest_keys = (Tap::Env.manifests.keys + current.manifests.keys).uniq %>
|
21
|
+
<% manifest_keys -= [:envs] %>
|
22
|
+
<% manifest_keys.each do |key| %>
|
23
|
+
<% manifest = current.manifest(key, true) %>
|
24
|
+
<% next if manifest.empty? %>
|
25
|
+
<dl id="manifests" class="manifest">
|
26
|
+
<dt class="key"><%= key %></dt>
|
27
|
+
<dd class="value">
|
28
|
+
<ol>
|
29
|
+
<% manifest.each do |(name, path)| %>
|
30
|
+
<% path = path.kind_of?(Tap::Support::Constant) ? path.require_path : path %>
|
31
|
+
<li><%= name %> (<%= current.root.relative_filepath(:root, path) || path %>)</li>
|
32
|
+
<% end %>
|
33
|
+
</ol>
|
34
|
+
</dd>
|
35
|
+
</dl>
|
36
|
+
<% end %>
|
37
|
+
</dd>
|
38
38
|
<% end %>
|
39
|
+
</dl>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div id="nav">
|
43
|
+
<ul>
|
44
|
+
<li><a href="index?refresh=true">Refresh</a></li>
|
45
|
+
</ul>
|
46
|
+
</div>
|
39
47
|
|
40
|
-
<a href="index?refresh=true">Refresh</a>
|
41
48
|
</body>
|
42
49
|
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bahuvrihi-tap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Chiang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-10-09 00:00:00 -07:00
|
13
13
|
default_executable: tap
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,9 +24,10 @@ extra_rdoc_files:
|
|
24
24
|
- README
|
25
25
|
- MIT-LICENSE
|
26
26
|
- History
|
27
|
-
- doc/Tutorial
|
28
27
|
- doc/Class Reference
|
29
28
|
- doc/Command Reference
|
29
|
+
- doc/Syntax Reference
|
30
|
+
- doc/Tutorial
|
30
31
|
files:
|
31
32
|
- cgi/run.rb
|
32
33
|
- cmd/console.rb
|
@@ -59,6 +60,8 @@ files:
|
|
59
60
|
- lib/tap/generator/generators/file_task/templates/result.yml
|
60
61
|
- lib/tap/generator/generators/file_task/templates/task.erb
|
61
62
|
- lib/tap/generator/generators/file_task/templates/test.erb
|
63
|
+
- lib/tap/generator/generators/generator/generator_generator.rb
|
64
|
+
- lib/tap/generator/generators/generator/templates/task.erb
|
62
65
|
- lib/tap/generator/generators/root/root_generator.rb
|
63
66
|
- lib/tap/generator/generators/root/templates/README
|
64
67
|
- lib/tap/generator/generators/root/templates/Rakefile
|
@@ -66,20 +69,12 @@ files:
|
|
66
69
|
- lib/tap/generator/generators/root/templates/gemspec
|
67
70
|
- lib/tap/generator/generators/root/templates/test/tap_test_helper.rb
|
68
71
|
- lib/tap/generator/generators/root/templates/test/tap_test_suite.rb
|
69
|
-
- lib/tap/generator/generators/root/templates/test/tapfile_test.rb
|
70
72
|
- lib/tap/generator/generators/task/task_generator.rb
|
71
73
|
- lib/tap/generator/generators/task/templates/task.erb
|
72
74
|
- lib/tap/generator/generators/task/templates/test.erb
|
73
75
|
- lib/tap/generator/manifest.rb
|
74
76
|
- lib/tap/patches/optparse/summarize.rb
|
75
|
-
- lib/tap/patches/rake/rake_test_loader.rb
|
76
|
-
- lib/tap/patches/rake/testtask.rb
|
77
|
-
- lib/tap/patches/ruby19/backtrace_filter.rb
|
78
|
-
- lib/tap/patches/ruby19/parsedate.rb
|
79
77
|
- lib/tap/root.rb
|
80
|
-
- lib/tap/spec.rb
|
81
|
-
- lib/tap/spec/adapter.rb
|
82
|
-
- lib/tap/spec/inheritable_class_test_root.rb
|
83
78
|
- lib/tap/support/aggregator.rb
|
84
79
|
- lib/tap/support/assignments.rb
|
85
80
|
- lib/tap/support/audit.rb
|
@@ -89,14 +84,16 @@ files:
|
|
89
84
|
- lib/tap/support/configurable_class.rb
|
90
85
|
- lib/tap/support/configuration.rb
|
91
86
|
- lib/tap/support/constant.rb
|
92
|
-
- lib/tap/support/
|
87
|
+
- lib/tap/support/constant_manifest.rb
|
93
88
|
- lib/tap/support/dependencies.rb
|
89
|
+
- lib/tap/support/dependency.rb
|
94
90
|
- lib/tap/support/executable.rb
|
95
91
|
- lib/tap/support/executable_queue.rb
|
96
92
|
- lib/tap/support/gems/rake.rb
|
97
93
|
- lib/tap/support/gems/rack.rb
|
98
94
|
- lib/tap/support/gems.rb
|
99
95
|
- lib/tap/support/instance_configuration.rb
|
96
|
+
- lib/tap/support/intern.rb
|
100
97
|
- lib/tap/support/join.rb
|
101
98
|
- lib/tap/support/joins.rb
|
102
99
|
- lib/tap/support/joins/fork.rb
|
@@ -108,17 +105,19 @@ files:
|
|
108
105
|
- lib/tap/support/lazydoc.rb
|
109
106
|
- lib/tap/support/lazydoc/comment.rb
|
110
107
|
- lib/tap/support/lazydoc/config.rb
|
108
|
+
- lib/tap/support/lazydoc/definition.rb
|
111
109
|
- lib/tap/support/lazydoc/document.rb
|
112
110
|
- lib/tap/support/lazydoc/method.rb
|
113
111
|
- lib/tap/support/manifest.rb
|
112
|
+
- lib/tap/support/minimap.rb
|
114
113
|
- lib/tap/support/node.rb
|
115
114
|
- lib/tap/support/parser.rb
|
116
115
|
- lib/tap/support/schema.rb
|
117
116
|
- lib/tap/support/shell_utils.rb
|
117
|
+
- lib/tap/support/string_ext.rb
|
118
118
|
- lib/tap/support/tdoc.rb
|
119
119
|
- lib/tap/support/tdoc/tdoc_html_generator.rb
|
120
120
|
- lib/tap/support/tdoc/tdoc_html_template.rb
|
121
|
-
- lib/tap/support/summary.rb
|
122
121
|
- lib/tap/support/templater.rb
|
123
122
|
- lib/tap/support/validation.rb
|
124
123
|
- lib/tap/support/versions.rb
|
@@ -146,6 +145,7 @@ files:
|
|
146
145
|
- README
|
147
146
|
- MIT-LICENSE
|
148
147
|
- History
|
148
|
+
- doc/Syntax Reference
|
149
149
|
has_rdoc: true
|
150
150
|
homepage: http://tap.rubyforge.org
|
151
151
|
post_install_message:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/tap_test_helper.rb'
|
2
|
-
require File.dirname(__FILE__) + '/../tapfile.rb'
|
3
|
-
|
4
|
-
class TapfileTest < Test::Unit::TestCase
|
5
|
-
acts_as_tap_test
|
6
|
-
|
7
|
-
def test_goodnight
|
8
|
-
task = Goodnight.new :message => "goodnight"
|
9
|
-
|
10
|
-
# a simple test
|
11
|
-
assert_equal({:message => 'goodnight'}, task.config)
|
12
|
-
assert_equal "goodnight moon", task.process("moon")
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# this is the same code as in rake/rake_test_loader.rb
|
2
|
-
# except it duplicates ARGV before iterating over it.
|
3
|
-
#
|
4
|
-
# This prevents an error in Ruby 1.9 when one of the
|
5
|
-
# loaded files attempts to modify ARGV. In that case
|
6
|
-
# you get an error like: 'can't modify array during
|
7
|
-
# iteration (RuntimeError)'
|
8
|
-
ARGV.dup.each { |f| load f unless f =~ /^-/ }
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# NO idea why this prevents an error with @ruby_opts=nil,
|
2
|
-
# or even how @ruby_opts could be nil, on ruby 1.9 with
|
3
|
-
# rake test and tdoc. It does, though.
|
4
|
-
require 'pp'
|
5
|
-
|
6
|
-
module Rake # :nodoc:
|
7
|
-
|
8
|
-
class TestTask < TaskLib # :nodoc:
|
9
|
-
|
10
|
-
# Patch for TestTask#define in 'rake\testtask.rb'
|
11
|
-
#
|
12
|
-
# This patch lets you specify Windows-style paths in lib
|
13
|
-
# (ie with spaces and slashes) and to do something like:
|
14
|
-
#
|
15
|
-
# Rake::TestTask.new(:test) do |t|
|
16
|
-
# t.libs = $: << 'lib'
|
17
|
-
# end
|
18
|
-
#
|
19
|
-
# Using this patch you can specify additional load paths
|
20
|
-
# for the test from the command line using --lib-dir
|
21
|
-
#
|
22
|
-
def define
|
23
|
-
lib_opt = @libs.collect {|f| "-I\"#{File.expand_path(f)}\""}.join(' ')
|
24
|
-
desc "Run tests" + (@name==:test ? "" : " for #{@name}")
|
25
|
-
task @name do
|
26
|
-
run_code = ''
|
27
|
-
RakeFileUtils.verbose(@verbose) do
|
28
|
-
run_code =
|
29
|
-
case @loader
|
30
|
-
when :direct
|
31
|
-
"-e 'ARGV.each{|f| load f}'"
|
32
|
-
when :testrb
|
33
|
-
"-S testrb #{fix}"
|
34
|
-
when :rake
|
35
|
-
rake_loader
|
36
|
-
end
|
37
|
-
@ruby_opts.unshift(lib_opt)
|
38
|
-
@ruby_opts.unshift( "-w" ) if @warning
|
39
|
-
ruby @ruby_opts.join(" ") +
|
40
|
-
" \"#{run_code}\" " +
|
41
|
-
file_list.collect { |fn| "\"#{fn}\"" }.join(' ') +
|
42
|
-
" #{option_list}"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
self
|
46
|
-
end
|
47
|
-
|
48
|
-
# Loads in the patched rake_test_loader to avoid the ARGV
|
49
|
-
# modification error, which arises within TDoc.
|
50
|
-
#--
|
51
|
-
# May be out of date...
|
52
|
-
def rake_loader # :nodoc:
|
53
|
-
File.expand_path(File.join(File.dirname(__FILE__), 'rake_test_loader.rb'))
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module Test
|
2
|
-
module Unit
|
3
|
-
module Util # :nodoc:
|
4
|
-
module BacktraceFilter # :nodoc:
|
5
|
-
|
6
|
-
if method_defined?(:filter_backtrace)
|
7
|
-
alias :tap_original_filter_backtrace :filter_backtrace
|
8
|
-
end
|
9
|
-
|
10
|
-
# This is a slightly-modified version of the default BacktraceFilter
|
11
|
-
# provided in the Ruby 1.9 distribution. It solves the issue documented
|
12
|
-
# below, and hopefully will not be necessary when Ruby 1.9 is stable.
|
13
|
-
#
|
14
|
-
def filter_backtrace(backtrace, prefix=nil)
|
15
|
-
return ["No backtrace"] unless(backtrace)
|
16
|
-
split_p = if(prefix)
|
17
|
-
prefix.split(TESTUNIT_FILE_SEPARATORS)
|
18
|
-
else
|
19
|
-
TESTUNIT_PREFIX
|
20
|
-
end
|
21
|
-
match = proc do |e|
|
22
|
-
split_e = e.split(TESTUNIT_FILE_SEPARATORS)[0, split_p.size]
|
23
|
-
next false unless(split_e[0..-2] == split_p[0..-2])
|
24
|
-
split_e[-1].sub(TESTUNIT_RB_FILE, '') == split_p[-1]
|
25
|
-
end
|
26
|
-
|
27
|
-
# The Ruby 1.9 issue is that sometimes backtrace is a String
|
28
|
-
# and String is no longer Enumerable (hence it doesn't respond
|
29
|
-
# respond to detect). Arrayify to solve.
|
30
|
-
backtrace = [backtrace] unless backtrace.kind_of?(Array)
|
31
|
-
|
32
|
-
return backtrace unless(backtrace.detect(&match))
|
33
|
-
found_prefix = false
|
34
|
-
new_backtrace = backtrace.reverse.reject do |e|
|
35
|
-
if(match[e])
|
36
|
-
found_prefix = true
|
37
|
-
true
|
38
|
-
elsif(found_prefix)
|
39
|
-
false
|
40
|
-
else
|
41
|
-
true
|
42
|
-
end
|
43
|
-
end.reverse
|
44
|
-
new_backtrace = (new_backtrace.empty? ? backtrace : new_backtrace)
|
45
|
-
new_backtrace = new_backtrace.reject(&match)
|
46
|
-
new_backtrace.empty? ? backtrace : new_backtrace
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|