reap 6.0.2 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. data/CHANGES +6 -0
  2. data/COPYING +666 -395
  3. data/MANIFEST +139 -0
  4. data/NOTES +12 -0
  5. data/README +19 -163
  6. data/bin/reap-announce +7 -0
  7. data/bin/reap-check-load +8 -0
  8. data/bin/reap-check-syntax +7 -0
  9. data/bin/reap-clean +7 -0
  10. data/bin/reap-clobber +7 -0
  11. data/bin/reap-doc +7 -0
  12. data/bin/reap-doc-rdoc +7 -0
  13. data/bin/reap-doc-ri +7 -0
  14. data/bin/reap-init +69 -0
  15. data/bin/reap-inspect +7 -0
  16. data/bin/reap-install +8 -0
  17. data/bin/reap-install-gem +8 -0
  18. data/bin/reap-log +7 -0
  19. data/bin/reap-log-changes +8 -0
  20. data/bin/reap-log-notes +8 -0
  21. data/bin/reap-make +7 -0
  22. data/bin/reap-make-clean +7 -0
  23. data/bin/reap-make-distclean +7 -0
  24. data/bin/reap-make-extconf +7 -0
  25. data/bin/reap-make-static +8 -0
  26. data/bin/reap-package +8 -0
  27. data/bin/reap-package-gem +7 -0
  28. data/bin/reap-package-tgz +7 -0
  29. data/bin/reap-package-zip +7 -0
  30. data/bin/reap-prepare +7 -0
  31. data/bin/reap-publish +7 -0
  32. data/bin/reap-release +7 -0
  33. data/bin/reap-scaffold +8 -0
  34. data/bin/reap-scm-branch +7 -0
  35. data/bin/reap-scm-tag +7 -0
  36. data/bin/reap-spec +7 -0
  37. data/bin/reap-spec-doc +8 -0
  38. data/bin/reap-stamp +7 -0
  39. data/bin/reap-stats +7 -0
  40. data/bin/reap-test +7 -0
  41. data/bin/reap-test-cross +7 -0
  42. data/bin/reap-test-load +9 -0
  43. data/bin/reap-test-solo +7 -0
  44. data/bin/reap-uninstall +7 -0
  45. data/bin/reap-uninstall-gem +7 -0
  46. data/data/reap/base/CHANGES +19 -0
  47. data/data/reap/base/COPYING +674 -0
  48. data/data/reap/base/NOTES +12 -0
  49. data/data/reap/base/README +8 -0
  50. data/data/reap/build/rake/Rakefile +130 -0
  51. data/{forge/reference/installers → data/reap/build/rake}/setup.rb +155 -97
  52. data/data/reap/build/rake-lite/install.rb +79 -0
  53. data/data/reap/build/tasks/task/rdoc +211 -0
  54. data/data/reap/{setup.rb → build/tasks/task/setup} +248 -200
  55. data/data/reap/build/tasks/task/test +38 -0
  56. data/data/reap/init/meta/project.yaml +21 -0
  57. data/demo/README +15 -0
  58. data/demo/lib/foo/foo.rb +7 -0
  59. data/demo/meta/VERSION +1 -0
  60. data/demo/meta/project.yaml +21 -0
  61. data/lib/reap/application.rb +80 -0
  62. data/lib/reap/default.yaml +77 -0
  63. data/lib/reap/extensions/array.rb +50 -0
  64. data/lib/reap/extensions/hash.rb +63 -0
  65. data/lib/reap/extensions/string.rb +31 -0
  66. data/lib/reap/extensions.rb +6 -0
  67. data/lib/reap/iobject.rb +264 -0
  68. data/lib/reap/manager/announce.rb +193 -0
  69. data/lib/reap/manager/check.rb +109 -0
  70. data/lib/reap/manager/clean.rb +58 -0
  71. data/lib/reap/manager/gem.rb +200 -0
  72. data/lib/reap/manager/html.rb +69 -0
  73. data/lib/reap/manager/log.rb +214 -0
  74. data/lib/reap/manager/make.rb +109 -0
  75. data/lib/reap/manager/pack.rb +232 -0
  76. data/lib/reap/manager/publish.rb +72 -0
  77. data/lib/reap/manager/rdoc.rb +194 -0
  78. data/lib/reap/manager/release.rb +78 -0
  79. data/lib/reap/manager/rubyforge.rb +44 -0
  80. data/lib/reap/manager/scaffold.rb +138 -0
  81. data/lib/reap/manager/scm.rb +66 -0
  82. data/lib/reap/manager/site.rb +27 -0
  83. data/lib/reap/manager/spec.rb +94 -0
  84. data/lib/reap/manager/stats.rb +145 -0
  85. data/lib/reap/manager/svn.rb +76 -0
  86. data/lib/reap/manager/test.rb +389 -0
  87. data/lib/reap/manager.rb +74 -0
  88. data/lib/reap/metadata.rb +603 -0
  89. data/lib/reap/project.rb +165 -0
  90. data/lib/reap/settings.rb +67 -0
  91. data/lib/reap/systems/rubyforge.rb +737 -0
  92. data/lib/reap/systems/subversion.rb +333 -0
  93. data/lib/reap/utilities/fileutils.rb +304 -0
  94. data/lib/reap/utilities/netutils.rb +221 -0
  95. data/lib/reap/utilities/setuputils.rb +124 -0
  96. data/lib/reap/utilities/shellutils.rb +175 -0
  97. data/log/Changelog.txt +107 -0
  98. data/log/FIXME.txt +25 -0
  99. data/log/TODO.txt +72 -0
  100. data/meta/VERSION +1 -0
  101. data/meta/description +4 -0
  102. data/meta/project.yaml +20 -0
  103. data/task/man +14 -0
  104. data/task/rdoc +20 -0
  105. data/{data/reap/scaffold/standard/setup.rb → task/setup} +248 -200
  106. metadata +225 -153
  107. data/ProjectInfo +0 -105
  108. data/bin/reap +0 -5
  109. data/bin/rubytest +0 -5
  110. data/data/reap/install.rb +0 -62
  111. data/data/reap/scaffold/standard/COPYING +0 -403
  112. data/data/reap/scaffold/standard/ChangeLog +0 -0
  113. data/data/reap/scaffold/standard/INSTALL +0 -14
  114. data/data/reap/scaffold/standard/ProjectInfo +0 -77
  115. data/data/reap/scaffold/standard/README +0 -3
  116. data/data/reap/scaffold/standard/Rakefile +0 -10
  117. data/data/reap/scaffold/standard/TODO +0 -0
  118. data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
  119. data/data/reap/scaffold/subversion/trunk/ChangeLog +0 -0
  120. data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
  121. data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -76
  122. data/data/reap/scaffold/subversion/trunk/README +0 -3
  123. data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
  124. data/data/reap/scaffold/subversion/trunk/TODO +0 -0
  125. data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
  126. data/forge/ProjectInfo +0 -38
  127. data/forge/ProjectInfo.rb +0 -76
  128. data/forge/TODO +0 -10
  129. data/forge/installer.rb +0 -250
  130. data/forge/reference/Rakefile +0 -124
  131. data/forge/reference/Rakefile.htm +0 -69
  132. data/forge/reference/aRakefile +0 -60
  133. data/forge/reference/compositepublisher.rb +0 -24
  134. data/forge/reference/ftptools.rb +0 -139
  135. data/forge/reference/installers/package.rb +0 -629
  136. data/forge/reference/license-each.rb +0 -85
  137. data/forge/reference/publisher.rb +0 -75
  138. data/forge/reference/rubyforge.rb +0 -247
  139. data/forge/reference/rubyforgepublisher.rb +0 -18
  140. data/forge/reference/sshpublisher.rb +0 -47
  141. data/forge/reference/suby-cvs.rb +0 -46
  142. data/forge/scaffold.rb +0 -126
  143. data/forge/unit_runner/README +0 -6
  144. data/forge/unit_runner/commentrunner.rb +0 -62
  145. data/forge/unit_runner/cunit.rb +0 -17
  146. data/forge/unit_runner/forkedrunner.rb +0 -91
  147. data/forge/unit_runner/sample.rb +0 -16
  148. data/lib/reap/bin/reap.rb +0 -230
  149. data/lib/reap/bin/rubytest.rb +0 -53
  150. data/lib/reap/class/announce.rb +0 -220
  151. data/lib/reap/class/doap.rb +0 -80
  152. data/lib/reap/class/extest.rb +0 -146
  153. data/lib/reap/class/filer.rb +0 -62
  154. data/lib/reap/class/manifest.rb +0 -68
  155. data/lib/reap/class/package.rb +0 -576
  156. data/lib/reap/class/publish.rb +0 -152
  157. data/lib/reap/class/rdoc.rb +0 -123
  158. data/lib/reap/class/test.rb +0 -264
  159. data/lib/reap/projectinfo.rb +0 -208
  160. data/lib/reap/rake.rb +0 -42
  161. data/lib/reap/reap.rb +0 -89
  162. data/lib/reap/tasks.rb +0 -756
  163. data/lib/reap/taskutils.rb +0 -122
  164. data/note/LATEST +0 -44
  165. data/note/doap.xml +0 -28
  166. data/note/history/Rakefile-0.1 +0 -308
  167. data/sample/ProjectInfo +0 -96
  168. data/sample/Rakefile +0 -9
  169. data/sample/Reapfile +0 -11
  170. data/sample/task/demo.rb +0 -15
  171. data/setup.rb +0 -1568
  172. data/web/ProjectInfo.html +0 -75
  173. data/web/images/grape.jpg +0 -0
  174. data/web/index.html +0 -312
@@ -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
@@ -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
@@ -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