rake 10.0.4 → 10.1.0
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 +4 -4
- data/Rakefile +1 -1
- data/doc/command_line_usage.rdoc +1 -1
- data/doc/rakefile.rdoc +27 -13
- data/doc/release_notes/rake-10.1.0.rdoc +61 -0
- data/install.rb +5 -15
- data/lib/rake/alt_system.rb +3 -4
- data/lib/rake/application.rb +115 -68
- data/lib/rake/backtrace.rb +9 -8
- data/lib/rake/clean.rb +27 -4
- data/lib/rake/contrib/ftptools.rb +6 -18
- data/lib/rake/contrib/sys.rb +2 -1
- data/lib/rake/dsl_definition.rb +2 -1
- data/lib/rake/ext/core.rb +2 -1
- data/lib/rake/ext/string.rb +1 -3
- data/lib/rake/file_list.rb +24 -18
- data/lib/rake/file_task.rb +1 -2
- data/lib/rake/file_utils.rb +9 -7
- data/lib/rake/file_utils_ext.rb +2 -1
- data/lib/rake/gempackagetask.rb +2 -1
- data/lib/rake/invocation_chain.rb +24 -18
- data/lib/rake/linked_list.rb +103 -0
- data/lib/rake/packagetask.rb +11 -6
- data/lib/rake/pseudo_status.rb +5 -0
- data/lib/rake/rdoctask.rb +2 -1
- data/lib/rake/ruby182_test_unit_fix.rb +4 -2
- data/lib/rake/runtest.rb +2 -2
- data/lib/rake/scope.rb +42 -0
- data/lib/rake/task.rb +47 -37
- data/lib/rake/task_arguments.rb +13 -2
- data/lib/rake/task_manager.rb +25 -24
- data/lib/rake/tasklib.rb +1 -1
- data/lib/rake/testtask.rb +10 -7
- data/lib/rake/thread_history_display.rb +1 -1
- data/lib/rake/thread_pool.rb +10 -4
- data/lib/rake/version.rb +3 -7
- data/lib/rake/win32.rb +3 -2
- data/lib/rake.rb +2 -0
- data/test/helper.rb +36 -470
- data/test/support/rakefile_definitions.rb +444 -0
- data/test/support/ruby_runner.rb +33 -0
- data/test/test_rake_application.rb +14 -12
- data/test/test_rake_application_options.rb +7 -5
- data/test/test_rake_backtrace.rb +38 -14
- data/test/test_rake_clean.rb +36 -4
- data/test/test_rake_definitions.rb +2 -3
- data/test/test_rake_file_creation_task.rb +2 -2
- data/test/test_rake_file_list.rb +23 -24
- data/test/test_rake_file_task.rb +4 -4
- data/test/test_rake_file_utils.rb +6 -2
- data/test/test_rake_ftp_file.rb +28 -13
- data/test/test_rake_functional.rb +6 -36
- data/test/test_rake_invocation_chain.rb +15 -3
- data/test/test_rake_linked_list.rb +84 -0
- data/test/test_rake_makefile_loader.rb +3 -1
- data/test/test_rake_multi_task.rb +2 -3
- data/test/test_rake_name_space.rb +1 -1
- data/test/test_rake_path_map.rb +23 -12
- data/test/test_rake_rake_test_loader.rb +2 -3
- data/test/test_rake_reduce_compat.rb +2 -6
- data/test/test_rake_rules.rb +47 -12
- data/test/test_rake_scope.rb +44 -0
- data/test/test_rake_task.rb +47 -11
- data/test/test_rake_task_arguments.rb +35 -2
- data/test/test_rake_task_manager.rb +16 -15
- data/test/test_rake_task_with_arguments.rb +2 -2
- data/test/test_rake_test_task.rb +1 -2
- data/test/test_rake_thread_pool.rb +36 -16
- data/test/test_thread_history_display.rb +16 -6
- data/test/test_trace_output.rb +2 -0
- metadata +10 -2
data/test/test_rake_rules.rb
CHANGED
|
@@ -102,7 +102,7 @@ class TestRakeRules < Rake::TestCase
|
|
|
102
102
|
verbose(false) do
|
|
103
103
|
|
|
104
104
|
create_file(".foo")
|
|
105
|
-
rule '.o' => lambda{".foo"} do |t|
|
|
105
|
+
rule '.o' => lambda { ".foo" } do |t|
|
|
106
106
|
@runs << "#{t.name} - #{t.source}"
|
|
107
107
|
end
|
|
108
108
|
Task[OBJFILE].invoke
|
|
@@ -113,7 +113,7 @@ class TestRakeRules < Rake::TestCase
|
|
|
113
113
|
def test_file_names_containing_percent_can_be_wrapped_in_lambda
|
|
114
114
|
verbose(false) do
|
|
115
115
|
create_file("foo%x")
|
|
116
|
-
rule '.o' => lambda{"foo%x"} do |t|
|
|
116
|
+
rule '.o' => lambda { "foo%x" } do |t|
|
|
117
117
|
@runs << "#{t.name} - #{t.source}"
|
|
118
118
|
end
|
|
119
119
|
Task[OBJFILE].invoke
|
|
@@ -186,7 +186,7 @@ class TestRakeRules < Rake::TestCase
|
|
|
186
186
|
|
|
187
187
|
def test_rule_with_two_sources_runs_if_both_sources_are_present
|
|
188
188
|
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
|
|
189
|
-
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
|
|
189
|
+
rule OBJFILE => [lambda { SRCFILE }, lambda { SRCFILE2 }] do
|
|
190
190
|
@runs << :RULE
|
|
191
191
|
end
|
|
192
192
|
Task[OBJFILE].invoke
|
|
@@ -196,7 +196,7 @@ class TestRakeRules < Rake::TestCase
|
|
|
196
196
|
def test_rule_with_two_sources_but_one_missing_does_not_run
|
|
197
197
|
create_timed_files(OBJFILE, SRCFILE)
|
|
198
198
|
delete_file(SRCFILE2)
|
|
199
|
-
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
|
|
199
|
+
rule OBJFILE => [lambda { SRCFILE }, lambda { SRCFILE2 }] do
|
|
200
200
|
@runs << :RULE
|
|
201
201
|
end
|
|
202
202
|
Task[OBJFILE].invoke
|
|
@@ -222,10 +222,10 @@ class TestRakeRules < Rake::TestCase
|
|
|
222
222
|
def test_second_rule_runs_when_first_rule_doesnt
|
|
223
223
|
create_timed_files(OBJFILE, SRCFILE)
|
|
224
224
|
delete_file(SRCFILE2)
|
|
225
|
-
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
|
|
225
|
+
rule OBJFILE => [lambda { SRCFILE }, lambda { SRCFILE2 }] do
|
|
226
226
|
@runs << :RULE1
|
|
227
227
|
end
|
|
228
|
-
rule OBJFILE => [lambda{SRCFILE}] do
|
|
228
|
+
rule OBJFILE => [lambda { SRCFILE }] do
|
|
229
229
|
@runs << :RULE2
|
|
230
230
|
end
|
|
231
231
|
Task[OBJFILE].invoke
|
|
@@ -234,10 +234,10 @@ class TestRakeRules < Rake::TestCase
|
|
|
234
234
|
|
|
235
235
|
def test_second_rule_doest_run_if_first_triggers
|
|
236
236
|
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
|
|
237
|
-
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
|
|
237
|
+
rule OBJFILE => [lambda { SRCFILE }, lambda { SRCFILE2 }] do
|
|
238
238
|
@runs << :RULE1
|
|
239
239
|
end
|
|
240
|
-
rule OBJFILE => [lambda{SRCFILE}] do
|
|
240
|
+
rule OBJFILE => [lambda { SRCFILE }] do
|
|
241
241
|
@runs << :RULE2
|
|
242
242
|
end
|
|
243
243
|
Task[OBJFILE].invoke
|
|
@@ -246,10 +246,10 @@ class TestRakeRules < Rake::TestCase
|
|
|
246
246
|
|
|
247
247
|
def test_second_rule_doest_run_if_first_triggers_with_reversed_rules
|
|
248
248
|
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
|
|
249
|
-
rule OBJFILE => [lambda{SRCFILE}] do
|
|
249
|
+
rule OBJFILE => [lambda { SRCFILE }] do
|
|
250
250
|
@runs << :RULE1
|
|
251
251
|
end
|
|
252
|
-
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
|
|
252
|
+
rule OBJFILE => [lambda { SRCFILE }, lambda { SRCFILE2 }] do
|
|
253
253
|
@runs << :RULE2
|
|
254
254
|
end
|
|
255
255
|
Task[OBJFILE].invoke
|
|
@@ -319,9 +319,44 @@ class TestRakeRules < Rake::TestCase
|
|
|
319
319
|
end
|
|
320
320
|
|
|
321
321
|
def test_rules_with_bad_dependents_will_fail
|
|
322
|
-
rule "a" => [
|
|
322
|
+
rule "a" => [1] do |t| puts t.name end
|
|
323
323
|
assert_raises(RuntimeError) do Task['a'].invoke end
|
|
324
324
|
end
|
|
325
325
|
|
|
326
|
-
|
|
326
|
+
def test_string_rule_with_args
|
|
327
|
+
delete_file(OBJFILE)
|
|
328
|
+
create_file(SRCFILE)
|
|
329
|
+
rule '.o', [:a] => SRCFILE do |t, args|
|
|
330
|
+
assert_equal 'arg', args.a
|
|
331
|
+
end
|
|
332
|
+
Task[OBJFILE].invoke('arg')
|
|
333
|
+
end
|
|
327
334
|
|
|
335
|
+
def test_regex_rule_with_args
|
|
336
|
+
delete_file(OBJFILE)
|
|
337
|
+
create_file(SRCFILE)
|
|
338
|
+
rule(/.o$/, [:a] => SRCFILE) do |t, args|
|
|
339
|
+
assert_equal 'arg', args.a
|
|
340
|
+
end
|
|
341
|
+
Task[OBJFILE].invoke('arg')
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def test_string_rule_with_args_and_lambda_prereq
|
|
345
|
+
delete_file(OBJFILE)
|
|
346
|
+
create_file(SRCFILE)
|
|
347
|
+
rule '.o', [:a] => [lambda{SRCFILE}]do |t, args|
|
|
348
|
+
assert_equal 'arg', args.a
|
|
349
|
+
end
|
|
350
|
+
Task[OBJFILE].invoke('arg')
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
def test_regex_rule_with_args_and_lambda_prereq
|
|
354
|
+
delete_file(OBJFILE)
|
|
355
|
+
create_file(SRCFILE)
|
|
356
|
+
rule(/.o$/, [:a] => [lambda{SRCFILE}]) do |t, args|
|
|
357
|
+
assert_equal 'arg', args.a
|
|
358
|
+
end
|
|
359
|
+
Task[OBJFILE].invoke('arg')
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
class TestRakeScope < Rake::TestCase
|
|
4
|
+
include Rake
|
|
5
|
+
|
|
6
|
+
def test_path_against_empty_scope
|
|
7
|
+
scope = Scope.make
|
|
8
|
+
assert_equal scope, Scope::EMPTY
|
|
9
|
+
assert_equal scope.path, ""
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_path_against_one_element
|
|
13
|
+
scope = Scope.make(:one)
|
|
14
|
+
assert_equal "one", scope.path
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_path_against_two_elements
|
|
18
|
+
scope = Scope.make(:inner, :outer)
|
|
19
|
+
assert_equal "outer:inner", scope.path
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_path_with_task_name
|
|
23
|
+
scope = Scope.make(:inner, :outer)
|
|
24
|
+
assert_equal "outer:inner:task", scope.path_with_task_name("task")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_path_with_task_name_against_empty_scope
|
|
28
|
+
scope = Scope.make
|
|
29
|
+
assert_equal "task", scope.path_with_task_name("task")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_conj_against_two_elements
|
|
33
|
+
scope = Scope.make.conj("B").conj("A")
|
|
34
|
+
assert_equal Scope.make("A", "B"), scope
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_trim
|
|
38
|
+
scope = Scope.make("A", "B")
|
|
39
|
+
assert_equal scope, scope.trim(0)
|
|
40
|
+
assert_equal scope.tail, scope.trim(1)
|
|
41
|
+
assert_equal scope.tail.tail, scope.trim(2)
|
|
42
|
+
assert_equal scope.tail.tail, scope.trim(3)
|
|
43
|
+
end
|
|
44
|
+
end
|
data/test/test_rake_task.rb
CHANGED
|
@@ -156,8 +156,8 @@ class TestRakeTask < Rake::TestCase
|
|
|
156
156
|
def test_multi_invocations
|
|
157
157
|
runs = []
|
|
158
158
|
p = proc do |t| runs << t.name end
|
|
159
|
-
task({:t1=>[:t2
|
|
160
|
-
task({:t2=>[:t3]}, &p)
|
|
159
|
+
task({ :t1 => [:t2, :t3] }, &p)
|
|
160
|
+
task({ :t2 => [:t3] }, &p)
|
|
161
161
|
task(:t3, &p)
|
|
162
162
|
Task[:t1].invoke
|
|
163
163
|
assert_equal ["t1", "t2", "t3"], runs.sort
|
|
@@ -166,7 +166,7 @@ class TestRakeTask < Rake::TestCase
|
|
|
166
166
|
def test_task_list
|
|
167
167
|
task :t2
|
|
168
168
|
task :t1 => [:t2]
|
|
169
|
-
assert_equal ["t1", "t2"], Task.tasks.
|
|
169
|
+
assert_equal ["t1", "t2"], Task.tasks.map { |t| t.name }
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
def test_task_gives_name_on_to_s
|
|
@@ -271,15 +271,15 @@ class TestRakeTask < Rake::TestCase
|
|
|
271
271
|
|
|
272
272
|
t_a = task(:a) do |t|
|
|
273
273
|
sleep 0.02
|
|
274
|
-
mx.synchronize{ result << t.name }
|
|
274
|
+
mx.synchronize { result << t.name }
|
|
275
275
|
end
|
|
276
276
|
|
|
277
277
|
t_b = task(:b) do |t|
|
|
278
|
-
mx.synchronize{ result << t.name }
|
|
278
|
+
mx.synchronize { result << t.name }
|
|
279
279
|
end
|
|
280
280
|
|
|
281
|
-
t_c = task(:c => [:a
|
|
282
|
-
mx.synchronize{ result << t.name }
|
|
281
|
+
t_c = task(:c => [:a, :b]) do |t|
|
|
282
|
+
mx.synchronize { result << t.name }
|
|
283
283
|
end
|
|
284
284
|
|
|
285
285
|
t_c.invoke
|
|
@@ -307,6 +307,30 @@ class TestRakeTask < Rake::TestCase
|
|
|
307
307
|
assert_match(/pre-requisites:\s*--t[23]/, out)
|
|
308
308
|
end
|
|
309
309
|
|
|
310
|
+
# NOTE: Rail-ties uses comment=.
|
|
311
|
+
def test_comment_setting
|
|
312
|
+
t = task(:t, :name, :rev)
|
|
313
|
+
t.comment = "A Comment"
|
|
314
|
+
assert_equal "A Comment", t.comment
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def test_comments_with_sentences
|
|
318
|
+
desc "Comment 1. Comment 2."
|
|
319
|
+
t = task(:t, :name, :rev)
|
|
320
|
+
assert_equal "Comment 1", t.comment
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def test_comments_with_tabbed_sentences
|
|
324
|
+
desc "Comment 1.\tComment 2."
|
|
325
|
+
t = task(:t, :name, :rev)
|
|
326
|
+
assert_equal "Comment 1", t.comment
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
def test_comments_with_decimal_points
|
|
330
|
+
desc "Revision 1.2.3."
|
|
331
|
+
t = task(:t, :name, :rev)
|
|
332
|
+
assert_equal "Revision 1.2.3", t.comment
|
|
333
|
+
end
|
|
310
334
|
|
|
311
335
|
def test_extended_comments
|
|
312
336
|
desc %{
|
|
@@ -318,7 +342,7 @@ class TestRakeTask < Rake::TestCase
|
|
|
318
342
|
}
|
|
319
343
|
t = task(:t, :name, :rev)
|
|
320
344
|
assert_equal "[name,rev]", t.arg_description
|
|
321
|
-
assert_equal "This is a comment
|
|
345
|
+
assert_equal "This is a comment", t.comment
|
|
322
346
|
assert_match(/^\s*name -- Name/, t.full_comment)
|
|
323
347
|
assert_match(/^\s*rev -- Software/, t.full_comment)
|
|
324
348
|
assert_match(/\A\s*This is a comment\.$/, t.full_comment)
|
|
@@ -332,9 +356,21 @@ class TestRakeTask < Rake::TestCase
|
|
|
332
356
|
assert_equal "line one / line two", t.comment
|
|
333
357
|
end
|
|
334
358
|
|
|
335
|
-
def
|
|
359
|
+
def test_duplicate_comments
|
|
360
|
+
desc "line one"
|
|
336
361
|
t = task(:t)
|
|
337
|
-
|
|
338
|
-
|
|
362
|
+
desc "line one"
|
|
363
|
+
task(:t)
|
|
364
|
+
assert_equal "line one", t.comment
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
def test_interspersed_duplicate_comments
|
|
368
|
+
desc "line one"
|
|
369
|
+
t = task(:t)
|
|
370
|
+
desc "line two"
|
|
371
|
+
task(:t)
|
|
372
|
+
desc "line one"
|
|
373
|
+
task(:t)
|
|
374
|
+
assert_equal "line one / line two", t.comment
|
|
339
375
|
end
|
|
340
376
|
end
|
|
@@ -26,8 +26,8 @@ class TestRakeTaskArguments < Rake::TestCase
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def test_enumerable_behavior
|
|
29
|
-
ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2
|
|
30
|
-
assert_equal [10, 20, 30], ta.
|
|
29
|
+
ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2, 3])
|
|
30
|
+
assert_equal [10, 20, 30], ta.map { |k, v| v * 10 }.sort
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def test_named_args
|
|
@@ -85,4 +85,37 @@ class TestRakeTaskArguments < Rake::TestCase
|
|
|
85
85
|
ta.with_defaults({ "cc" => "default_val" })
|
|
86
86
|
assert_nil ta[:cc]
|
|
87
87
|
end
|
|
88
|
+
|
|
89
|
+
def test_all_and_extra_arguments_without_named_arguments
|
|
90
|
+
app = Rake::Application.new
|
|
91
|
+
_, args = app.parse_task_string("task[1,two,more]")
|
|
92
|
+
ta = Rake::TaskArguments.new([], args)
|
|
93
|
+
assert_equal [], ta.names
|
|
94
|
+
assert_equal ['1', 'two', 'more'], ta.to_a
|
|
95
|
+
assert_equal ['1', 'two', 'more'], ta.extras
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_all_and_extra_arguments_with_named_arguments
|
|
99
|
+
app = Rake::Application.new
|
|
100
|
+
_, args = app.parse_task_string("task[1,two,more,still more]")
|
|
101
|
+
ta = Rake::TaskArguments.new([:first, :second], args)
|
|
102
|
+
assert_equal [:first, :second], ta.names
|
|
103
|
+
assert_equal "1", ta[:first]
|
|
104
|
+
assert_equal "two", ta[:second]
|
|
105
|
+
assert_equal ['1', 'two', 'more', 'still more'], ta.to_a
|
|
106
|
+
assert_equal ['more', 'still more'], ta.extras
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def test_extra_args_with_less_than_named_arguments
|
|
110
|
+
app = Rake::Application.new
|
|
111
|
+
_, args = app.parse_task_string("task[1,two]")
|
|
112
|
+
ta = Rake::TaskArguments.new([:first, :second, :third], args)
|
|
113
|
+
assert_equal [:first, :second, :third], ta.names
|
|
114
|
+
assert_equal "1", ta[:first]
|
|
115
|
+
assert_equal "two", ta[:second]
|
|
116
|
+
assert_equal nil, ta[:third]
|
|
117
|
+
assert_equal ['1', 'two'], ta.to_a
|
|
118
|
+
assert_equal [], ta.extras
|
|
119
|
+
end
|
|
120
|
+
|
|
88
121
|
end
|
|
@@ -37,7 +37,7 @@ class TestRakeTaskManager < Rake::TestCase
|
|
|
37
37
|
t = @tm.define_task(Rake::Task, :t)
|
|
38
38
|
assert_equal "x:t", t.name
|
|
39
39
|
end
|
|
40
|
-
assert_equal ["x:t"], @tm.tasks.
|
|
40
|
+
assert_equal ["x:t"], @tm.tasks.map { |t| t.name }
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def test_anonymous_namespace
|
|
@@ -55,7 +55,7 @@ class TestRakeTaskManager < Rake::TestCase
|
|
|
55
55
|
assert_equal "fn", t.name
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
assert_equal ["fn"], @tm.tasks.
|
|
58
|
+
assert_equal ["fn"], @tm.tasks.map { |t| t.name }
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def test_namespace_yields_same_namespace_as_returned
|
|
@@ -93,7 +93,7 @@ class TestRakeTaskManager < Rake::TestCase
|
|
|
93
93
|
bb = @tm.define_task(Rake::Task, :bb)
|
|
94
94
|
bot_z = @tm.define_task(Rake::Task, :z)
|
|
95
95
|
|
|
96
|
-
assert_equal
|
|
96
|
+
assert_equal Rake::Scope.make("b", "a"), @tm.current_scope
|
|
97
97
|
|
|
98
98
|
assert_equal bb, @tm["a:b:bb"]
|
|
99
99
|
assert_equal aa, @tm["a:aa"]
|
|
@@ -101,10 +101,11 @@ class TestRakeTaskManager < Rake::TestCase
|
|
|
101
101
|
assert_equal bot_z, @tm["z"]
|
|
102
102
|
assert_equal mid_z, @tm["^z"]
|
|
103
103
|
assert_equal top_z, @tm["^^z"]
|
|
104
|
+
assert_equal top_z, @tm["^^^z"] # Over the top
|
|
104
105
|
assert_equal top_z, @tm["rake:z"]
|
|
105
106
|
end
|
|
106
107
|
|
|
107
|
-
assert_equal
|
|
108
|
+
assert_equal Rake::Scope.make("a"), @tm.current_scope
|
|
108
109
|
|
|
109
110
|
assert_equal bb, @tm["a:b:bb"]
|
|
110
111
|
assert_equal aa, @tm["a:aa"]
|
|
@@ -113,18 +114,19 @@ class TestRakeTaskManager < Rake::TestCase
|
|
|
113
114
|
assert_equal aa, @tm["aa"]
|
|
114
115
|
assert_equal mid_z, @tm["z"]
|
|
115
116
|
assert_equal top_z, @tm["^z"]
|
|
117
|
+
assert_equal top_z, @tm["^^z"] # Over the top
|
|
116
118
|
assert_equal top_z, @tm["rake:z"]
|
|
117
119
|
end
|
|
118
120
|
|
|
119
|
-
assert_equal
|
|
121
|
+
assert_equal Rake::Scope.make, @tm.current_scope
|
|
120
122
|
|
|
121
|
-
assert_equal
|
|
122
|
-
assert_equal
|
|
123
|
-
assert_equal
|
|
123
|
+
assert_equal Rake::Scope.make, xx.scope
|
|
124
|
+
assert_equal Rake::Scope.make('a'), aa.scope
|
|
125
|
+
assert_equal Rake::Scope.make('b', 'a'), bb.scope
|
|
124
126
|
end
|
|
125
127
|
|
|
126
128
|
def test_lookup_with_explicit_scopes
|
|
127
|
-
t1, t2, t3, s = (0...4).
|
|
129
|
+
t1, t2, t3, s = (0...4).map { nil }
|
|
128
130
|
t1 = @tm.define_task(Rake::Task, :t)
|
|
129
131
|
@tm.in_namespace("a") do
|
|
130
132
|
t2 = @tm.define_task(Rake::Task, :t)
|
|
@@ -133,11 +135,11 @@ class TestRakeTaskManager < Rake::TestCase
|
|
|
133
135
|
t3 = @tm.define_task(Rake::Task, :t)
|
|
134
136
|
end
|
|
135
137
|
end
|
|
136
|
-
assert_equal t1, @tm[:t,
|
|
137
|
-
assert_equal t2, @tm[:t,
|
|
138
|
-
assert_equal t3, @tm[:t,
|
|
139
|
-
assert_equal s, @tm[:s,
|
|
140
|
-
assert_equal s, @tm[:s,
|
|
138
|
+
assert_equal t1, @tm[:t, Rake::Scope.make]
|
|
139
|
+
assert_equal t2, @tm[:t, Rake::Scope.make("a")]
|
|
140
|
+
assert_equal t3, @tm[:t, Rake::Scope.make("b", "a")]
|
|
141
|
+
assert_equal s, @tm[:s, Rake::Scope.make("b", "a")]
|
|
142
|
+
assert_equal s, @tm[:s, Rake::Scope.make("a")]
|
|
141
143
|
end
|
|
142
144
|
|
|
143
145
|
def test_correctly_scoped_prerequisites_are_invoked
|
|
@@ -154,4 +156,3 @@ class TestRakeTaskManager < Rake::TestCase
|
|
|
154
156
|
end
|
|
155
157
|
|
|
156
158
|
end
|
|
157
|
-
|
|
@@ -81,7 +81,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
|
|
|
81
81
|
|
|
82
82
|
def test_arguments_are_passed_to_block
|
|
83
83
|
t = task(:t, :a, :b) { |tt, args|
|
|
84
|
-
assert_equal(
|
|
84
|
+
assert_equal({ :a => 1, :b => 2 }, args.to_hash)
|
|
85
85
|
}
|
|
86
86
|
t.invoke(1, 2)
|
|
87
87
|
end
|
|
@@ -121,7 +121,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
|
|
|
121
121
|
assert_equal "T", t.comment
|
|
122
122
|
assert_equal "[a,b]", t.arg_description
|
|
123
123
|
assert_equal "tt[a,b]", t.name_with_args
|
|
124
|
-
assert_equal [:a, :b],t.arg_names
|
|
124
|
+
assert_equal [:a, :b], t.arg_names
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
def test_named_args_are_passed_to_prereqs
|
data/test/test_rake_test_task.rb
CHANGED
|
@@ -28,7 +28,7 @@ class TestRakeTestTask < Rake::TestCase
|
|
|
28
28
|
assert Task.task_defined?(:example)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def
|
|
31
|
+
def test_file_list_env_test
|
|
32
32
|
ENV['TEST'] = 'testfile.rb'
|
|
33
33
|
tt = Rake::TestTask.new do |t|
|
|
34
34
|
t.pattern = '*'
|
|
@@ -117,4 +117,3 @@ class TestRakeTestTask < Rake::TestCase
|
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
end
|
|
120
|
-
|
|
@@ -7,21 +7,28 @@ class TestRakeTestThreadPool < Rake::TestCase
|
|
|
7
7
|
|
|
8
8
|
def test_pool_executes_in_current_thread_for_zero_threads
|
|
9
9
|
pool = ThreadPool.new(0)
|
|
10
|
-
f = pool.future{Thread.current}
|
|
10
|
+
f = pool.future { Thread.current }
|
|
11
11
|
pool.join
|
|
12
12
|
assert_equal Thread.current, f.value
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def test_pool_executes_in_other_thread_for_pool_of_size_one
|
|
16
16
|
pool = ThreadPool.new(1)
|
|
17
|
-
f = pool.future{Thread.current}
|
|
17
|
+
f = pool.future { Thread.current }
|
|
18
18
|
pool.join
|
|
19
19
|
refute_equal Thread.current, f.value
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def test_pool_executes_in_two_other_threads_for_pool_of_size_two
|
|
23
23
|
pool = ThreadPool.new(2)
|
|
24
|
-
threads = 2.times.
|
|
24
|
+
threads = 2.times.map {
|
|
25
|
+
pool.future {
|
|
26
|
+
sleep 0.1
|
|
27
|
+
Thread.current
|
|
28
|
+
}
|
|
29
|
+
}.each { |f|
|
|
30
|
+
f.value
|
|
31
|
+
}
|
|
25
32
|
|
|
26
33
|
refute_equal threads[0], threads[1]
|
|
27
34
|
refute_equal Thread.current, threads[0]
|
|
@@ -35,14 +42,14 @@ class TestRakeTestThreadPool < Rake::TestCase
|
|
|
35
42
|
10.times.each do
|
|
36
43
|
pool.future do
|
|
37
44
|
sleep 0.02
|
|
38
|
-
t_mutex.synchronize{ threads << Thread.current }
|
|
45
|
+
t_mutex.synchronize { threads << Thread.current }
|
|
39
46
|
end
|
|
40
47
|
end
|
|
41
48
|
pool.join
|
|
42
49
|
assert_equal 2, threads.count
|
|
43
50
|
end
|
|
44
51
|
|
|
45
|
-
def
|
|
52
|
+
def test_pool_future_does_not_duplicate_arguments
|
|
46
53
|
pool = ThreadPool.new(2)
|
|
47
54
|
obj = Object.new
|
|
48
55
|
captured = nil
|
|
@@ -67,7 +74,10 @@ class TestRakeTestThreadPool < Rake::TestCase
|
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
pool.join
|
|
70
|
-
assert_equal
|
|
77
|
+
assert_equal(
|
|
78
|
+
true,
|
|
79
|
+
pool.__send__(:__queue__).empty?,
|
|
80
|
+
"queue should be empty")
|
|
71
81
|
end
|
|
72
82
|
|
|
73
83
|
CustomError = Class.new(StandardError)
|
|
@@ -78,8 +88,8 @@ class TestRakeTestThreadPool < Rake::TestCase
|
|
|
78
88
|
pool = ThreadPool.new(10)
|
|
79
89
|
|
|
80
90
|
deep_exception_block = lambda do |count|
|
|
81
|
-
raise CustomError if
|
|
82
|
-
pool.future(count-1, &deep_exception_block).value
|
|
91
|
+
raise CustomError if count < 1
|
|
92
|
+
pool.future(count - 1, &deep_exception_block).value
|
|
83
93
|
end
|
|
84
94
|
|
|
85
95
|
assert_raises(CustomError) do
|
|
@@ -91,12 +101,22 @@ class TestRakeTestThreadPool < Rake::TestCase
|
|
|
91
101
|
pool = ThreadPool.new(5)
|
|
92
102
|
|
|
93
103
|
common_dependency_a = pool.future { sleep 0.2 }
|
|
94
|
-
futures_a = 10.times.
|
|
104
|
+
futures_a = 10.times.map {
|
|
105
|
+
pool.future {
|
|
106
|
+
common_dependency_a.value
|
|
107
|
+
sleep(rand() * 0.01)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
95
110
|
|
|
96
111
|
common_dependency_b = pool.future { futures_a.each { |f| f.value } }
|
|
97
|
-
futures_b = 10.times.
|
|
112
|
+
futures_b = 10.times.map {
|
|
113
|
+
pool.future {
|
|
114
|
+
common_dependency_b.value
|
|
115
|
+
sleep(rand() * 0.01)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
98
118
|
|
|
99
|
-
futures_b.each{|f|f.value}
|
|
119
|
+
futures_b.each { |f| f.value }
|
|
100
120
|
pool.join
|
|
101
121
|
end
|
|
102
122
|
|
|
@@ -107,15 +127,15 @@ class TestRakeTestThreadPool < Rake::TestCase
|
|
|
107
127
|
b = 5
|
|
108
128
|
c = 3
|
|
109
129
|
|
|
110
|
-
result = a.times.
|
|
130
|
+
result = a.times.map do
|
|
111
131
|
pool.future do
|
|
112
|
-
b.times.
|
|
132
|
+
b.times.map do
|
|
113
133
|
pool.future { sleep rand * 0.001; c }
|
|
114
|
-
end.
|
|
134
|
+
end.reduce(0) { |m, f| m + f.value }
|
|
115
135
|
end
|
|
116
|
-
end.
|
|
136
|
+
end.reduce(0) { |m, f| m + f.value }
|
|
117
137
|
|
|
118
|
-
assert_equal
|
|
138
|
+
assert_equal a * b * c, result
|
|
119
139
|
pool.join
|
|
120
140
|
end
|
|
121
141
|
|
|
@@ -5,7 +5,7 @@ require 'rake/thread_history_display'
|
|
|
5
5
|
class TestThreadHistoryDisplay < Rake::TestCase
|
|
6
6
|
def setup
|
|
7
7
|
super
|
|
8
|
-
@time =
|
|
8
|
+
@time = 1_000_000
|
|
9
9
|
@stats = []
|
|
10
10
|
@display = Rake::ThreadHistoryDisplay.new(@stats)
|
|
11
11
|
end
|
|
@@ -60,24 +60,34 @@ class TestThreadHistoryDisplay < Rake::TestCase
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def test_thread_deleted
|
|
63
|
-
@stats << event(
|
|
63
|
+
@stats << event(
|
|
64
|
+
:thread_deleted,
|
|
65
|
+
:deleted_thread => 123_456,
|
|
66
|
+
:thread_count => 12)
|
|
64
67
|
out, _ = capture_io do
|
|
65
68
|
@display.show
|
|
66
69
|
end
|
|
67
|
-
assert_match(
|
|
70
|
+
assert_match(
|
|
71
|
+
/^ *1000000 +A +thread_deleted( +deleted_thread:B| +thread_count:12){2}$/,
|
|
72
|
+
out)
|
|
68
73
|
end
|
|
69
74
|
|
|
70
75
|
def test_thread_created
|
|
71
|
-
@stats << event(
|
|
76
|
+
@stats << event(
|
|
77
|
+
:thread_created,
|
|
78
|
+
:new_thread => 123_456,
|
|
79
|
+
:thread_count => 13)
|
|
72
80
|
out, _ = capture_io do
|
|
73
81
|
@display.show
|
|
74
82
|
end
|
|
75
|
-
assert_match(
|
|
83
|
+
assert_match(
|
|
84
|
+
/^ *1000000 +A +thread_created( +new_thread:B| +thread_count:13){2}$/,
|
|
85
|
+
out)
|
|
76
86
|
end
|
|
77
87
|
|
|
78
88
|
private
|
|
79
89
|
|
|
80
|
-
def event(type, data={})
|
|
90
|
+
def event(type, data = {})
|
|
81
91
|
result = {
|
|
82
92
|
:event => type,
|
|
83
93
|
:time => @time / 1_000_000.0,
|
data/test/test_trace_output.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rake
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 10.0
|
|
4
|
+
version: 10.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jim Weirich
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-06-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -69,6 +69,7 @@ extra_rdoc_files:
|
|
|
69
69
|
- doc/release_notes/rake-10.0.1.rdoc
|
|
70
70
|
- doc/release_notes/rake-10.0.2.rdoc
|
|
71
71
|
- doc/release_notes/rake-10.0.3.rdoc
|
|
72
|
+
- doc/release_notes/rake-10.1.0.rdoc
|
|
72
73
|
files:
|
|
73
74
|
- .gemtest
|
|
74
75
|
- install.rb
|
|
@@ -105,6 +106,7 @@ files:
|
|
|
105
106
|
- lib/rake/gempackagetask.rb
|
|
106
107
|
- lib/rake/invocation_chain.rb
|
|
107
108
|
- lib/rake/invocation_exception_mixin.rb
|
|
109
|
+
- lib/rake/linked_list.rb
|
|
108
110
|
- lib/rake/loaders/makefile.rb
|
|
109
111
|
- lib/rake/multi_task.rb
|
|
110
112
|
- lib/rake/name_space.rb
|
|
@@ -120,6 +122,7 @@ files:
|
|
|
120
122
|
- lib/rake/ruby182_test_unit_fix.rb
|
|
121
123
|
- lib/rake/rule_recursion_overflow_error.rb
|
|
122
124
|
- lib/rake/runtest.rb
|
|
125
|
+
- lib/rake/scope.rb
|
|
123
126
|
- lib/rake/task.rb
|
|
124
127
|
- lib/rake/task_argument_error.rb
|
|
125
128
|
- lib/rake/task_arguments.rb
|
|
@@ -133,6 +136,8 @@ files:
|
|
|
133
136
|
- lib/rake/win32.rb
|
|
134
137
|
- test/file_creation.rb
|
|
135
138
|
- test/helper.rb
|
|
139
|
+
- test/support/rakefile_definitions.rb
|
|
140
|
+
- test/support/ruby_runner.rb
|
|
136
141
|
- test/test_private_reader.rb
|
|
137
142
|
- test/test_rake.rb
|
|
138
143
|
- test/test_rake_application.rb
|
|
@@ -152,6 +157,7 @@ files:
|
|
|
152
157
|
- test/test_rake_ftp_file.rb
|
|
153
158
|
- test/test_rake_functional.rb
|
|
154
159
|
- test/test_rake_invocation_chain.rb
|
|
160
|
+
- test/test_rake_linked_list.rb
|
|
155
161
|
- test/test_rake_makefile_loader.rb
|
|
156
162
|
- test/test_rake_multi_task.rb
|
|
157
163
|
- test/test_rake_name_space.rb
|
|
@@ -164,6 +170,7 @@ files:
|
|
|
164
170
|
- test/test_rake_reduce_compat.rb
|
|
165
171
|
- test/test_rake_require.rb
|
|
166
172
|
- test/test_rake_rules.rb
|
|
173
|
+
- test/test_rake_scope.rb
|
|
167
174
|
- test/test_rake_task.rb
|
|
168
175
|
- test/test_rake_task_argument_parsing.rb
|
|
169
176
|
- test/test_rake_task_arguments.rb
|
|
@@ -218,6 +225,7 @@ files:
|
|
|
218
225
|
- doc/release_notes/rake-10.0.1.rdoc
|
|
219
226
|
- doc/release_notes/rake-10.0.2.rdoc
|
|
220
227
|
- doc/release_notes/rake-10.0.3.rdoc
|
|
228
|
+
- doc/release_notes/rake-10.1.0.rdoc
|
|
221
229
|
homepage: http://rake.rubyforge.org
|
|
222
230
|
licenses:
|
|
223
231
|
- MIT
|