reap 5.0.0 → 5.10.10
Sign up to get free protection for your applications and to get access to all the features.
- data/ANN +3 -0
- data/COPYING +11 -0
- data/ChangeLog +25 -0
- data/ProjectInfo +41 -66
- data/README +125 -0
- data/Rakefile +0 -10
- data/bin/reap +3 -4
- data/data/reap/scaffold/COPYING +11 -0
- data/data/reap/scaffold/{standard/ChangeLog → ChangeLog} +0 -0
- data/data/reap/scaffold/{standard/TODO → INSTALL} +0 -0
- data/data/reap/scaffold/{standard/ProjectInfo → ProjectInfo} +20 -20
- data/data/reap/scaffold/{subversion/trunk/ChangeLog → README} +0 -0
- data/data/reap/scaffold/Rakefile +146 -0
- data/data/reap/scaffold/{subversion/trunk/TODO → Todo} +0 -0
- data/{doc/note → data/reap/scaffold}/setup.rb +11 -18
- data/{doc/note/aRakefile → dev/Rakefile} +0 -0
- data/{doc/note → dev}/composite_task.rb +0 -0
- data/{doc/note → dev}/compositepublisher.rb +0 -0
- data/{doc/note → dev}/ftptools.rb +0 -0
- data/{doc/note → dev}/license-each.rb +0 -0
- data/{doc/note → dev}/publisher.rb +0 -0
- data/{doc/note → dev}/rubyforgepublisher.rb +0 -0
- data/{doc/note → dev}/sshpublisher.rb +0 -0
- data/{doc/note → dev}/suby-cvs.rb +0 -0
- data/{doc/note → dev}/template.rb +0 -0
- data/lib/reap/bin/reap.rb +67 -84
- data/{doc/note/interface/interface.rb → lib/reap/lint.rb} +0 -0
- data/lib/reap/projectinfo.rb +28 -206
- data/lib/reap/readymade.rb +21 -0
- data/lib/reap/task.rb +118 -184
- data/lib/reap/task/announce.rb +93 -181
- data/lib/reap/task/fileperm.rb +16 -46
- data/lib/reap/task/info.rb +7 -33
- data/lib/reap/task/install.rb +17 -52
- data/{task → lib/reap/task}/noop.rb +9 -4
- data/lib/reap/task/package.rb +102 -348
- data/lib/reap/task/publish.rb +29 -155
- data/lib/reap/task/rdoc.rb +40 -92
- data/lib/reap/task/scaffold.rb +98 -41
- data/lib/reap/task/test.rb +52 -147
- data/lib/reap/task/testext.rb +110 -0
- data/lib/reap/task/webpublish.rb +43 -0
- data/lib/reap/tasks.rb +13 -0
- data/lib/reap/test.rb +138 -0
- data/setup.rb +272 -287
- data/test/tc_reap.rb +1 -1
- data/web/ProjectInfo +57 -0
- data/web/images/appleboy.jpg +0 -0
- data/web/images/grape.jpg +0 -0
- data/web/index.html +124 -0
- data/web/rdoc/classes/Object.html +121 -0
- data/web/rdoc/classes/ProjectInfo.html +207 -0
- data/web/rdoc/classes/ProjectInfo.src/M000094.html +18 -0
- data/web/rdoc/classes/ProjectInfo.src/M000095.html +24 -0
- data/web/rdoc/classes/ProjectInfo.src/M000096.html +22 -0
- data/web/rdoc/classes/ProjectInfo.src/M000097.html +21 -0
- data/web/rdoc/classes/ProjectInfo.src/M000098.html +18 -0
- data/web/rdoc/classes/Reap.html +248 -0
- data/web/rdoc/classes/Reap.src/M000023.html +16 -0
- data/web/rdoc/classes/Reap.src/M000024.html +21 -0
- data/web/rdoc/classes/Reap.src/M000025.html +16 -0
- data/web/rdoc/classes/Reap.src/M000026.html +21 -0
- data/web/rdoc/classes/Reap/Announce.html +262 -0
- data/web/rdoc/classes/Reap/Announce.src/M000030.html +18 -0
- data/web/rdoc/classes/Reap/Announce.src/M000031.html +114 -0
- data/web/rdoc/classes/Reap/Announce.src/M000032.html +46 -0
- data/web/rdoc/classes/Reap/Info.html +176 -0
- data/web/rdoc/classes/Reap/Info.src/M000033.html +18 -0
- data/web/rdoc/classes/Reap/Info.src/M000034.html +17 -0
- data/web/rdoc/classes/Reap/Info.src/M000035.html +18 -0
- data/web/rdoc/classes/Reap/Install.html +193 -0
- data/web/rdoc/classes/Reap/Install.src/M000036.html +18 -0
- data/web/rdoc/classes/Reap/Install.src/M000037.html +20 -0
- data/web/rdoc/classes/Reap/Install.src/M000038.html +26 -0
- data/web/rdoc/classes/Reap/Noop.html +192 -0
- data/web/rdoc/classes/Reap/Noop.src/M000027.html +18 -0
- data/web/rdoc/classes/Reap/Noop.src/M000028.html +17 -0
- data/web/rdoc/classes/Reap/Noop.src/M000029.html +18 -0
- data/web/rdoc/classes/Reap/Package.html +310 -0
- data/web/rdoc/classes/Reap/Package.src/M000055.html +18 -0
- data/web/rdoc/classes/Reap/Package.src/M000056.html +68 -0
- data/web/rdoc/classes/Reap/Package.src/M000057.html +84 -0
- data/web/rdoc/classes/Reap/Package.src/M000058.html +61 -0
- data/web/rdoc/classes/Reap/Perm.html +236 -0
- data/web/rdoc/classes/Reap/Perm.src/M000078.html +18 -0
- data/web/rdoc/classes/Reap/Perm.src/M000079.html +21 -0
- data/web/rdoc/classes/Reap/Perm.src/M000080.html +42 -0
- data/web/rdoc/classes/Reap/Perm.src/M000081.html +26 -0
- data/web/rdoc/classes/Reap/Perm.src/M000082.html +18 -0
- data/web/rdoc/classes/Reap/Publish.html +213 -0
- data/web/rdoc/classes/Reap/Publish.src/M000070.html +18 -0
- data/web/rdoc/classes/Reap/Publish.src/M000071.html +22 -0
- data/web/rdoc/classes/Reap/Publish.src/M000072.html +37 -0
- data/web/rdoc/classes/Reap/RDoc.html +218 -0
- data/web/rdoc/classes/Reap/RDoc.src/M000059.html +18 -0
- data/web/rdoc/classes/Reap/RDoc.src/M000060.html +24 -0
- data/web/rdoc/classes/Reap/RDoc.src/M000061.html +70 -0
- data/web/rdoc/classes/Reap/Task.html +396 -0
- data/web/rdoc/classes/Reap/Task.src/M000039.html +18 -0
- data/web/rdoc/classes/Reap/Task.src/M000040.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000041.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000042.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000043.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000044.html +22 -0
- data/web/rdoc/classes/Reap/Task.src/M000045.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000046.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000047.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000048.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000049.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000050.html +27 -0
- data/web/rdoc/classes/Reap/Task.src/M000051.html +19 -0
- data/web/rdoc/classes/Reap/Task.src/M000052.html +18 -0
- data/web/rdoc/classes/Reap/Task.src/M000053.html +18 -0
- data/web/rdoc/classes/Reap/Task.src/M000054.html +19 -0
- data/web/rdoc/classes/Reap/Test.html +253 -0
- data/web/rdoc/classes/Reap/Test.src/M000062.html +18 -0
- data/web/rdoc/classes/Reap/Test.src/M000063.html +26 -0
- data/web/rdoc/classes/Reap/Test.src/M000064.html +77 -0
- data/web/rdoc/classes/Reap/Test.src/M000065.html +27 -0
- data/web/rdoc/classes/Reap/Test.src/M000066.html +50 -0
- data/web/rdoc/classes/Reap/Test/TestResults.html +205 -0
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000067.html +21 -0
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000068.html +21 -0
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000069.html +23 -0
- data/web/rdoc/classes/Reap/TestExt.html +234 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000073.html +18 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000074.html +20 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000075.html +49 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000076.html +34 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000077.html +27 -0
- data/web/rdoc/classes/Reap/WebPublish.html +213 -0
- data/web/rdoc/classes/Reap/WebPublish.src/M000083.html +18 -0
- data/web/rdoc/classes/Reap/WebPublish.src/M000084.html +21 -0
- data/web/rdoc/classes/Reap/WebPublish.src/M000085.html +32 -0
- data/web/rdoc/classes/ReapCommand.html +425 -0
- data/web/rdoc/classes/ReapCommand.src/M000001.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000003.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000005.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000007.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000009.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000011.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000013.html +18 -0
- data/web/rdoc/classes/ReapCommand.src/M000014.html +19 -0
- data/web/rdoc/classes/ReapCommand.src/M000015.html +19 -0
- data/web/rdoc/classes/ReapCommand.src/M000016.html +24 -0
- data/web/rdoc/classes/ReapCommand.src/M000018.html +29 -0
- data/web/rdoc/classes/Scaffold.html +211 -0
- data/web/rdoc/classes/Scaffold.src/M000086.html +16 -0
- data/web/rdoc/classes/Scaffold.src/M000087.html +28 -0
- data/web/rdoc/classes/Scaffold.src/M000088.html +32 -0
- data/web/rdoc/classes/Scaffold.src/M000089.html +18 -0
- data/web/rdoc/classes/UnitTestKernel.html +176 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000019.html +18 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000020.html +18 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000021.html +22 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000022.html +22 -0
- data/web/rdoc/classes/UnitTesting.html +165 -0
- data/web/rdoc/classes/UnitTesting.src/M000090.html +34 -0
- data/web/rdoc/classes/UnitTesting.src/M000091.html +18 -0
- data/web/rdoc/classes/UnitTesting/Failure.html +156 -0
- data/web/rdoc/classes/UnitTesting/Failure.src/M000092.html +18 -0
- data/web/rdoc/classes/UnitTesting/Failure.src/M000093.html +21 -0
- data/web/rdoc/created.rid +1 -0
- data/web/rdoc/files/ANN.html +107 -0
- data/web/rdoc/files/COPYING.html +119 -0
- data/web/rdoc/files/ChangeLog.html +144 -0
- data/web/rdoc/files/ProjectInfo.html +190 -0
- data/web/rdoc/files/README.html +274 -0
- data/web/rdoc/files/Rakefile.html +101 -0
- data/web/rdoc/files/lib/reap/bin/reap_rb.html +129 -0
- data/web/rdoc/files/lib/reap/lint_rb.html +101 -0
- data/web/rdoc/files/lib/reap/projectinfo_rb.html +110 -0
- data/web/rdoc/files/lib/reap/readymade_rb.html +123 -0
- data/web/rdoc/files/lib/reap/task/announce_rb.html +114 -0
- data/web/rdoc/files/lib/reap/task/fileperm_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/info_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/install_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/noop_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/package_rb.html +109 -0
- data/web/rdoc/files/lib/reap/task/publish_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/rdoc_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/scaffold_rb.html +107 -0
- data/web/rdoc/files/lib/reap/task/test_rb.html +110 -0
- data/web/rdoc/files/lib/reap/task/testext_rb.html +109 -0
- data/web/rdoc/files/lib/reap/task/webpublish_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task_rb.html +120 -0
- data/web/rdoc/files/lib/reap/tasks_rb.html +116 -0
- data/web/rdoc/files/lib/reap/test_rb.html +109 -0
- data/web/rdoc/fr_class_index.html +47 -0
- data/web/rdoc/fr_file_index.html +51 -0
- data/web/rdoc/fr_method_index.html +124 -0
- data/web/rdoc/index.html +24 -0
- data/web/rdoc/rdoc-style.css +208 -0
- metadata +257 -138
- data/bin/rubytest +0 -5
- data/data/reap/scaffold/standard/COPYING +0 -403
- data/data/reap/scaffold/standard/INSTALL +0 -14
- data/data/reap/scaffold/standard/README +0 -3
- data/data/reap/scaffold/standard/Rakefile +0 -10
- data/data/reap/scaffold/standard/setup.rb +0 -1568
- data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
- data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
- data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -78
- data/data/reap/scaffold/subversion/trunk/README +0 -3
- data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
- data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
- data/data/reap/setup.rb +0 -1568
- data/doc/COPYING +0 -403
- data/doc/ChangeLog +0 -18
- data/doc/LATEST +0 -29
- data/doc/README +0 -182
- data/doc/doap.xml +0 -27
- data/doc/note/ProjectInfo.rb +0 -88
- data/doc/note/Rakefile.0 +0 -118
- data/doc/note/Rakefile.htm +0 -69
- data/doc/note/application.rb +0 -124
- data/doc/note/interface/rubyforge.rb +0 -247
- data/doc/note/intro.txt +0 -42
- data/doc/note/package.rb +0 -629
- data/doc/note/package.rb.0 +0 -394
- data/doc/note/scaffold.rb +0 -123
- data/lib/reap/app.rb +0 -74
- data/lib/reap/bin/rubylint.rb +0 -1
- data/lib/reap/bin/rubytest.rb +0 -45
- data/lib/reap/rake.rb +0 -12
- data/lib/reap/rakeadapter.rb +0 -50
- data/lib/reap/reap.rb +0 -32
- data/lib/reap/task/custom.rb +0 -12
- data/lib/reap/task/doap.rb +0 -85
- data/lib/reap/task/extest.rb +0 -161
- data/lib/reap/task/manifest.rb +0 -70
- data/lib/reap/task/release.rb +0 -512
- data/lib/reap/task/template.rb +0 -46
- data/lib/reap/vendor/http-access2.rb +0 -1590
- data/lib/reap/vendor/http-access2/cookie.rb +0 -538
- data/lib/reap/vendor/http-access2/http.rb +0 -542
data/lib/reap/task/test.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
|
3
2
|
require 'reap/task'
|
4
3
|
|
@@ -6,114 +5,65 @@ require 'reap/task'
|
|
6
5
|
require 'test/unit/ui/testrunnermediator'
|
7
6
|
require 'facet/string/tabto'
|
8
7
|
|
9
|
-
require 'facet/progressbar'
|
10
|
-
|
11
8
|
Test::Unit.run = true # don't run auto tests
|
12
9
|
|
13
|
-
# _____ _ _____ _
|
14
|
-
# |_ _|__ __| |_ |_ _|_ _ __| |__
|
15
|
-
# | |/ -_|_-< _| | |/ _` (_-< / /
|
16
|
-
# |_|\___/__/\__| |_|\__,_/__/_\_\
|
17
10
|
#
|
18
|
-
|
19
|
-
# = Test Task
|
11
|
+
# Test Task
|
20
12
|
#
|
21
|
-
# The Reap test task runs each test in
|
22
|
-
#
|
13
|
+
# The Reap test task runs each test in
|
14
|
+
# it's own process, making for purer
|
15
|
+
# test facility.
|
16
|
+
#
|
17
|
+
# NOTE: This works well enough but it is a bit of
|
18
|
+
# hack. It actually marshals test results across
|
19
|
+
# a stdout->stdin shell pipe. One consequence of
|
20
|
+
# this is that you can't send debug info to stdout
|
21
|
+
# (including #p and #puts). This, hopefully can be
|
22
|
+
# remedied in the future.
|
23
23
|
#
|
24
|
-
# NOTE This works well enough but it is a tad delicate.
|
25
|
-
# It actually marshals test results across stdout->stdin
|
26
|
-
# shell pipe. One consequence of this is that you can't
|
27
|
-
# send debug info to stdout (including #p and #puts).
|
28
|
-
# This, hopefully can be remedied in the future.
|
29
|
-
|
30
24
|
class Reap::Test < Reap::Task
|
31
25
|
|
32
|
-
task_desc
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
reap test
|
37
|
-
|
38
|
-
Run unit tests. Reap runs each test in a separate
|
39
|
-
proccess to aviod potential conflicts between scripts.
|
40
|
-
|
41
|
-
files Test files (eg. test/tc_**/*.rb)
|
42
|
-
Defaults to typcial selection.
|
43
|
-
|
44
|
-
libs List of lookup directories to include in
|
45
|
-
load path. './lib' is always included.
|
46
|
-
|
47
|
-
live Flag to quickly deactive use of local libs.
|
48
|
-
Test against installed files instead.
|
49
|
-
|
50
|
-
requires List of any files to pre-require.
|
51
|
-
|
52
|
-
}
|
53
|
-
|
54
|
-
task_attr :tst
|
55
|
-
|
56
|
-
# Run testing task.
|
57
|
-
|
58
|
-
def run
|
59
|
-
|
60
|
-
# setup
|
26
|
+
def task_desc
|
27
|
+
"Run unit-tests (each in a separate process)."
|
28
|
+
end
|
61
29
|
|
62
|
-
|
63
|
-
tst.requires ||= []
|
30
|
+
attr_accessor :libs, :files, :fixture, :against_installed
|
64
31
|
|
65
|
-
|
66
|
-
|
32
|
+
def init
|
33
|
+
@libs ||= ['lib']
|
34
|
+
@files ||= [ 'test/*/**/*.rb', 'test/**/tc*.rb', 'test/**/test*.rb', 'test/**/*test.rb' ]
|
35
|
+
@fixture ||= []
|
36
|
+
@against_installed ||= false
|
67
37
|
|
68
38
|
# interal use
|
69
|
-
|
70
39
|
@results = TestResults.new
|
71
40
|
@errors = []
|
72
41
|
@failures = []
|
42
|
+
end
|
73
43
|
|
74
|
-
|
75
|
-
|
76
|
-
test_libs =
|
44
|
+
def run
|
45
|
+
# get test files
|
46
|
+
test_libs = @libs.join(':')
|
77
47
|
test_files = FileList.new
|
78
|
-
test_files.include(
|
79
|
-
test_files.uniq!
|
80
|
-
|
48
|
+
test_files.include(*@files)
|
81
49
|
if test_files.empty?
|
82
|
-
|
50
|
+
puts "No test files found."
|
83
51
|
return
|
84
52
|
end
|
53
|
+
print "Reap is shelling out work to Ruby's Test Suite..."
|
85
54
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
# Run tests
|
91
|
-
# (why arn't these unique to begin with?)
|
92
|
-
test_files.each do |test_file|
|
93
|
-
pbar.inc
|
94
|
-
#$stdout << '.'; $stdout.flush
|
95
|
-
|
96
|
-
if ! File.file?( test_file )
|
97
|
-
r = nil
|
98
|
-
else
|
99
|
-
r = fork_test( test_file )
|
100
|
-
end
|
101
|
-
unless r.passed?
|
102
|
-
@errors << r.instance_variable_get('@errors')
|
103
|
-
@failures << r.instance_variable_get('@failures')
|
104
|
-
end
|
105
|
-
@results << r
|
106
|
-
|
55
|
+
test_files.each { |f|
|
56
|
+
$stdout << '.'; $stdout.flush
|
57
|
+
dotest( f )
|
107
58
|
#ruby %{-r"test/unit" "#{f}"}
|
108
|
-
|
109
|
-
|
110
|
-
pbar.finish
|
59
|
+
}
|
60
|
+
puts "done."
|
111
61
|
|
112
62
|
# Don't know why empty arrays get in them yet, but...
|
113
63
|
@failures.reject! { |e| e == [] }
|
114
64
|
@errors.reject! { |e| e == [] }
|
115
65
|
|
116
|
-
# Display
|
66
|
+
# Display Failures
|
117
67
|
puts
|
118
68
|
puts %{FAILURES:#{@failures.empty? ? ' []' : ''}}
|
119
69
|
@failures.reverse.each { |fails|
|
@@ -130,7 +80,7 @@ class Reap::Test < Reap::Task
|
|
130
80
|
}
|
131
81
|
}
|
132
82
|
|
133
|
-
# Display
|
83
|
+
# Display Errors
|
134
84
|
puts
|
135
85
|
puts %{ERRORS:#{@errors.empty? ? ' []' : ''}}
|
136
86
|
@errors.reverse.each { |errs|
|
@@ -143,7 +93,7 @@ class Reap::Test < Reap::Task
|
|
143
93
|
}
|
144
94
|
}
|
145
95
|
|
146
|
-
# Display
|
96
|
+
# Display Final Results
|
147
97
|
puts
|
148
98
|
puts @results
|
149
99
|
puts
|
@@ -154,41 +104,35 @@ class Reap::Test < Reap::Task
|
|
154
104
|
#ruby %{-e0 -r"test/unit" \\\n#{test_reqs}#{test_opts}}
|
155
105
|
end
|
156
106
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
107
|
+
def dotest( test_file )
|
108
|
+
if ! File.file?( test_file )
|
109
|
+
r = nil
|
110
|
+
else
|
111
|
+
r = fork_test( test_file )
|
112
|
+
end
|
113
|
+
unless r.passed?
|
114
|
+
@errors << r.instance_variable_get('@errors')
|
115
|
+
@failures << r.instance_variable_get('@failures')
|
116
|
+
end
|
117
|
+
@results << r
|
118
|
+
end
|
162
119
|
|
163
|
-
# Runs a test.
|
164
|
-
#
|
165
120
|
# Currently send program output to null device.
|
166
121
|
# Could send to a logger in future version.
|
167
|
-
|
168
122
|
def fork_test( testfile )
|
169
123
|
src = ''
|
170
|
-
|
171
|
-
unless tst.live
|
172
|
-
l = File.join( Dir.pwd, 'lib' )
|
173
|
-
if File.directory?( l )
|
174
|
-
src << %{$:.unshift('#{l}')\n}
|
175
|
-
end
|
176
|
-
tst.libs.each { |r| src << %{$:.unshift('#{r}')\n} }
|
177
|
-
end
|
178
|
-
|
124
|
+
src << %{$:.unshift('lib')} unless against_installed
|
179
125
|
src << %{
|
180
126
|
#require 'test/unit'
|
181
127
|
require 'test/unit/collector'
|
182
128
|
require 'test/unit/collector/objectspace'
|
183
129
|
require 'test/unit/ui/testrunnermediator'
|
184
130
|
}
|
185
|
-
|
186
|
-
tst.requires.each do |fix|
|
131
|
+
fixture.each do |fix|
|
187
132
|
src << %Q{
|
188
133
|
require '#{fix}'
|
189
134
|
}
|
190
135
|
end
|
191
|
-
|
192
136
|
src << %{
|
193
137
|
output = STDOUT.dup
|
194
138
|
STDOUT.reopen( PLATFORM =~ /mswin/ ? "NUL" : "/dev/null" )
|
@@ -197,62 +141,37 @@ private
|
|
197
141
|
tests = Test::Unit::Collector::ObjectSpace.new.collect
|
198
142
|
runner = Test::Unit::UI::TestRunnerMediator.new( tests )
|
199
143
|
result = runner.run_suite
|
200
|
-
|
201
|
-
begin
|
202
|
-
marshalled = Marshal.dump(result)
|
203
|
-
rescue TypeError => e
|
204
|
-
$stderr << "MARSHAL ERROR\n"
|
205
|
-
$stderr << "TEST: #{testfile}\n"
|
206
|
-
$stderr << "DATA:" << result.inspect
|
207
|
-
exit -1
|
208
|
-
end
|
209
|
-
output << marshalled
|
144
|
+
output << Marshal.dump(result)
|
210
145
|
|
211
146
|
STDOUT.reopen(output)
|
212
147
|
output.close
|
213
148
|
}
|
214
|
-
|
215
149
|
result = IO.popen("ruby","w+") do |ruby|
|
216
150
|
ruby.puts src
|
217
151
|
ruby.close_write
|
218
152
|
ruby.read
|
219
153
|
end
|
220
|
-
|
221
154
|
p testfile if $VERBOSE
|
222
|
-
|
223
|
-
begin
|
224
|
-
marsh = Marshal.load(result)
|
225
|
-
rescue ArgumentError
|
226
|
-
$stderr << "\nCannot load marshalled test data.\n"
|
227
|
-
$stderr << result << "\n"
|
228
|
-
exit -1
|
229
|
-
end
|
230
|
-
|
231
|
-
return marsh
|
155
|
+
return Marshal.load(result)
|
232
156
|
end
|
233
157
|
|
234
158
|
#
|
235
|
-
# Support class for collecting test results
|
159
|
+
# Support class for collecting test results
|
236
160
|
#
|
237
|
-
|
238
161
|
class TestResults
|
239
|
-
|
240
162
|
attr_reader :assertion_count, :run_count, :failure_count, :error_count
|
241
|
-
|
242
163
|
def initialize
|
243
164
|
@assertion_count = 0
|
244
165
|
@run_count = 0
|
245
166
|
@failure_count = 0
|
246
167
|
@error_count = 0
|
247
168
|
end
|
248
|
-
|
249
169
|
def <<( result )
|
250
170
|
@assertion_count += result.assertion_count
|
251
171
|
@run_count += result.run_count
|
252
172
|
@failure_count += result.failure_count
|
253
173
|
@error_count += result.error_count
|
254
174
|
end
|
255
|
-
|
256
175
|
def to_s
|
257
176
|
s = %{SUMMARY:\n\n}
|
258
177
|
s << %{ tests : #{@run_count}\n}
|
@@ -261,20 +180,6 @@ private
|
|
261
180
|
s << %{ errors : #{@error_count}\n}
|
262
181
|
s
|
263
182
|
end
|
264
|
-
|
265
|
-
end
|
266
|
-
|
267
|
-
end
|
268
|
-
|
269
|
-
|
270
|
-
# Rake interface.
|
271
|
-
|
272
|
-
if defined?(Rake)
|
273
|
-
|
274
|
-
#require 'reap/rake/adapter'
|
275
|
-
|
276
|
-
module Rake
|
277
|
-
ReapTest = ::Reap::RakeAdapter( ::Reap::Test )
|
278
183
|
end
|
279
184
|
|
280
185
|
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'reap/task'
|
2
|
+
require 'facet/string/margin'
|
3
|
+
|
4
|
+
# Extract Test Task
|
5
|
+
#
|
6
|
+
# The Reap extract test task scans every package script
|
7
|
+
# looking for =begin testing ... =end sections.
|
8
|
+
# With appropriat headers, it copies these sections
|
9
|
+
# to files in the test dir, which then can be run
|
10
|
+
# using the Reap test taks.
|
11
|
+
#
|
12
|
+
class Reap::TestExt < Reap::Task
|
13
|
+
|
14
|
+
def task_desc
|
15
|
+
"Extract unit-tests from lib scripts."
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_accessor :dir, :files, :options
|
19
|
+
|
20
|
+
def init
|
21
|
+
@dir ||= 'test'
|
22
|
+
@files ||= [ 'lib/**/*.rb' ]
|
23
|
+
#@options
|
24
|
+
end
|
25
|
+
|
26
|
+
def run
|
27
|
+
#test_libs = @libs.join(':')
|
28
|
+
files = FileList.new
|
29
|
+
files.include(*@files)
|
30
|
+
if files.empty?
|
31
|
+
puts "No script files found."
|
32
|
+
return
|
33
|
+
end
|
34
|
+
print "Reap is scanning and copying embedded tests..."
|
35
|
+
|
36
|
+
if @dir.strip.empty?
|
37
|
+
puts "Test directory must be specified."
|
38
|
+
return
|
39
|
+
end
|
40
|
+
|
41
|
+
unless File.directory?(@dir)
|
42
|
+
puts "Test directory doesn't exist: #{File.expand_path( @dir )}"
|
43
|
+
return
|
44
|
+
end
|
45
|
+
|
46
|
+
files.each { |file|
|
47
|
+
$stdout << '.'; $stdout.flush
|
48
|
+
testing = extract( file )
|
49
|
+
unless testing.strip.empty?
|
50
|
+
complete_test = create( testing, file )
|
51
|
+
fp = File.join(@dir,file)
|
52
|
+
unless File.directory?( File.dirname( fp ) )
|
53
|
+
FileUtils.mkdir_p( File.dirname(fp) )
|
54
|
+
end
|
55
|
+
File.open( fp, "w" ) { |fw| fw << complete_test }
|
56
|
+
end
|
57
|
+
}
|
58
|
+
puts "done."
|
59
|
+
end
|
60
|
+
|
61
|
+
def extract( file )
|
62
|
+
return nil if ! File.file?( file )
|
63
|
+
tests = ""; inside = false
|
64
|
+
fstr = File.read( file )
|
65
|
+
fstr.split(/\n/).each do |l|
|
66
|
+
if l =~ /^=[ ]*begin[ ]*testing/
|
67
|
+
tests << "\n"
|
68
|
+
inside = true
|
69
|
+
next
|
70
|
+
elsif inside and l =~ /^=[ ]*end/
|
71
|
+
inside = false
|
72
|
+
next
|
73
|
+
end
|
74
|
+
if inside
|
75
|
+
tests << l << "\n"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
tests
|
79
|
+
end
|
80
|
+
|
81
|
+
def create( testing, file )
|
82
|
+
fp = file.split(/[\/]/)
|
83
|
+
if fp[0] == 'lib'
|
84
|
+
reqf = "require '#{fp[1..-1].join('/')}'"
|
85
|
+
else
|
86
|
+
reqf = ''
|
87
|
+
end
|
88
|
+
|
89
|
+
teststr = <<-HERE.margin
|
90
|
+
`# _____ _
|
91
|
+
`# |_ _|__ ___| |_
|
92
|
+
`# | |/ _ \\/ __| __|
|
93
|
+
`# | | __/\\__ \\ |_
|
94
|
+
`# |_|\\___||___/\\__|
|
95
|
+
`#
|
96
|
+
`# for #{file}
|
97
|
+
`#
|
98
|
+
`# Extracted #{Time.now}
|
99
|
+
`# Unit Tools Reap Test Extractor
|
100
|
+
`#
|
101
|
+
`
|
102
|
+
`#{reqf}
|
103
|
+
`
|
104
|
+
HERE
|
105
|
+
teststr << testing << "\n"
|
106
|
+
teststr
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
require 'reap/task'
|
3
|
+
|
4
|
+
#
|
5
|
+
# Web Publish Task
|
6
|
+
#
|
7
|
+
class Reap::WebPublish < Reap::Task
|
8
|
+
|
9
|
+
section_required true
|
10
|
+
|
11
|
+
def task_desc
|
12
|
+
"publish project website to your internet host *"
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_accessor :host, :type, :dir, :project, :username
|
16
|
+
attr_accessor :exclude # not using yet
|
17
|
+
|
18
|
+
def init
|
19
|
+
@host ||= 'rubyforge.org'
|
20
|
+
@project ||= master['rubyforge']['project'] || master['name']
|
21
|
+
@username ||= master['rubyforge']['username']
|
22
|
+
@exclude ||= []
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
cmd = ''; skip = false
|
27
|
+
|
28
|
+
case @host
|
29
|
+
when 'rubyforge'
|
30
|
+
cmd = %{scp -r #{@dir}/* #{@username}@rubyforge.org:/var/www/gforge-projects/#{@project}/}
|
31
|
+
else
|
32
|
+
puts %{Unrecognized publishing host '#{@host}'. Skipped.}
|
33
|
+
skip = true
|
34
|
+
end
|
35
|
+
|
36
|
+
unless skip
|
37
|
+
puts "Reap is shelling out publishing work..."
|
38
|
+
puts cmd
|
39
|
+
sh(cmd) unless $PRETEND
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|