rdx 0.9.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rdx +20 -0
- data/README +19 -0
- data/bin/rdx +7 -0
- data/examples/minimal/.rdx +8 -0
- data/examples/minimal/README +10 -0
- data/examples/minimal/lib/other_conventions.rb +64 -0
- data/examples/minimal/lib/the_basics.rb +94 -0
- data/examples/minimal/lib/using_directives.rb +66 -0
- data/examples/minimal/rakefile +27 -0
- data/examples/ruby-2.0.0-p0/README +7 -0
- data/examples/ruby-2.0.0-p0/install/core/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/core/README +19 -0
- data/examples/ruby-2.0.0-p0/install/core/Rakefile +61 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/array.c.diff +166 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/bignum.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/class.c.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/compar.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/complex.c.diff +301 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/cont.c.diff +65 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/dir.c.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/re.rdoc.diff +328 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/security.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/standard_library.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/assignment.rdoc.diff +160 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/calling_methods.rdoc.diff +130 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/control_expressions.rdoc.diff +254 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/exceptions.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/literals.rdoc.diff +54 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/methods.rdoc.diff +157 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/miscellaneous.rdoc.diff +91 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/modules_and_classes.rdoc.diff +161 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/precedence.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/refinements.rdoc.diff +146 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/encoding.c.diff +276 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enum.c.diff +281 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enumerator.c.diff +479 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/error.c.diff +143 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval.c.diff +47 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval_jump.c.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/file.c.diff +752 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/gc.c.diff +195 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/hash.c.diff +84 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/iseq.c.diff +354 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/load.c.diff +53 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/marshal.c.diff +98 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/math.c.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/numeric.c.diff +103 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/object.c.diff +295 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/pack.c.diff +18 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/parse.y.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/proc.c.diff +155 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/random.c.diff +126 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/range.c.diff +49 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/rational.c.diff +312 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/re.c.diff +207 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/ruby.c.diff +21 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/signal.c.diff +67 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/sprintf.c.diff +29 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/string.c.diff +73 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/struct.c.diff +20 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/time.c.diff +691 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/transcode.c.diff +435 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/variable.c.diff +62 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_backtrace.c.diff +164 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_eval.c.diff +99 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_method.c.diff +17 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_trace.c.diff +393 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/README +19 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/Rakefile +53 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/abbrev.rb.diff +77 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/base64.rb.diff +42 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/benchmark.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/cmath.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/forwardable.rb.diff +150 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/mathn.rb.diff +58 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/matrix.rb.diff +657 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/observer.rb.diff +31 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/optparse.rb.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/ostruct.rb.diff +78 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/prime.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/pstore.rb.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/scanf.rb.diff +100 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/securerandom.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/set.rb.diff +637 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/shellwords.rb.diff +66 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/singleton.rb.diff +37 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tempfile.rb.diff +104 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/thread.rb.diff +38 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/time.rb.diff +140 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tmpdir.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri.rb.diff +39 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri/common.rb.diff +237 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/weakref.rb.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/yaml/store.rb.diff +27 -0
- data/examples/ruby-2.0.0-p0/rakefile +165 -0
- data/lib/rdx.rb +331 -0
- data/lib/rdx/assertions.rb +484 -0
- data/lib/rdx/binding.rb +151 -0
- data/lib/rdx/code_object.rb +598 -0
- data/lib/rdx/comment.rb +338 -0
- data/lib/rdx/convention.rb +1174 -0
- data/lib/rdx/directive.rb +1432 -0
- data/lib/rdx/example.rb +679 -0
- data/lib/rdx/generator.rb +112 -0
- data/lib/rdx/generator/rdoc.rb +1006 -0
- data/lib/rdx/options.rb +359 -0
- data/lib/rdx/plain_text.rb +65 -0
- data/lib/rdx/reporter.rb +421 -0
- data/lib/rdx/ruby_lex.rb +324 -0
- data/lib/rdx/runner.rb +309 -0
- data/lib/rdx/source_file.rb +94 -0
- data/lib/rdx/specification.rb +194 -0
- data/lib/rdx/statement.rb +248 -0
- data/lib/rdx/store.rb +119 -0
- data/lib/rdx/task.rb +361 -0
- data/lib/rdx/text.rb +688 -0
- data/lib/rdx/version.rb +15 -0
- data/rakefile +64 -0
- metadata +203 -0
data/lib/rdx/store.rb
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
|
2
|
+
module RDX
|
3
|
+
|
4
|
+
#
|
5
|
+
# Stores RDX data and handles acccess to it.
|
6
|
+
#
|
7
|
+
class Store
|
8
|
+
|
9
|
+
attr_reader :runner
|
10
|
+
|
11
|
+
attr_reader :source_files
|
12
|
+
|
13
|
+
attr_reader :reportables
|
14
|
+
|
15
|
+
attr_reader :eval_convention
|
16
|
+
|
17
|
+
def initialize spec
|
18
|
+
init_conventions spec
|
19
|
+
init_directives spec
|
20
|
+
@source_files = []
|
21
|
+
@source_files_hash = Hash.new do |hsh,fname|
|
22
|
+
src = SourceFile.new(fname)
|
23
|
+
@source_files << src
|
24
|
+
hsh[fname] = src
|
25
|
+
end
|
26
|
+
@tests = []
|
27
|
+
@reportables = nil
|
28
|
+
end
|
29
|
+
|
30
|
+
def init_conventions spec
|
31
|
+
@conventions = spec.conventions
|
32
|
+
@findable_conventions = @conventions.select(&:process_comment)
|
33
|
+
@eval_convention = @conventions.find{ |conv| conv.name == :eval } or
|
34
|
+
warn("Missing `eval' convention, using original one") && Convention[:eval]
|
35
|
+
end
|
36
|
+
|
37
|
+
def init_directives spec
|
38
|
+
@directives = spec.directives
|
39
|
+
@implicit_directives = @directives.values.uniq.select(&:has_implicit?)
|
40
|
+
end
|
41
|
+
|
42
|
+
def find_source_file file_name
|
43
|
+
@source_files_hash[file_name]
|
44
|
+
end
|
45
|
+
|
46
|
+
def tests_no
|
47
|
+
@tests.size
|
48
|
+
end
|
49
|
+
|
50
|
+
def add_test runnable
|
51
|
+
@tests << runnable if runnable.prepare_for_testing
|
52
|
+
end
|
53
|
+
|
54
|
+
def passed?
|
55
|
+
!@tests.empty? and @tests.all?(&:passed?)
|
56
|
+
end
|
57
|
+
|
58
|
+
def tests_before_require
|
59
|
+
@tests.select(&:before_require)
|
60
|
+
end
|
61
|
+
|
62
|
+
def tests_after_require
|
63
|
+
@tests.reject(&:before_require)
|
64
|
+
end
|
65
|
+
|
66
|
+
def dispose_bindings
|
67
|
+
@tests.each do |test|
|
68
|
+
test.binding = nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def directive name
|
73
|
+
name = Directive.validate_name name
|
74
|
+
@directives[name] or
|
75
|
+
raise Error, "Undefined directive `#{name}'"
|
76
|
+
end
|
77
|
+
|
78
|
+
def build seed
|
79
|
+
return if @source_files_hash.nil?
|
80
|
+
@source_files_hash = nil
|
81
|
+
source_files.freeze.each(&:build)
|
82
|
+
srand seed
|
83
|
+
@tests.shuffle!
|
84
|
+
@test.freeze
|
85
|
+
end
|
86
|
+
|
87
|
+
def register_reportable reportable, runnable
|
88
|
+
@reportables_hash[runnable.comment] << reportable
|
89
|
+
end
|
90
|
+
|
91
|
+
def collect_reportables
|
92
|
+
return @reportables if @reportables
|
93
|
+
@reportables = source_files.sort.flat_map(&:collect_reportables)
|
94
|
+
end
|
95
|
+
|
96
|
+
def find_convention_in text
|
97
|
+
return nil unless text =~ /\S/
|
98
|
+
result = nil
|
99
|
+
conv = @findable_conventions.find{ |conv| result = conv.call_process_comment(nil,text) }
|
100
|
+
return nil unless conv
|
101
|
+
yield(conv,result) if block_given?
|
102
|
+
return [conv, result]
|
103
|
+
end
|
104
|
+
|
105
|
+
def scan_for_implicit_directives type, text
|
106
|
+
implicit_directives = []
|
107
|
+
@implicit_directives.each do |directive|
|
108
|
+
directive.find_implicit_in(type,text) do |param,l_no|
|
109
|
+
dir_str = directive.name
|
110
|
+
dir_str = Directive.join dir_str, param if param
|
111
|
+
implicit_directives << [:directive,dir_str,l_no]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
return implicit_directives.sort_by!.with_index{ |(_,_,l_no),i| [l_no,i] }
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
data/lib/rdx/task.rb
ADDED
@@ -0,0 +1,361 @@
|
|
1
|
+
|
2
|
+
require 'rdx'
|
3
|
+
require 'rake/tasklib'
|
4
|
+
|
5
|
+
|
6
|
+
class Module # :nodoc:
|
7
|
+
|
8
|
+
alias const_missing_full_bt const_missing
|
9
|
+
private :const_missing_full_bt
|
10
|
+
# Remove Rake's frame
|
11
|
+
def const_missing(const_name)
|
12
|
+
const_missing_full_bt(const_name)
|
13
|
+
rescue NameError => exc
|
14
|
+
bt = exc.backtrace
|
15
|
+
bt.shift if bt.first.include?('/rake/ext/module.rb:')
|
16
|
+
bt.shift if bt.first.start_with?(__FILE__)
|
17
|
+
raise exc
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
module RDX
|
24
|
+
|
25
|
+
#
|
26
|
+
# Helps the building of command line options for running RDX.
|
27
|
+
#
|
28
|
+
class Task < Rake::TaskLib
|
29
|
+
|
30
|
+
# :stopdoc:
|
31
|
+
|
32
|
+
@contents = []
|
33
|
+
|
34
|
+
def self.define_accessor name, &definition
|
35
|
+
attr_accessor name
|
36
|
+
@contents << definition
|
37
|
+
end
|
38
|
+
private_class_method :define_accessor
|
39
|
+
|
40
|
+
def self.apply_defaults_to task
|
41
|
+
finalize_procs = @contents.map do |definition|
|
42
|
+
task.instance_eval(&definition)
|
43
|
+
end
|
44
|
+
task.finalize_with finalize_procs
|
45
|
+
end
|
46
|
+
|
47
|
+
# :startdoc:
|
48
|
+
|
49
|
+
# Name of the taks.
|
50
|
+
attr_accessor :name
|
51
|
+
|
52
|
+
# Description of the task.
|
53
|
+
attr_accessor :description
|
54
|
+
|
55
|
+
# The Rake::FileList containing the files to be processed.
|
56
|
+
attr_accessor :files
|
57
|
+
|
58
|
+
##
|
59
|
+
# :method:
|
60
|
+
# :call-seq:
|
61
|
+
# extra_options
|
62
|
+
# extra_options=array
|
63
|
+
#
|
64
|
+
# The array of additional command line options.
|
65
|
+
#
|
66
|
+
define_accessor :extra_options do
|
67
|
+
@extra_options = []
|
68
|
+
lambda{ |opts| opts.concat extra_options.to_a }
|
69
|
+
end
|
70
|
+
|
71
|
+
##
|
72
|
+
# :method:
|
73
|
+
# :call-seq:
|
74
|
+
# verbose
|
75
|
+
# verbose=val
|
76
|
+
#
|
77
|
+
# Handles Options#verbose.
|
78
|
+
#
|
79
|
+
define_accessor :verbose do
|
80
|
+
@verbose = false
|
81
|
+
lambda{ |opts| opts << '-v' if verbose }
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# :method:
|
86
|
+
# :call-seq:
|
87
|
+
# debug
|
88
|
+
# debug=val
|
89
|
+
#
|
90
|
+
# Handles Options#debug.
|
91
|
+
#
|
92
|
+
define_accessor :debug do
|
93
|
+
@debug = false
|
94
|
+
lambda{ |opts| opts << '-d' if debug }
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# :method:
|
99
|
+
# :call-seq:
|
100
|
+
# dry_run
|
101
|
+
# dry_run=val
|
102
|
+
#
|
103
|
+
# Handles Options#dry_run.
|
104
|
+
#
|
105
|
+
define_accessor :dry_run do
|
106
|
+
@dry_run = false
|
107
|
+
lambda{ |opts| opts << '-y' if dry_run }
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# :method:
|
112
|
+
# :call-seq:
|
113
|
+
# fast
|
114
|
+
# fast=val
|
115
|
+
#
|
116
|
+
# Handles Options#fast.
|
117
|
+
#
|
118
|
+
define_accessor :fast do
|
119
|
+
@fast = false
|
120
|
+
lambda{ |opts| opts << '-f' if fast }
|
121
|
+
end
|
122
|
+
# Will the documentation output be produced?
|
123
|
+
def doc_output
|
124
|
+
not fast
|
125
|
+
end
|
126
|
+
# Enables or disables the generation of documentation output.
|
127
|
+
def doc_output= val
|
128
|
+
self.fast = !val
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# :method:
|
133
|
+
# :call-seq:
|
134
|
+
# lib_dirs
|
135
|
+
# lib_dirs=array
|
136
|
+
#
|
137
|
+
# Handles Options#lib_dirs.
|
138
|
+
#
|
139
|
+
# Using Rake this is option is ruby-centred: if exists a +lib+ directory it will be added
|
140
|
+
# to this list.
|
141
|
+
#
|
142
|
+
define_accessor :lib_dirs do
|
143
|
+
@lib_dirs = []
|
144
|
+
@lib_dirs << 'lib' if File.directory?('lib')
|
145
|
+
lambda do |opts|
|
146
|
+
opts << '-I' << lib_dirs.shift.to_s until lib_dirs.empty? if lib_dirs
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
##
|
151
|
+
# :method:
|
152
|
+
# :call-seq:
|
153
|
+
# libs
|
154
|
+
# libs=array
|
155
|
+
#
|
156
|
+
# Handles Options#libs.
|
157
|
+
#
|
158
|
+
define_accessor :libs do
|
159
|
+
@libs = nil
|
160
|
+
lambda do |opts|
|
161
|
+
opts << '-r' << libs.shift.to_s until libs.empty? if libs
|
162
|
+
end
|
163
|
+
end
|
164
|
+
# Requires the given _libs_ for the tests.
|
165
|
+
def require_libs *libs
|
166
|
+
self.libs ||= []
|
167
|
+
self.libs.concat libs.map(&:to_str)
|
168
|
+
end
|
169
|
+
alias require_lib require_libs
|
170
|
+
|
171
|
+
##
|
172
|
+
# :method:
|
173
|
+
# :call-seq:
|
174
|
+
# seed
|
175
|
+
# seed=int
|
176
|
+
#
|
177
|
+
# Handles Options#seed.
|
178
|
+
#
|
179
|
+
define_accessor :seed do
|
180
|
+
@seed = nil
|
181
|
+
lambda{ |opts| opts << '-s' << seed.to_int.to_s if seed }
|
182
|
+
end
|
183
|
+
|
184
|
+
##
|
185
|
+
# :method:
|
186
|
+
# :call-seq:
|
187
|
+
# generator
|
188
|
+
# generator=name
|
189
|
+
#
|
190
|
+
# Handles Options#generator.
|
191
|
+
#
|
192
|
+
# Currently it does nothing because only RDoc is supported as generator.
|
193
|
+
#
|
194
|
+
define_accessor :generator do
|
195
|
+
@generator = nil
|
196
|
+
lambda do |opts|
|
197
|
+
# opts << '-g' << generator if generator
|
198
|
+
end
|
199
|
+
end
|
200
|
+
def generator= generator # :nodoc:
|
201
|
+
# We should require the patch for that generator even if RDX won't run,
|
202
|
+
# to remove its directives, etc...
|
203
|
+
require "rdx/generator/#{generator}"
|
204
|
+
@generator = generator
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# :method:
|
209
|
+
# :call-seq:
|
210
|
+
# generator_options
|
211
|
+
# generator_options=array
|
212
|
+
#
|
213
|
+
# Handles Options#generator_options.
|
214
|
+
#
|
215
|
+
define_accessor :generator_options do
|
216
|
+
@generator_options = []
|
217
|
+
lambda do |opts|
|
218
|
+
opts << '-G' << generator_options.shift until generator_options.empty? if generator_options
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
# Import options and files from the Rake::RDocTask given.
|
223
|
+
def rdoc_task= rdoc_task
|
224
|
+
require 'rdoc/task'
|
225
|
+
raise "Rake::RDocTask expected" unless rdoc_task.is_a?(RDoc::Task)
|
226
|
+
self.generator = 'rdoc'
|
227
|
+
generator_options.concat rdoc_task.option_list
|
228
|
+
files.add rdoc_task.rdoc_files
|
229
|
+
end
|
230
|
+
|
231
|
+
##
|
232
|
+
# :method:
|
233
|
+
# :call-seq:
|
234
|
+
# bash
|
235
|
+
# bash=command
|
236
|
+
#
|
237
|
+
# Handles Options#bash.
|
238
|
+
#
|
239
|
+
define_accessor :bash do
|
240
|
+
@bash = nil
|
241
|
+
lambda do |opts|
|
242
|
+
opts << '--bash' << bash if bash
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
##
|
247
|
+
# :method:
|
248
|
+
# :call-seq:
|
249
|
+
# reporter
|
250
|
+
# reporter=name
|
251
|
+
#
|
252
|
+
# Handles Options#reporter.
|
253
|
+
#
|
254
|
+
define_accessor :reporter do
|
255
|
+
@reporter = nil
|
256
|
+
lambda do |opts|
|
257
|
+
opts << '-R' << reporter if reporter
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
##
|
262
|
+
# :method:
|
263
|
+
# :call-seq:
|
264
|
+
# full_trace
|
265
|
+
# full_trace=val
|
266
|
+
#
|
267
|
+
# Show all reportables (including +Success+) in the report.
|
268
|
+
#
|
269
|
+
define_accessor :full_trace do
|
270
|
+
@full_trace = false
|
271
|
+
lambda do |opts|
|
272
|
+
opts << '-t' if full_trace
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
##
|
277
|
+
# :method:
|
278
|
+
# :call-seq:
|
279
|
+
# show
|
280
|
+
# show=array
|
281
|
+
#
|
282
|
+
# Shows only the listed types of reportables in the report.
|
283
|
+
#
|
284
|
+
define_accessor :show do
|
285
|
+
@show = []
|
286
|
+
lambda do |opts|
|
287
|
+
opts << '--show' << show.shift.to_s until show.empty? if show
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
##
|
292
|
+
# :method:
|
293
|
+
# :call-seq:
|
294
|
+
# show
|
295
|
+
# show=array
|
296
|
+
#
|
297
|
+
# Hides the listed types of reportables in the report.
|
298
|
+
#
|
299
|
+
define_accessor :hide do
|
300
|
+
@hide = []
|
301
|
+
lambda do |opts|
|
302
|
+
opts << '--hide' << hide.shift.to_s until hide.empty? if hide
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
##
|
307
|
+
# :method:
|
308
|
+
# :call-seq:
|
309
|
+
# full_trace
|
310
|
+
# full_trace=val
|
311
|
+
#
|
312
|
+
# Don't show the warnings in the report if set to +false+.
|
313
|
+
#
|
314
|
+
define_accessor :warnings do
|
315
|
+
@warnings = true
|
316
|
+
lambda do |opts|
|
317
|
+
opts << '--no-warnings' unless warnings
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
#
|
322
|
+
# Defines a new RDX rake task with the given _name_.
|
323
|
+
# This instance is yielded to the given block;
|
324
|
+
# its methods allow to build the list of command line options.
|
325
|
+
#
|
326
|
+
def initialize name=:rdx
|
327
|
+
@name = name
|
328
|
+
@description = 'Generate documentation, extract examples and run them as tests'
|
329
|
+
@files = Rake::FileList.new
|
330
|
+
Task.apply_defaults_to self
|
331
|
+
yield self if block_given?
|
332
|
+
define
|
333
|
+
end
|
334
|
+
|
335
|
+
# :stopdoc:
|
336
|
+
|
337
|
+
def finalize_with finalize_procs
|
338
|
+
@finalize_procs = finalize_procs
|
339
|
+
end
|
340
|
+
|
341
|
+
private
|
342
|
+
|
343
|
+
def option_list
|
344
|
+
options = extra_options.dup
|
345
|
+
@finalize_procs.each{ |proc| proc.call(options) }
|
346
|
+
options
|
347
|
+
end
|
348
|
+
|
349
|
+
def define
|
350
|
+
desc description
|
351
|
+
task name do
|
352
|
+
rdx = ARGV.shift
|
353
|
+
argv = option_list + ['--'] + files.to_a
|
354
|
+
$stderr.puts "#{rdx} #{argv.join ' '}" if Rake.application.options.trace
|
355
|
+
RDX.run(argv)
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
end
|
360
|
+
|
361
|
+
end
|