reap 6.0.2 → 9.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/COPYING +666 -395
- data/MANIFEST +139 -0
- data/NOTES +12 -0
- data/README +19 -163
- data/bin/reap-announce +7 -0
- data/bin/reap-check-load +8 -0
- data/bin/reap-check-syntax +7 -0
- data/bin/reap-clean +7 -0
- data/bin/reap-clobber +7 -0
- data/bin/reap-doc +7 -0
- data/bin/reap-doc-rdoc +7 -0
- data/bin/reap-doc-ri +7 -0
- data/bin/reap-init +69 -0
- data/bin/reap-inspect +7 -0
- data/bin/reap-install +8 -0
- data/bin/reap-install-gem +8 -0
- data/bin/reap-log +7 -0
- data/bin/reap-log-changes +8 -0
- data/bin/reap-log-notes +8 -0
- data/bin/reap-make +7 -0
- data/bin/reap-make-clean +7 -0
- data/bin/reap-make-distclean +7 -0
- data/bin/reap-make-extconf +7 -0
- data/bin/reap-make-static +8 -0
- data/bin/reap-package +8 -0
- data/bin/reap-package-gem +7 -0
- data/bin/reap-package-tgz +7 -0
- data/bin/reap-package-zip +7 -0
- data/bin/reap-prepare +7 -0
- data/bin/reap-publish +7 -0
- data/bin/reap-release +7 -0
- data/bin/reap-scaffold +8 -0
- data/bin/reap-scm-branch +7 -0
- data/bin/reap-scm-tag +7 -0
- data/bin/reap-spec +7 -0
- data/bin/reap-spec-doc +8 -0
- data/bin/reap-stamp +7 -0
- data/bin/reap-stats +7 -0
- data/bin/reap-test +7 -0
- data/bin/reap-test-cross +7 -0
- data/bin/reap-test-load +9 -0
- data/bin/reap-test-solo +7 -0
- data/bin/reap-uninstall +7 -0
- data/bin/reap-uninstall-gem +7 -0
- data/data/reap/base/CHANGES +19 -0
- data/data/reap/base/COPYING +674 -0
- data/data/reap/base/NOTES +12 -0
- data/data/reap/base/README +8 -0
- data/data/reap/build/rake/Rakefile +130 -0
- data/{forge/reference/installers → data/reap/build/rake}/setup.rb +155 -97
- data/data/reap/build/rake-lite/install.rb +79 -0
- data/data/reap/build/tasks/task/rdoc +211 -0
- data/data/reap/{setup.rb → build/tasks/task/setup} +248 -200
- data/data/reap/build/tasks/task/test +38 -0
- data/data/reap/init/meta/project.yaml +21 -0
- data/demo/README +15 -0
- data/demo/lib/foo/foo.rb +7 -0
- data/demo/meta/VERSION +1 -0
- data/demo/meta/project.yaml +21 -0
- data/lib/reap/application.rb +80 -0
- data/lib/reap/default.yaml +77 -0
- data/lib/reap/extensions/array.rb +50 -0
- data/lib/reap/extensions/hash.rb +63 -0
- data/lib/reap/extensions/string.rb +31 -0
- data/lib/reap/extensions.rb +6 -0
- data/lib/reap/iobject.rb +264 -0
- data/lib/reap/manager/announce.rb +193 -0
- data/lib/reap/manager/check.rb +109 -0
- data/lib/reap/manager/clean.rb +58 -0
- data/lib/reap/manager/gem.rb +200 -0
- data/lib/reap/manager/html.rb +69 -0
- data/lib/reap/manager/log.rb +214 -0
- data/lib/reap/manager/make.rb +109 -0
- data/lib/reap/manager/pack.rb +232 -0
- data/lib/reap/manager/publish.rb +72 -0
- data/lib/reap/manager/rdoc.rb +194 -0
- data/lib/reap/manager/release.rb +78 -0
- data/lib/reap/manager/rubyforge.rb +44 -0
- data/lib/reap/manager/scaffold.rb +138 -0
- data/lib/reap/manager/scm.rb +66 -0
- data/lib/reap/manager/site.rb +27 -0
- data/lib/reap/manager/spec.rb +94 -0
- data/lib/reap/manager/stats.rb +145 -0
- data/lib/reap/manager/svn.rb +76 -0
- data/lib/reap/manager/test.rb +389 -0
- data/lib/reap/manager.rb +74 -0
- data/lib/reap/metadata.rb +603 -0
- data/lib/reap/project.rb +165 -0
- data/lib/reap/settings.rb +67 -0
- data/lib/reap/systems/rubyforge.rb +737 -0
- data/lib/reap/systems/subversion.rb +333 -0
- data/lib/reap/utilities/fileutils.rb +304 -0
- data/lib/reap/utilities/netutils.rb +221 -0
- data/lib/reap/utilities/setuputils.rb +124 -0
- data/lib/reap/utilities/shellutils.rb +175 -0
- data/log/Changelog.txt +107 -0
- data/log/FIXME.txt +25 -0
- data/log/TODO.txt +72 -0
- data/meta/VERSION +1 -0
- data/meta/description +4 -0
- data/meta/project.yaml +20 -0
- data/task/man +14 -0
- data/task/rdoc +20 -0
- data/{data/reap/scaffold/standard/setup.rb → task/setup} +248 -200
- metadata +225 -153
- data/ProjectInfo +0 -105
- data/bin/reap +0 -5
- data/bin/rubytest +0 -5
- data/data/reap/install.rb +0 -62
- data/data/reap/scaffold/standard/COPYING +0 -403
- data/data/reap/scaffold/standard/ChangeLog +0 -0
- data/data/reap/scaffold/standard/INSTALL +0 -14
- data/data/reap/scaffold/standard/ProjectInfo +0 -77
- data/data/reap/scaffold/standard/README +0 -3
- data/data/reap/scaffold/standard/Rakefile +0 -10
- data/data/reap/scaffold/standard/TODO +0 -0
- data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
- data/data/reap/scaffold/subversion/trunk/ChangeLog +0 -0
- data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
- data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -76
- data/data/reap/scaffold/subversion/trunk/README +0 -3
- data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
- data/data/reap/scaffold/subversion/trunk/TODO +0 -0
- data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
- data/forge/ProjectInfo +0 -38
- data/forge/ProjectInfo.rb +0 -76
- data/forge/TODO +0 -10
- data/forge/installer.rb +0 -250
- data/forge/reference/Rakefile +0 -124
- data/forge/reference/Rakefile.htm +0 -69
- data/forge/reference/aRakefile +0 -60
- data/forge/reference/compositepublisher.rb +0 -24
- data/forge/reference/ftptools.rb +0 -139
- data/forge/reference/installers/package.rb +0 -629
- data/forge/reference/license-each.rb +0 -85
- data/forge/reference/publisher.rb +0 -75
- data/forge/reference/rubyforge.rb +0 -247
- data/forge/reference/rubyforgepublisher.rb +0 -18
- data/forge/reference/sshpublisher.rb +0 -47
- data/forge/reference/suby-cvs.rb +0 -46
- data/forge/scaffold.rb +0 -126
- data/forge/unit_runner/README +0 -6
- data/forge/unit_runner/commentrunner.rb +0 -62
- data/forge/unit_runner/cunit.rb +0 -17
- data/forge/unit_runner/forkedrunner.rb +0 -91
- data/forge/unit_runner/sample.rb +0 -16
- data/lib/reap/bin/reap.rb +0 -230
- data/lib/reap/bin/rubytest.rb +0 -53
- data/lib/reap/class/announce.rb +0 -220
- data/lib/reap/class/doap.rb +0 -80
- data/lib/reap/class/extest.rb +0 -146
- data/lib/reap/class/filer.rb +0 -62
- data/lib/reap/class/manifest.rb +0 -68
- data/lib/reap/class/package.rb +0 -576
- data/lib/reap/class/publish.rb +0 -152
- data/lib/reap/class/rdoc.rb +0 -123
- data/lib/reap/class/test.rb +0 -264
- data/lib/reap/projectinfo.rb +0 -208
- data/lib/reap/rake.rb +0 -42
- data/lib/reap/reap.rb +0 -89
- data/lib/reap/tasks.rb +0 -756
- data/lib/reap/taskutils.rb +0 -122
- data/note/LATEST +0 -44
- data/note/doap.xml +0 -28
- data/note/history/Rakefile-0.1 +0 -308
- data/sample/ProjectInfo +0 -96
- data/sample/Rakefile +0 -9
- data/sample/Reapfile +0 -11
- data/sample/task/demo.rb +0 -15
- data/setup.rb +0 -1568
- data/web/ProjectInfo.html +0 -75
- data/web/images/grape.jpg +0 -0
- data/web/index.html +0 -312
data/lib/reap/class/publish.rb
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# ___ _ _ _ _
|
3
|
-
# | _ \_ _| |__| (_)__| |_
|
4
|
-
# | _/ || | '_ \ | (_-< ' \
|
5
|
-
# |_| \_,_|_.__/_|_/__/_||_|
|
6
|
-
#
|
7
|
-
#++
|
8
|
-
|
9
|
-
require 'shellwords'
|
10
|
-
|
11
|
-
module Reap
|
12
|
-
|
13
|
-
# = Publish
|
14
|
-
#
|
15
|
-
# Publish documents to hosting service. Three means of
|
16
|
-
# publishing are current supported, ftp uploading, scp,
|
17
|
-
# and web convenience option that recognizes particular
|
18
|
-
# hosts (only RubyForge is currently supported).
|
19
|
-
#
|
20
|
-
# type Type of publishing, 'web', 'scp' or 'ftp'.
|
21
|
-
# host Host server, default is 'rubyforge.org'
|
22
|
-
# username Username for host.
|
23
|
-
# dir Directory of files to publish. Or,
|
24
|
-
# copy Files to publish using from and to.
|
25
|
-
# project Project name (used for Rubyforge)
|
26
|
-
#
|
27
|
-
# If the type is 'scp' or 'ftp' you will also need to provide
|
28
|
-
# the root directory parameter.
|
29
|
-
#
|
30
|
-
# root Document root directory at host.
|
31
|
-
#
|
32
|
-
# The dir parameter allows you to simply specify a local
|
33
|
-
# directory, the contents of which will be published to
|
34
|
-
# host's document root location (directory tree intact).
|
35
|
-
#
|
36
|
-
# If you need more control over which files to publish
|
37
|
-
# where, you can use the copy parameter instead. Provide
|
38
|
-
# an array of pattern strings in the form of "{from} {to}".
|
39
|
-
# If the desitination is the host's document root you do
|
40
|
-
# not need to specify the {to} part. For example:
|
41
|
-
#
|
42
|
-
# copy: [ 'web/*', 'doc/api/* doc/api' ]
|
43
|
-
#
|
44
|
-
# The first copies the files under your project's web directory
|
45
|
-
# to the host's document root. The second copies your projects
|
46
|
-
# doc/api files to the doc/api location on the host.
|
47
|
-
#
|
48
|
-
# When using the 'scp' type the internal template used for
|
49
|
-
# the outbound destination is 'username@host:root/'.
|
50
|
-
|
51
|
-
class Publish
|
52
|
-
|
53
|
-
include TaskUtils
|
54
|
-
|
55
|
-
attr_accessor :dir, :type, :host, :root, :project, :username, :copy
|
56
|
-
|
57
|
-
def initialize( pub )
|
58
|
-
@type = 'web'
|
59
|
-
@host = 'rubyforge.org'
|
60
|
-
@root = 'var/www/gforge-projects/'
|
61
|
-
|
62
|
-
super
|
63
|
-
|
64
|
-
@copy ||= [ "#{@dir}/*" ]
|
65
|
-
end
|
66
|
-
|
67
|
-
# Upload files to host.
|
68
|
-
|
69
|
-
def publish( target=nil, copy_from=nil, copy_to=nil )
|
70
|
-
|
71
|
-
return nil if target and target != @target
|
72
|
-
|
73
|
-
# setup
|
74
|
-
if copy_from
|
75
|
-
@copy = [ "#{copy_from} #{copy_to}".strip ]
|
76
|
-
end
|
77
|
-
|
78
|
-
# validate
|
79
|
-
unless @project
|
80
|
-
puts "Project not specified." ; return nil
|
81
|
-
end
|
82
|
-
unless @username
|
83
|
-
puts "Username not specified." ; return nil
|
84
|
-
end
|
85
|
-
|
86
|
-
# publish
|
87
|
-
puts "Reap is passing off publishing work..."
|
88
|
-
|
89
|
-
case @type
|
90
|
-
when 'web', 'www'
|
91
|
-
case @host
|
92
|
-
when 'rubyforge', 'rubyforge.org'
|
93
|
-
@host = "rubyforge.org"
|
94
|
-
@root = "/var/www/gforge-projects/#{@project}"
|
95
|
-
run_scp
|
96
|
-
else
|
97
|
-
puts %{Unrecognized publishing host '#{@host}'. Skipped.}
|
98
|
-
return nil
|
99
|
-
end
|
100
|
-
when 'scp'
|
101
|
-
run_scp
|
102
|
-
when 'ftp'
|
103
|
-
run_ftp
|
104
|
-
else
|
105
|
-
puts %{Unrecognized publishing type '#{@type}'. Skipped.}
|
106
|
-
return nil
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
private
|
112
|
-
|
113
|
-
# Use scp to upload files.
|
114
|
-
#--
|
115
|
-
# SHELL OUT! Need a net/ssh library to fix.
|
116
|
-
#++
|
117
|
-
|
118
|
-
def run_scp
|
119
|
-
@copy.each { |c|
|
120
|
-
from, to = *Shellwords.shellwords(c)
|
121
|
-
to = '' if to.nil?
|
122
|
-
to = to[1..-1] if to[0,1] == '/'
|
123
|
-
cmd = "scp -r #{from} #{@username}@#{@host}:#{@root}/#{to}"
|
124
|
-
sh( cmd )
|
125
|
-
}
|
126
|
-
end
|
127
|
-
|
128
|
-
# Use ftp to upload files.
|
129
|
-
|
130
|
-
def run_ftp
|
131
|
-
require 'net/ftp'
|
132
|
-
return if $PRETEND
|
133
|
-
Net::FTP.open( @host ) { |ftp|
|
134
|
-
ftp.login( @username )
|
135
|
-
ftp.chdir( @root )
|
136
|
-
@copy.each { |c|
|
137
|
-
from, to = *Shellwords.shellwords(c)
|
138
|
-
to = '' if to.nil?
|
139
|
-
to = to[1..-1] if to[0,1] == '/'
|
140
|
-
from.sub('*', '**/*') unless from =~ /\*\*/
|
141
|
-
files = FileList.new( from )
|
142
|
-
files.each { |f|
|
143
|
-
t = File.join( to, f.basename )
|
144
|
-
ftp.putbinaryfile( f, t, 1024 )
|
145
|
-
}
|
146
|
-
}
|
147
|
-
}
|
148
|
-
end
|
149
|
-
|
150
|
-
end
|
151
|
-
|
152
|
-
end #module Reap
|
data/lib/reap/class/rdoc.rb
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# ___ _
|
3
|
-
# | _ \__| |___ __
|
4
|
-
# | / _` / _ \/ _|
|
5
|
-
# |_|_\__,_\___/\__|
|
6
|
-
#
|
7
|
-
#++
|
8
|
-
|
9
|
-
module Reap
|
10
|
-
|
11
|
-
# = RDoc
|
12
|
-
#
|
13
|
-
# This class generates RDoc API documentation from source
|
14
|
-
# comments.
|
15
|
-
#
|
16
|
-
# title Project title to use in RDocs.
|
17
|
-
# dir Directory to store documentation [doc].
|
18
|
-
# main File to use as main page of RDocs.
|
19
|
-
# template Which RDoc template to use.
|
20
|
-
# include Files to include in RDocs.
|
21
|
-
# exclude Files to exclude from those.
|
22
|
-
# options Pass-thru extra options to RDoc command.
|
23
|
-
#
|
24
|
-
|
25
|
-
class RDoc # < Task
|
26
|
-
|
27
|
-
include TaskUtils
|
28
|
-
|
29
|
-
MUST_EXCLUDE = [ 'InstalledFiles', 'CVS/**/*', '_darcs/**/*' ]
|
30
|
-
|
31
|
-
attr_accessor :dir,
|
32
|
-
:main,
|
33
|
-
:title,
|
34
|
-
:template,
|
35
|
-
:include,
|
36
|
-
:exclude,
|
37
|
-
:options
|
38
|
-
|
39
|
-
def initialize( doc )
|
40
|
-
# set default values
|
41
|
-
@dir = 'doc'
|
42
|
-
@main = 'README'
|
43
|
-
#@title ||= master.title
|
44
|
-
@template = 'html' # 'jamis'
|
45
|
-
@include = [ 'A-Z*', 'lib/**/*', 'ext/**/*' ] #, @main ]
|
46
|
-
@exclude = [ 'demo/**/*', 'example/**/*', 'sample/**/*' ]
|
47
|
-
@options = ['--merge', '--all']
|
48
|
-
|
49
|
-
super
|
50
|
-
|
51
|
-
@include = [ @include, @main ].flatten
|
52
|
-
@exclude = [ @exclude ].flatten
|
53
|
-
@options = [ @options ].flatten
|
54
|
-
end
|
55
|
-
|
56
|
-
# Generate RDocs.
|
57
|
-
|
58
|
-
def generate
|
59
|
-
@rdoc_dir = File.expand_path(@dir)
|
60
|
-
generate_rdocs
|
61
|
-
end
|
62
|
-
|
63
|
-
alias_method :call, :generate
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
def generate_rdocs
|
68
|
-
# warn if main file doesn't exist
|
69
|
-
if !File.exists?(@main) or File.directory?(@main)
|
70
|
-
warn "WARNING! Specified RDoc Main file #{@main} not found."
|
71
|
-
@main = nil
|
72
|
-
end
|
73
|
-
|
74
|
-
if FileTest.directory?(@rdoc_dir)
|
75
|
-
q = "Directory '#{@dir}' already exists. Clobber?"
|
76
|
-
#until inp = $stdin.gets[0,1] ; sleep 1 ; end ; puts
|
77
|
-
inp = ask( q, 'yN' )
|
78
|
-
case inp.downcase
|
79
|
-
when 'y', 'yes', 'okay'
|
80
|
-
tell "Removing old directory '#{@rdoc_dir}'..."
|
81
|
-
FileUtils.rm_r(@rdoc_dir) unless $PRETEND
|
82
|
-
else
|
83
|
-
tell "Reap rdoc task canceled."
|
84
|
-
return nil
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
#rdoc_target = "#{@rdoc_dir}/index.html"
|
89
|
-
|
90
|
-
exc = []
|
91
|
-
(@exclude + MUST_EXCLUDE).each{ |e|
|
92
|
-
exc << e
|
93
|
-
exc |= Dir.glob(e+'/**/*')
|
94
|
-
}
|
95
|
-
|
96
|
-
inc = Dir.glob('[A-Z]*')
|
97
|
-
@include.each{ |i| inc |= Dir.glob(i) }
|
98
|
-
inc -= exc
|
99
|
-
|
100
|
-
inc = inc.select{ |f| File.file?(f) }
|
101
|
-
|
102
|
-
rdoc_files = inc
|
103
|
-
rdoc_files = '"' << rdoc_files.join('" "') << '"'
|
104
|
-
|
105
|
-
# build options string
|
106
|
-
build = []
|
107
|
-
build += @options
|
108
|
-
build << "--main '#{@main}'" if @main
|
109
|
-
build << "--title '#{@title}'" if @title
|
110
|
-
build << "-T '#{@template}'" if @template
|
111
|
-
rdoc_opts = build.join(' ')
|
112
|
-
|
113
|
-
#--
|
114
|
-
# SHELL OUT! Can RDoc be called from code?
|
115
|
-
#++
|
116
|
-
|
117
|
-
tell "Reap is shelling work out to RDoc..."
|
118
|
-
sh %{rdoc -o #{@rdoc_dir} #{rdoc_opts} #{rdoc_files}}
|
119
|
-
end
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
end #module Reap
|
data/lib/reap/class/test.rb
DELETED
@@ -1,264 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# _____ _
|
3
|
-
# |_ _|__ __| |_
|
4
|
-
# | |/ -_|_-< _|
|
5
|
-
# |_|\___/__/\__|
|
6
|
-
#
|
7
|
-
#++
|
8
|
-
|
9
|
-
#require 'test/unit'
|
10
|
-
require 'test/unit/ui/testrunnermediator'
|
11
|
-
require 'facet/string/tabto'
|
12
|
-
require 'facet/progressbar'
|
13
|
-
|
14
|
-
::Test::Unit.run = true # don't run auto tests
|
15
|
-
|
16
|
-
module Reap
|
17
|
-
|
18
|
-
# == Test
|
19
|
-
#
|
20
|
-
# The Reap test class runs each test in it's own
|
21
|
-
# proccess, making for a more pure test facility.
|
22
|
-
# Reap runs each test in a separate proccess to aviod
|
23
|
-
# potential conflicts between scripts.
|
24
|
-
#
|
25
|
-
# files Test files (eg. test/tc_**/*.rb)
|
26
|
-
# Defaults to typcial selection.
|
27
|
-
#
|
28
|
-
# libs List of lookup directories to include in
|
29
|
-
# load path. './lib' is always included.
|
30
|
-
#
|
31
|
-
# live Flag to quickly deactive use of local libs.
|
32
|
-
# Test against installed files instead.
|
33
|
-
#
|
34
|
-
# requires List of any files to pre-require.
|
35
|
-
#
|
36
|
-
# NOTE This works well enough but it is a tad delicate.
|
37
|
-
# It actually marshals test results across stdout->stdin
|
38
|
-
# shell pipe. One consequence of this is that you can't
|
39
|
-
# send debug info to stdout in your tests (including #p and #puts).
|
40
|
-
|
41
|
-
class Test
|
42
|
-
|
43
|
-
include TaskUtils
|
44
|
-
|
45
|
-
attr_accessor :files, :requires, :live, :libs
|
46
|
-
|
47
|
-
def initialize( tst )
|
48
|
-
@files = [ 'test/*/**/*.rb', 'test/**/tc*.rb', 'test/**/test*.rb', 'test/**/*test.rb' ]
|
49
|
-
@requires = []
|
50
|
-
@live = false
|
51
|
-
@libs = [] #['./lib']
|
52
|
-
|
53
|
-
super
|
54
|
-
end
|
55
|
-
|
56
|
-
# Start testing.
|
57
|
-
|
58
|
-
def test
|
59
|
-
run_tests
|
60
|
-
end
|
61
|
-
|
62
|
-
alias_method :call, :test
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
# Run each test.
|
67
|
-
|
68
|
-
def run_tests
|
69
|
-
# interal use
|
70
|
-
@results = TestResults.new
|
71
|
-
@errors = []
|
72
|
-
@failures = []
|
73
|
-
|
74
|
-
# Get test files
|
75
|
-
test_libs = @libs.join(':')
|
76
|
-
test_files = FileList.new
|
77
|
-
test_files.include(*@files)
|
78
|
-
test_files.uniq!
|
79
|
-
|
80
|
-
if test_files.empty?
|
81
|
-
tell "No test files found."
|
82
|
-
return
|
83
|
-
end
|
84
|
-
|
85
|
-
#tell "Reap is passing off work to Ruby's Test Suite..."
|
86
|
-
|
87
|
-
pbar = Console::ProgressBar.new( 'Testing', test_files.size )
|
88
|
-
|
89
|
-
# Run tests
|
90
|
-
# (why arn't these unique to begin with?)
|
91
|
-
test_files.each do |test_file|
|
92
|
-
pbar.inc
|
93
|
-
#$stdout << '.'; $stdout.flush
|
94
|
-
|
95
|
-
if ! File.file?( test_file )
|
96
|
-
r = nil
|
97
|
-
else
|
98
|
-
r = fork_test( test_file )
|
99
|
-
end
|
100
|
-
unless r.passed?
|
101
|
-
@errors << r.instance_variable_get('@errors')
|
102
|
-
@failures << r.instance_variable_get('@failures')
|
103
|
-
end
|
104
|
-
@results << r
|
105
|
-
|
106
|
-
#ruby %{-r"test/unit" "#{f}"}
|
107
|
-
end
|
108
|
-
|
109
|
-
pbar.finish
|
110
|
-
|
111
|
-
# Don't know why empty arrays get in them yet, but...
|
112
|
-
@failures.reject! { |e| e == [] }
|
113
|
-
@errors.reject! { |e| e == [] }
|
114
|
-
|
115
|
-
# Display failures
|
116
|
-
puts
|
117
|
-
puts %{FAILURES:#{@failures.empty? ? ' []' : ''}}
|
118
|
-
@failures.reverse.each { |fails|
|
119
|
-
fails.reverse.each { |failure|
|
120
|
-
puts
|
121
|
-
puts %{ - test : #{failure.test_name}}
|
122
|
-
puts %{ location : #{failure.location}}
|
123
|
-
if failure.message.index("\n")
|
124
|
-
puts %{ message : >}
|
125
|
-
puts failure.message.tabto(6)
|
126
|
-
else
|
127
|
-
puts %{ message : #{failure.message}}
|
128
|
-
end
|
129
|
-
}
|
130
|
-
}
|
131
|
-
|
132
|
-
# Display errors
|
133
|
-
puts
|
134
|
-
puts %{ERRORS:#{@errors.empty? ? ' []' : ''}}
|
135
|
-
@errors.reverse.each { |errs|
|
136
|
-
errs.reverse.each { |err|
|
137
|
-
puts
|
138
|
-
puts %{ - test : #{err.test_name}}
|
139
|
-
puts %{ message : #{err.exception.message}}
|
140
|
-
puts %{ backtrace :}
|
141
|
-
err.exception.backtrace[0...-1].each { |bt| puts %Q{ - #{bt}} }
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
# Display final results
|
146
|
-
puts
|
147
|
-
puts @results
|
148
|
-
puts
|
149
|
-
|
150
|
-
# old way (don't work right)
|
151
|
-
#puts %Q{ ruby %{-I#{test_libs} -e0 -r"test/unit" \\\n#{test_reqs}#{test_opts}} } if $DEBUG
|
152
|
-
#ruby %{-I#{test_libs} -e0 -r"test/unit" \\\n#{test_reqs}#{test_opts}}
|
153
|
-
#ruby %{-e0 -r"test/unit" \\\n#{test_reqs}#{test_opts}}
|
154
|
-
end
|
155
|
-
|
156
|
-
private
|
157
|
-
|
158
|
-
# Runs a test.
|
159
|
-
#
|
160
|
-
# Currently send program output to null device.
|
161
|
-
# Could send to a logger in future version.
|
162
|
-
|
163
|
-
def fork_test( testfile )
|
164
|
-
src = ''
|
165
|
-
|
166
|
-
unless @live
|
167
|
-
l = File.join( Dir.pwd, 'lib' )
|
168
|
-
if File.directory?( l )
|
169
|
-
src << %{$:.unshift('#{l}')\n}
|
170
|
-
end
|
171
|
-
@libs.each { |r| src << %{$:.unshift('#{r}')\n} }
|
172
|
-
end
|
173
|
-
|
174
|
-
src << %{
|
175
|
-
#require 'test/unit'
|
176
|
-
require 'test/unit/collector'
|
177
|
-
require 'test/unit/collector/objectspace'
|
178
|
-
require 'test/unit/ui/testrunnermediator'
|
179
|
-
}
|
180
|
-
|
181
|
-
@requires.each do |fix|
|
182
|
-
src << %Q{
|
183
|
-
require '#{fix}'
|
184
|
-
}
|
185
|
-
end
|
186
|
-
|
187
|
-
src << %{
|
188
|
-
output = STDOUT.dup
|
189
|
-
STDOUT.reopen( PLATFORM =~ /mswin/ ? "NUL" : "/dev/null" )
|
190
|
-
|
191
|
-
load('#{testfile}')
|
192
|
-
tests = Test::Unit::Collector::ObjectSpace.new.collect
|
193
|
-
runner = Test::Unit::UI::TestRunnerMediator.new( tests )
|
194
|
-
result = runner.run_suite
|
195
|
-
|
196
|
-
begin
|
197
|
-
marshalled = Marshal.dump(result)
|
198
|
-
rescue TypeError => e
|
199
|
-
$stderr << "MARSHAL ERROR\n"
|
200
|
-
$stderr << "TEST: #{testfile}\n"
|
201
|
-
$stderr << "DATA:" << result.inspect
|
202
|
-
exit -1
|
203
|
-
end
|
204
|
-
output << marshalled
|
205
|
-
|
206
|
-
STDOUT.reopen(output)
|
207
|
-
output.close
|
208
|
-
}
|
209
|
-
|
210
|
-
result = IO.popen("ruby","w+") do |ruby|
|
211
|
-
ruby.puts src
|
212
|
-
ruby.close_write
|
213
|
-
ruby.read
|
214
|
-
end
|
215
|
-
|
216
|
-
p testfile if $VERBOSE
|
217
|
-
|
218
|
-
begin
|
219
|
-
marsh = Marshal.load(result)
|
220
|
-
rescue ArgumentError
|
221
|
-
$stderr << "\nCannot load marshalled test data.\n"
|
222
|
-
$stderr << result << "\n"
|
223
|
-
exit -1
|
224
|
-
end
|
225
|
-
|
226
|
-
return marsh
|
227
|
-
end
|
228
|
-
|
229
|
-
#
|
230
|
-
# Support class for collecting test results.
|
231
|
-
#
|
232
|
-
|
233
|
-
class TestResults
|
234
|
-
|
235
|
-
attr_reader :assertion_count, :run_count, :failure_count, :error_count
|
236
|
-
|
237
|
-
def initialize
|
238
|
-
@assertion_count = 0
|
239
|
-
@run_count = 0
|
240
|
-
@failure_count = 0
|
241
|
-
@error_count = 0
|
242
|
-
end
|
243
|
-
|
244
|
-
def <<( result )
|
245
|
-
@assertion_count += result.assertion_count
|
246
|
-
@run_count += result.run_count
|
247
|
-
@failure_count += result.failure_count
|
248
|
-
@error_count += result.error_count
|
249
|
-
end
|
250
|
-
|
251
|
-
def to_s
|
252
|
-
s = %{SUMMARY:\n\n}
|
253
|
-
s << %{ tests : #{@run_count}\n}
|
254
|
-
s << %{ assertions : #{@assertion_count}\n}
|
255
|
-
s << %{ failures : #{@failure_count}\n}
|
256
|
-
s << %{ errors : #{@error_count}\n}
|
257
|
-
s
|
258
|
-
end
|
259
|
-
|
260
|
-
end
|
261
|
-
|
262
|
-
end
|
263
|
-
|
264
|
-
end #module Reap
|