drake 0.8.7.0.2.4 → 0.9.0.0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/CHANGES +77 -9
- data/{CHANGES.drake → CHANGES-drake} +6 -2
- data/MIT-LICENSE +2 -0
- data/{README → README.rdoc} +30 -18
- data/Rakefile +144 -130
- data/Rakefile-drake +67 -0
- data/TODO +1 -1
- data/bin/drake +2 -0
- data/doc/command_line_usage.rdoc +25 -11
- data/doc/glossary.rdoc +2 -2
- data/doc/jamis.rb +2 -2
- data/doc/parallel.rdoc +37 -29
- data/doc/proto_rake.rdoc +22 -22
- data/doc/rake.1.gz +0 -0
- data/doc/rakefile.rdoc +56 -33
- data/doc/rational.rdoc +6 -6
- data/doc/release_notes/rake-0.4.15.rdoc +1 -1
- data/doc/release_notes/rake-0.5.0.rdoc +1 -1
- data/doc/release_notes/rake-0.7.0.rdoc +1 -1
- data/doc/release_notes/rake-0.7.2.rdoc +3 -3
- data/doc/release_notes/rake-0.7.3.rdoc +2 -2
- data/doc/release_notes/rake-0.8.0.rdoc +1 -1
- data/doc/release_notes/rake-0.8.2.rdoc +3 -3
- data/doc/release_notes/rake-0.8.3.rdoc +2 -2
- data/doc/release_notes/rake-0.8.4.rdoc +1 -1
- data/doc/release_notes/rake-0.8.5.rdoc +1 -1
- data/doc/release_notes/rake-0.8.6.rdoc +1 -1
- data/doc/release_notes/rake-0.8.7.rdoc +1 -1
- data/doc/release_notes/rake-0.9.0.rdoc +112 -0
- data/install.rb +14 -12
- data/lib/rake.rb +31 -2527
- data/lib/rake/alt_system.rb +7 -6
- data/lib/rake/application.rb +626 -0
- data/lib/rake/classic_namespace.rb +1 -0
- data/lib/rake/clean.rb +2 -4
- data/lib/rake/cloneable.rb +25 -0
- data/lib/rake/contrib/compositepublisher.rb +2 -5
- data/lib/rake/contrib/ftptools.rb +5 -8
- data/lib/rake/contrib/publisher.rb +2 -8
- data/lib/rake/contrib/rubyforgepublisher.rb +2 -4
- data/lib/rake/contrib/sshpublisher.rb +4 -6
- data/lib/rake/contrib/sys.rb +7 -25
- data/lib/rake/default_loader.rb +10 -0
- data/lib/rake/dsl.rb +2 -0
- data/lib/rake/dsl_definition.rb +143 -0
- data/lib/rake/early_time.rb +18 -0
- data/lib/rake/ext/core.rb +27 -0
- data/lib/rake/ext/module.rb +39 -0
- data/lib/rake/ext/string.rb +167 -0
- data/lib/rake/ext/time.rb +14 -0
- data/lib/rake/file_creation_task.rb +24 -0
- data/lib/rake/file_list.rb +403 -0
- data/lib/rake/file_task.rb +47 -0
- data/lib/rake/file_utils.rb +112 -0
- data/lib/rake/file_utils_ext.rb +142 -0
- data/lib/rake/gempackagetask.rb +6 -90
- data/lib/rake/invocation_chain.rb +51 -0
- data/lib/rake/invocation_exception_mixin.rb +16 -0
- data/lib/rake/loaders/makefile.rb +13 -15
- data/lib/rake/multi_task.rb +16 -0
- data/lib/rake/name_space.rb +25 -0
- data/lib/rake/packagetask.rb +13 -12
- data/lib/rake/parallel.rb +17 -28
- data/lib/rake/pathmap.rb +1 -0
- data/lib/rake/pseudo_status.rb +24 -0
- data/lib/rake/rake_module.rb +29 -0
- data/lib/rake/rake_test_loader.rb +10 -2
- data/lib/rake/rdoctask.rb +211 -190
- data/lib/rake/ruby182_test_unit_fix.rb +9 -7
- data/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/lib/rake/runtest.rb +4 -6
- data/lib/rake/task.rb +351 -0
- data/lib/rake/task_argument_error.rb +7 -0
- data/lib/rake/task_arguments.rb +74 -0
- data/lib/rake/task_manager.rb +307 -0
- data/lib/rake/tasklib.rb +1 -2
- data/lib/rake/testtask.rb +57 -27
- data/lib/rake/version.rb +13 -0
- data/lib/rake/win32.rb +4 -4
- data/test/contrib/test_sys.rb +8 -31
- data/test/data/access/Rakefile +33 -0
- data/test/data/comments/Rakefile +18 -0
- data/test/data/default/Rakefile +1 -1
- data/test/data/deprecated_import/Rakefile +1 -0
- data/test/data/dryrun/Rakefile +1 -1
- data/test/data/file_creation_task/Rakefile +1 -1
- data/test/data/namespace/Rakefile +9 -0
- data/test/data/rakelib/test1.rb +1 -0
- data/test/data/verbose/Rakefile +34 -0
- data/test/{filecreation.rb → file_creation.rb} +11 -7
- data/test/functional/functional_test.rb +25 -0
- data/test/{session_functional.rb → functional/session_based_tests.rb} +141 -23
- data/test/in_environment.rb +7 -5
- data/test/{test_application.rb → lib/application_test.rb} +331 -143
- data/test/{test_clean.rb → lib/clean_test.rb} +1 -0
- data/test/{test_definitions.rb → lib/definitions_test.rb} +4 -4
- data/test/lib/dsl_test.rb +52 -0
- data/test/{test_earlytime.rb → lib/earlytime_test.rb} +1 -2
- data/test/{test_extension.rb → lib/extension_test.rb} +2 -2
- data/test/{test_file_creation_task.rb → lib/file_creation_task_test.rb} +1 -1
- data/test/{test_file_task.rb → lib/file_task_test.rb} +9 -5
- data/test/{test_filelist.rb → lib/filelist_test.rb} +38 -24
- data/test/{test_fileutils.rb → lib/fileutils_test.rb} +27 -22
- data/test/{test_ftp.rb → lib/ftp_test.rb} +0 -0
- data/test/{test_invocation_chain.rb → lib/invocation_chain_test.rb} +0 -0
- data/test/{test_makefile_loader.rb → lib/makefile_loader_test.rb} +0 -0
- data/test/{test_multitask.rb → lib/multitask_test.rb} +3 -2
- data/test/{test_namespace.rb → lib/namespace_test.rb} +0 -0
- data/test/lib/package_task_test.rb +82 -0
- data/test/{test_parallel.rb → lib/parallel_test.rb} +5 -5
- data/test/{test_pathmap.rb → lib/pathmap_test.rb} +3 -2
- data/test/{test_pseudo_status.rb → lib/pseudo_status_test.rb} +0 -0
- data/test/{test_rake.rb → lib/rake_test.rb} +1 -1
- data/test/{test_rdoc_task.rb → lib/rdoc_task_test.rb} +19 -23
- data/test/{test_require.rb → lib/require_test.rb} +8 -2
- data/test/{test_rules.rb → lib/rules_test.rb} +4 -5
- data/test/{test_task_arguments.rb → lib/task_arguments_test.rb} +5 -5
- data/test/{test_task_manager.rb → lib/task_manager_test.rb} +15 -5
- data/test/{test_tasks.rb → lib/task_test.rb} +91 -28
- data/test/{test_tasklib.rb → lib/tasklib_test.rb} +0 -0
- data/test/{test_test_task.rb → lib/test_task_test.rb} +3 -3
- data/test/lib/testtask_test.rb +49 -0
- data/test/{test_top_level_functions.rb → lib/top_level_functions_test.rb} +5 -3
- data/test/{test_win32.rb → lib/win32_test.rb} +19 -0
- data/test/rake_test_setup.rb +6 -10
- data/test/ruby_version_test.rb +3 -0
- data/test/test_helper.rb +19 -0
- metadata +108 -66
- data/Rakefile.drake +0 -73
- data/test/functional.rb +0 -15
- data/test/test_package_task.rb +0 -118
@@ -0,0 +1,307 @@
|
|
1
|
+
module Rake
|
2
|
+
|
3
|
+
# The TaskManager module is a mixin for managing tasks.
|
4
|
+
module TaskManager
|
5
|
+
# Track the last comment made in the Rakefile.
|
6
|
+
attr_accessor :last_description
|
7
|
+
alias :last_comment :last_description # Backwards compatibility
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
super
|
11
|
+
@tasks = Hash.new
|
12
|
+
@rules = Array.new
|
13
|
+
@scope = Array.new
|
14
|
+
@last_description = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_rule(*args, &block)
|
18
|
+
pattern, _, deps = resolve_args(args)
|
19
|
+
pattern = Regexp.new(Regexp.quote(pattern) + '$') if String === pattern
|
20
|
+
@rules << [pattern, deps, block]
|
21
|
+
end
|
22
|
+
|
23
|
+
def define_task(task_class, *args, &block)
|
24
|
+
task_name, arg_names, deps = resolve_args(args)
|
25
|
+
task_name = task_class.scope_name(@scope, task_name)
|
26
|
+
deps = [deps] unless deps.respond_to?(:to_ary)
|
27
|
+
deps = deps.collect {|d| d.to_s }
|
28
|
+
task = intern(task_class, task_name)
|
29
|
+
task.set_arg_names(arg_names) unless arg_names.empty?
|
30
|
+
if Rake::TaskManager.record_task_metadata
|
31
|
+
add_location(task)
|
32
|
+
task.add_description(get_description(task))
|
33
|
+
end
|
34
|
+
task.enhance(deps, &block)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Lookup a task. Return an existing task if found, otherwise
|
38
|
+
# create a task of the current type.
|
39
|
+
def intern(task_class, task_name)
|
40
|
+
@tasks[task_name.to_s] ||= task_class.new(task_name, self)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Find a matching task for +task_name+.
|
44
|
+
def [](task_name, scopes=nil)
|
45
|
+
task_name = task_name.to_s
|
46
|
+
self.lookup(task_name, scopes) or
|
47
|
+
enhance_with_matching_rule(task_name) or
|
48
|
+
synthesize_file_task(task_name) or
|
49
|
+
fail "Don't know how to build task '#{task_name}'"
|
50
|
+
end
|
51
|
+
|
52
|
+
def synthesize_file_task(task_name)
|
53
|
+
return nil unless File.exist?(task_name)
|
54
|
+
define_task(Rake::FileTask, task_name)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Resolve the arguments for a task/rule. Returns a triplet of
|
58
|
+
# [task_name, arg_name_list, prerequisites].
|
59
|
+
def resolve_args(args)
|
60
|
+
if args.last.is_a?(Hash)
|
61
|
+
deps = args.pop
|
62
|
+
resolve_args_with_dependencies(args, deps)
|
63
|
+
else
|
64
|
+
resolve_args_without_dependencies(args)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Resolve task arguments for a task or rule when there are no
|
69
|
+
# dependencies declared.
|
70
|
+
#
|
71
|
+
# The patterns recognized by this argument resolving function are:
|
72
|
+
#
|
73
|
+
# task :t
|
74
|
+
# task :t, [:a]
|
75
|
+
# task :t, :a (deprecated)
|
76
|
+
#
|
77
|
+
def resolve_args_without_dependencies(args)
|
78
|
+
task_name = args.shift
|
79
|
+
if args.size == 1 && args.first.respond_to?(:to_ary)
|
80
|
+
arg_names = args.first.to_ary
|
81
|
+
else
|
82
|
+
arg_names = args
|
83
|
+
end
|
84
|
+
[task_name, arg_names, []]
|
85
|
+
end
|
86
|
+
private :resolve_args_without_dependencies
|
87
|
+
|
88
|
+
# Resolve task arguments for a task or rule when there are
|
89
|
+
# dependencies declared.
|
90
|
+
#
|
91
|
+
# The patterns recognized by this argument resolving function are:
|
92
|
+
#
|
93
|
+
# task :t => [:d]
|
94
|
+
# task :t, [a] => [:d]
|
95
|
+
# task :t, :needs => [:d] (deprecated)
|
96
|
+
# task :t, :a, :needs => [:d] (deprecated)
|
97
|
+
#
|
98
|
+
def resolve_args_with_dependencies(args, hash) # :nodoc:
|
99
|
+
fail "Task Argument Error" if hash.size != 1
|
100
|
+
key, value = hash.map { |k, v| [k,v] }.first
|
101
|
+
if args.empty?
|
102
|
+
task_name = key
|
103
|
+
arg_names = []
|
104
|
+
deps = value
|
105
|
+
elsif key == :needs
|
106
|
+
Rake.application.deprecate(
|
107
|
+
"task :t, arg, :needs => [deps]",
|
108
|
+
"task :t, [args] => [deps]",
|
109
|
+
caller.detect { |c| c !~ /\blib\/rake\b/ })
|
110
|
+
task_name = args.shift
|
111
|
+
arg_names = args
|
112
|
+
deps = value
|
113
|
+
else
|
114
|
+
task_name = args.shift
|
115
|
+
arg_names = key
|
116
|
+
deps = value
|
117
|
+
end
|
118
|
+
deps = [deps] unless deps.respond_to?(:to_ary)
|
119
|
+
[task_name, arg_names, deps]
|
120
|
+
end
|
121
|
+
private :resolve_args_with_dependencies
|
122
|
+
|
123
|
+
# If a rule can be found that matches the task name, enhance the
|
124
|
+
# task with the prerequisites and actions from the rule. Set the
|
125
|
+
# source attribute of the task appropriately for the rule. Return
|
126
|
+
# the enhanced task or nil of no rule was found.
|
127
|
+
def enhance_with_matching_rule(task_name, level=0)
|
128
|
+
fail Rake::RuleRecursionOverflowError,
|
129
|
+
"Rule Recursion Too Deep" if level >= 16
|
130
|
+
@rules.each do |pattern, extensions, block|
|
131
|
+
if pattern.match(task_name)
|
132
|
+
task = attempt_rule(task_name, extensions, block, level)
|
133
|
+
return task if task
|
134
|
+
end
|
135
|
+
end
|
136
|
+
nil
|
137
|
+
rescue Rake::RuleRecursionOverflowError => ex
|
138
|
+
ex.add_target(task_name)
|
139
|
+
fail ex
|
140
|
+
end
|
141
|
+
|
142
|
+
# List of all defined tasks in this application.
|
143
|
+
def tasks
|
144
|
+
@tasks.values.sort_by { |t| t.name }
|
145
|
+
end
|
146
|
+
|
147
|
+
# List of all the tasks defined in the given scope (and its
|
148
|
+
# sub-scopes).
|
149
|
+
def tasks_in_scope(scope)
|
150
|
+
prefix = scope.join(":")
|
151
|
+
tasks.select { |t|
|
152
|
+
/^#{prefix}:/ =~ t.name
|
153
|
+
}
|
154
|
+
end
|
155
|
+
|
156
|
+
# Clear all tasks in this application.
|
157
|
+
def clear
|
158
|
+
@tasks.clear
|
159
|
+
@rules.clear
|
160
|
+
end
|
161
|
+
|
162
|
+
# Lookup a task, using scope and the scope hints in the task name.
|
163
|
+
# This method performs straight lookups without trying to
|
164
|
+
# synthesize file tasks or rules. Special scope names (e.g. '^')
|
165
|
+
# are recognized. If no scope argument is supplied, use the
|
166
|
+
# current scope. Return nil if the task cannot be found.
|
167
|
+
def lookup(task_name, initial_scope=nil)
|
168
|
+
initial_scope ||= @scope
|
169
|
+
task_name = task_name.to_s
|
170
|
+
if task_name =~ /^rake:/
|
171
|
+
scopes = []
|
172
|
+
task_name = task_name.sub(/^rake:/, '')
|
173
|
+
elsif task_name =~ /^(\^+)/
|
174
|
+
scopes = initial_scope[0, initial_scope.size - $1.size]
|
175
|
+
task_name = task_name.sub(/^(\^+)/, '')
|
176
|
+
else
|
177
|
+
scopes = initial_scope
|
178
|
+
end
|
179
|
+
lookup_in_scope(task_name, scopes)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Lookup the task name
|
183
|
+
def lookup_in_scope(name, scope)
|
184
|
+
n = scope.size
|
185
|
+
while n >= 0
|
186
|
+
tn = (scope[0,n] + [name]).join(':')
|
187
|
+
task = @tasks[tn]
|
188
|
+
return task if task
|
189
|
+
n -= 1
|
190
|
+
end
|
191
|
+
nil
|
192
|
+
end
|
193
|
+
private :lookup_in_scope
|
194
|
+
|
195
|
+
# Return the list of scope names currently active in the task
|
196
|
+
# manager.
|
197
|
+
def current_scope
|
198
|
+
@scope.dup
|
199
|
+
end
|
200
|
+
|
201
|
+
# Evaluate the block in a nested namespace named +name+. Create
|
202
|
+
# an anonymous namespace if +name+ is nil.
|
203
|
+
def in_namespace(name)
|
204
|
+
name ||= generate_name
|
205
|
+
@scope.push(name)
|
206
|
+
ns = NameSpace.new(self, @scope)
|
207
|
+
yield(ns)
|
208
|
+
ns
|
209
|
+
ensure
|
210
|
+
@scope.pop
|
211
|
+
end
|
212
|
+
|
213
|
+
private
|
214
|
+
|
215
|
+
# Add a location to the locations field of the given task.
|
216
|
+
def add_location(task)
|
217
|
+
loc = find_location
|
218
|
+
task.locations << loc if loc
|
219
|
+
task
|
220
|
+
end
|
221
|
+
|
222
|
+
# Find the location that called into the dsl layer.
|
223
|
+
def find_location
|
224
|
+
locations = caller
|
225
|
+
i = 0
|
226
|
+
while locations[i]
|
227
|
+
return locations[i+1] if locations[i] =~ /rake\/dsl_definition.rb/
|
228
|
+
i += 1
|
229
|
+
end
|
230
|
+
nil
|
231
|
+
end
|
232
|
+
|
233
|
+
# Generate an anonymous namespace name.
|
234
|
+
def generate_name
|
235
|
+
@seed ||= 0
|
236
|
+
@seed += 1
|
237
|
+
"_anon_#{@seed}"
|
238
|
+
end
|
239
|
+
|
240
|
+
def trace_rule(level, message)
|
241
|
+
$stderr.puts "#{" "*level}#{message}" if Rake.application.options.trace_rules
|
242
|
+
end
|
243
|
+
|
244
|
+
# Attempt to create a rule given the list of prerequisites.
|
245
|
+
def attempt_rule(task_name, extensions, block, level)
|
246
|
+
sources = make_sources(task_name, extensions)
|
247
|
+
prereqs = sources.collect { |source|
|
248
|
+
trace_rule level, "Attempting Rule #{task_name} => #{source}"
|
249
|
+
if File.exist?(source) || Rake::Task.task_defined?(source)
|
250
|
+
trace_rule level, "(#{task_name} => #{source} ... EXIST)"
|
251
|
+
source
|
252
|
+
elsif parent = enhance_with_matching_rule(source, level+1)
|
253
|
+
trace_rule level, "(#{task_name} => #{source} ... ENHANCE)"
|
254
|
+
parent.name
|
255
|
+
else
|
256
|
+
trace_rule level, "(#{task_name} => #{source} ... FAIL)"
|
257
|
+
return nil
|
258
|
+
end
|
259
|
+
}
|
260
|
+
task = FileTask.define_task({task_name => prereqs}, &block)
|
261
|
+
task.sources = prereqs
|
262
|
+
task
|
263
|
+
end
|
264
|
+
|
265
|
+
# Make a list of sources from the list of file name extensions /
|
266
|
+
# translation procs.
|
267
|
+
def make_sources(task_name, extensions)
|
268
|
+
result = extensions.collect { |ext|
|
269
|
+
case ext
|
270
|
+
when /%/
|
271
|
+
task_name.pathmap(ext)
|
272
|
+
when %r{/}
|
273
|
+
ext
|
274
|
+
when /^\./
|
275
|
+
task_name.ext(ext)
|
276
|
+
when String
|
277
|
+
ext
|
278
|
+
when Proc
|
279
|
+
if ext.arity == 1
|
280
|
+
ext.call(task_name)
|
281
|
+
else
|
282
|
+
ext.call
|
283
|
+
end
|
284
|
+
else
|
285
|
+
fail "Don't know how to handle rule dependent: #{ext.inspect}"
|
286
|
+
end
|
287
|
+
}
|
288
|
+
result.flatten
|
289
|
+
end
|
290
|
+
|
291
|
+
|
292
|
+
private
|
293
|
+
|
294
|
+
# Return the current description, clearing it in the process.
|
295
|
+
def get_description(task)
|
296
|
+
desc = @last_description
|
297
|
+
@last_description = nil
|
298
|
+
desc
|
299
|
+
end
|
300
|
+
|
301
|
+
class << self
|
302
|
+
attr_accessor :record_task_metadata
|
303
|
+
TaskManager.record_task_metadata = false
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
end
|
data/lib/rake/tasklib.rb
CHANGED
data/lib/rake/testtask.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
# Define a task library for running unit tests.
|
4
2
|
|
5
3
|
require 'rake'
|
@@ -10,7 +8,7 @@ module Rake
|
|
10
8
|
# Create a task that runs a set of tests.
|
11
9
|
#
|
12
10
|
# Example:
|
13
|
-
#
|
11
|
+
#
|
14
12
|
# Rake::TestTask.new do |t|
|
15
13
|
# t.libs << "test"
|
16
14
|
# t.test_files = FileList['test/test*.rb']
|
@@ -63,7 +61,7 @@ module Rake
|
|
63
61
|
# * :rake -- Rake provided test loading script (default).
|
64
62
|
# * :testrb -- Ruby provided test loading script.
|
65
63
|
# * :direct -- Load tests using command line loader.
|
66
|
-
#
|
64
|
+
#
|
67
65
|
attr_accessor :loader
|
68
66
|
|
69
67
|
# Array of commandline options to pass to ruby when running test loader.
|
@@ -95,33 +93,37 @@ module Rake
|
|
95
93
|
|
96
94
|
# Create the tasks defined by this task lib.
|
97
95
|
def define
|
98
|
-
lib_path = @libs.join(File::PATH_SEPARATOR)
|
99
96
|
desc "Run tests" + (@name==:test ? "" : " for #{@name}")
|
100
97
|
task @name do
|
101
|
-
|
102
|
-
|
103
|
-
run_code =
|
104
|
-
case @loader
|
105
|
-
when :direct
|
106
|
-
"-e 'ARGV.each{|f| load f}'"
|
107
|
-
when :testrb
|
108
|
-
"-S testrb #{fix}"
|
109
|
-
when :rake
|
110
|
-
rake_loader
|
111
|
-
end
|
112
|
-
@ruby_opts.unshift( "-I\"#{lib_path}\"" )
|
113
|
-
@ruby_opts.unshift( "-w" ) if @warning
|
114
|
-
ruby @ruby_opts.join(" ") +
|
115
|
-
" \"#{run_code}\" " +
|
116
|
-
file_list.collect { |fn| "\"#{fn}\"" }.join(' ') +
|
117
|
-
" #{option_list}"
|
98
|
+
FileUtilsExt.verbose(@verbose) do
|
99
|
+
ruby "#{ruby_opts_string} #{run_code} #{file_list_string} #{option_list}"
|
118
100
|
end
|
119
101
|
end
|
120
102
|
self
|
121
103
|
end
|
122
104
|
|
123
105
|
def option_list # :nodoc:
|
124
|
-
ENV['TESTOPTS'] ||
|
106
|
+
(ENV['TESTOPTS'] ||
|
107
|
+
ENV['TESTOPT'] ||
|
108
|
+
ENV['TEST_OPTS'] ||
|
109
|
+
ENV['TEST_OPT'] ||
|
110
|
+
@options ||
|
111
|
+
"")
|
112
|
+
end
|
113
|
+
|
114
|
+
def ruby_opts_string
|
115
|
+
opts = @ruby_opts.dup
|
116
|
+
opts.unshift( "-I\"#{lib_path}\"" ) unless @libs.empty?
|
117
|
+
opts.unshift( "-w" ) if @warning
|
118
|
+
opts.join(" ")
|
119
|
+
end
|
120
|
+
|
121
|
+
def lib_path
|
122
|
+
@libs.join(File::PATH_SEPARATOR)
|
123
|
+
end
|
124
|
+
|
125
|
+
def file_list_string
|
126
|
+
file_list.collect { |fn| "\"#{fn}\"" }.join(' ')
|
125
127
|
end
|
126
128
|
|
127
129
|
def file_list # :nodoc:
|
@@ -130,20 +132,35 @@ module Rake
|
|
130
132
|
else
|
131
133
|
result = []
|
132
134
|
result += @test_files.to_a if @test_files
|
133
|
-
result
|
134
|
-
|
135
|
+
result << @pattern if @pattern
|
136
|
+
result
|
135
137
|
end
|
136
138
|
end
|
137
139
|
|
138
140
|
def fix # :nodoc:
|
139
|
-
case
|
141
|
+
case ruby_version
|
140
142
|
when '1.8.2'
|
141
|
-
find_file 'rake/ruby182_test_unit_fix'
|
143
|
+
"\"#{find_file 'rake/ruby182_test_unit_fix'}\""
|
142
144
|
else
|
143
145
|
nil
|
144
146
|
end || ''
|
145
147
|
end
|
146
148
|
|
149
|
+
def ruby_version
|
150
|
+
RUBY_VERSION
|
151
|
+
end
|
152
|
+
|
153
|
+
def run_code
|
154
|
+
case @loader
|
155
|
+
when :direct
|
156
|
+
"-e \"ARGV.each{|f| require f}\""
|
157
|
+
when :testrb
|
158
|
+
"-S testrb #{fix}"
|
159
|
+
when :rake
|
160
|
+
"-I\"#{rake_lib_dir}\" \"#{rake_loader}\""
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
147
164
|
def rake_loader # :nodoc:
|
148
165
|
find_file('rake/rake_test_loader') or
|
149
166
|
fail "unable to find rake test loader"
|
@@ -157,5 +174,18 @@ module Rake
|
|
157
174
|
nil
|
158
175
|
end
|
159
176
|
|
177
|
+
def rake_lib_dir # :nodoc:
|
178
|
+
find_dir('rake') or
|
179
|
+
fail "unable to find rake lib"
|
180
|
+
end
|
181
|
+
|
182
|
+
def find_dir(fn) # :nodoc:
|
183
|
+
$LOAD_PATH.each do |path|
|
184
|
+
file_path = File.join(path, "#{fn}.rb")
|
185
|
+
return path if File.exist? file_path
|
186
|
+
end
|
187
|
+
nil
|
188
|
+
end
|
189
|
+
|
160
190
|
end
|
161
191
|
end
|