rake 0.9.2 → 13.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTING.rdoc +43 -0
- data/Gemfile +10 -0
- data/History.rdoc +2386 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +64 -109
- data/Rakefile +22 -386
- data/bin/bundle +105 -0
- data/bin/console +7 -0
- data/bin/rake +20 -23
- data/bin/rdoc +29 -0
- data/bin/rubocop +29 -0
- data/bin/setup +6 -0
- data/doc/command_line_usage.rdoc +65 -21
- data/doc/glossary.rdoc +40 -49
- data/doc/jamis.rb +1 -0
- data/doc/rake.1 +156 -0
- data/doc/rakefile.rdoc +127 -62
- data/exe/rake +27 -0
- data/lib/rake.rb +37 -31
- data/lib/rake/application.rb +507 -272
- data/lib/rake/backtrace.rb +24 -0
- data/lib/rake/clean.rb +55 -8
- data/lib/rake/cloneable.rb +11 -19
- data/lib/rake/cpu_counter.rb +107 -0
- data/lib/rake/default_loader.rb +5 -0
- data/lib/rake/dsl_definition.rb +74 -46
- data/lib/rake/early_time.rb +5 -1
- data/lib/rake/ext/core.rb +5 -6
- data/lib/rake/ext/string.rb +61 -52
- data/lib/rake/file_creation_task.rb +4 -3
- data/lib/rake/file_list.rb +81 -49
- data/lib/rake/file_task.rb +15 -8
- data/lib/rake/file_utils.rb +69 -47
- data/lib/rake/file_utils_ext.rb +18 -26
- data/lib/rake/invocation_chain.rb +25 -19
- data/lib/rake/invocation_exception_mixin.rb +1 -0
- data/lib/rake/late_time.rb +18 -0
- data/lib/rake/linked_list.rb +112 -0
- data/lib/rake/loaders/makefile.rb +23 -9
- data/lib/rake/multi_task.rb +4 -6
- data/lib/rake/name_space.rb +36 -23
- data/lib/rake/packagetask.rb +71 -34
- data/lib/rake/phony.rb +16 -0
- data/lib/rake/private_reader.rb +21 -0
- data/lib/rake/promise.rb +100 -0
- data/lib/rake/pseudo_status.rb +8 -2
- data/lib/rake/rake_module.rb +41 -3
- data/lib/rake/rake_test_loader.rb +21 -7
- data/lib/rake/rule_recursion_overflow_error.rb +2 -2
- data/lib/rake/scope.rb +43 -0
- data/lib/rake/task.rb +186 -79
- data/lib/rake/task_argument_error.rb +1 -0
- data/lib/rake/task_arguments.rb +50 -15
- data/lib/rake/task_manager.rb +89 -65
- data/lib/rake/tasklib.rb +2 -12
- data/lib/rake/testtask.rb +61 -63
- data/lib/rake/thread_history_display.rb +49 -0
- data/lib/rake/thread_pool.rb +163 -0
- data/lib/rake/trace_output.rb +23 -0
- data/lib/rake/version.rb +7 -7
- data/lib/rake/win32.rb +14 -18
- data/rake.gemspec +43 -0
- metadata +82 -221
- data/.gemtest +0 -0
- data/CHANGES +0 -509
- data/RRR +0 -9
- data/TODO +0 -20
- data/doc/rake.1.gz +0 -0
- data/doc/release_notes/rake-0.4.14.rdoc +0 -23
- data/doc/release_notes/rake-0.4.15.rdoc +0 -35
- data/doc/release_notes/rake-0.5.0.rdoc +0 -53
- data/doc/release_notes/rake-0.5.3.rdoc +0 -78
- data/doc/release_notes/rake-0.5.4.rdoc +0 -46
- data/doc/release_notes/rake-0.6.0.rdoc +0 -141
- data/doc/release_notes/rake-0.7.0.rdoc +0 -119
- data/doc/release_notes/rake-0.7.1.rdoc +0 -59
- data/doc/release_notes/rake-0.7.2.rdoc +0 -121
- data/doc/release_notes/rake-0.7.3.rdoc +0 -47
- data/doc/release_notes/rake-0.8.0.rdoc +0 -114
- data/doc/release_notes/rake-0.8.2.rdoc +0 -165
- data/doc/release_notes/rake-0.8.3.rdoc +0 -112
- data/doc/release_notes/rake-0.8.4.rdoc +0 -147
- data/doc/release_notes/rake-0.8.5.rdoc +0 -53
- data/doc/release_notes/rake-0.8.6.rdoc +0 -55
- data/doc/release_notes/rake-0.8.7.rdoc +0 -55
- data/doc/release_notes/rake-0.9.0.rdoc +0 -112
- data/doc/release_notes/rake-0.9.1.rdoc +0 -52
- data/doc/release_notes/rake-0.9.2.rdoc +0 -49
- data/install.rb +0 -90
- data/lib/rake/alt_system.rb +0 -109
- data/lib/rake/classic_namespace.rb +0 -9
- data/lib/rake/contrib/compositepublisher.rb +0 -21
- data/lib/rake/contrib/ftptools.rb +0 -150
- data/lib/rake/contrib/publisher.rb +0 -69
- data/lib/rake/contrib/rubyforgepublisher.rb +0 -16
- data/lib/rake/contrib/sshpublisher.rb +0 -45
- data/lib/rake/contrib/sys.rb +0 -191
- data/lib/rake/ext/module.rb +0 -39
- data/lib/rake/ext/time.rb +0 -14
- data/lib/rake/gempackagetask.rb +0 -13
- data/lib/rake/pathmap.rb +0 -1
- data/lib/rake/rdoctask.rb +0 -230
- data/lib/rake/ruby182_test_unit_fix.rb +0 -25
- data/lib/rake/runtest.rb +0 -21
- data/test/check_expansion.rb +0 -5
- data/test/check_no_expansion.rb +0 -5
- data/test/data/access/Rakefile +0 -35
- data/test/data/chains/Rakefile +0 -15
- data/test/data/comments/Rakefile +0 -18
- data/test/data/default/Rakefile +0 -17
- data/test/data/deprecated_import/Rakefile +0 -1
- data/test/data/dryrun/Rakefile +0 -22
- data/test/data/extra/Rakefile +0 -1
- data/test/data/file_creation_task/Rakefile +0 -31
- data/test/data/imports/Rakefile +0 -19
- data/test/data/imports/deps.mf +0 -1
- data/test/data/multidesc/Rakefile +0 -15
- data/test/data/namespace/Rakefile +0 -64
- data/test/data/rakelib/test1.rb +0 -4
- data/test/data/rbext/rakefile.rb +0 -3
- data/test/data/sample.mf +0 -14
- data/test/data/statusreturn/Rakefile +0 -6
- data/test/data/unittest/Rakefile +0 -1
- data/test/data/verbose/Rakefile +0 -34
- data/test/file_creation.rb +0 -34
- data/test/helper.rb +0 -44
- data/test/in_environment.rb +0 -35
- data/test/reqfile.rb +0 -3
- data/test/reqfile2.rb +0 -3
- data/test/shellcommand.rb +0 -3
- data/test/test_rake.rb +0 -38
- data/test/test_rake_application.rb +0 -364
- data/test/test_rake_application_options.rb +0 -382
- data/test/test_rake_clean.rb +0 -12
- data/test/test_rake_definitions.rb +0 -80
- data/test/test_rake_directory_task.rb +0 -55
- data/test/test_rake_dsl.rb +0 -73
- data/test/test_rake_early_time.rb +0 -31
- data/test/test_rake_extension.rb +0 -59
- data/test/test_rake_file_creation_task.rb +0 -62
- data/test/test_rake_file_list.rb +0 -633
- data/test/test_rake_file_list_path_map.rb +0 -8
- data/test/test_rake_file_task.rb +0 -104
- data/test/test_rake_file_utils.rb +0 -252
- data/test/test_rake_ftp_file.rb +0 -59
- data/test/test_rake_functional.rb +0 -468
- data/test/test_rake_invocation_chain.rb +0 -52
- data/test/test_rake_makefile_loader.rb +0 -23
- data/test/test_rake_multi_task.rb +0 -51
- data/test/test_rake_name_space.rb +0 -43
- data/test/test_rake_package_task.rb +0 -78
- data/test/test_rake_path_map.rb +0 -157
- data/test/test_rake_path_map_explode.rb +0 -31
- data/test/test_rake_path_map_partial.rb +0 -18
- data/test/test_rake_pseudo_status.rb +0 -20
- data/test/test_rake_rdoc_task.rb +0 -81
- data/test/test_rake_require.rb +0 -35
- data/test/test_rake_rules.rb +0 -346
- data/test/test_rake_task.rb +0 -271
- data/test/test_rake_task_argument_parsing.rb +0 -116
- data/test/test_rake_task_arguments.rb +0 -86
- data/test/test_rake_task_lib.rb +0 -9
- data/test/test_rake_task_manager.rb +0 -145
- data/test/test_rake_task_manager_argument_resolution.rb +0 -36
- data/test/test_rake_task_with_arguments.rb +0 -162
- data/test/test_rake_test_task.rb +0 -122
- data/test/test_rake_top_level_functions.rb +0 -76
- data/test/test_rake_win32.rb +0 -83
- data/test/test_sys.rb +0 -20
data/test/test_rake_task_lib.rb
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestRakeTaskManager < Rake::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
super
|
7
|
-
|
8
|
-
@tm = Rake::TestCase::TaskManager.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_create_task_manager
|
12
|
-
refute_nil @tm
|
13
|
-
assert_equal [], @tm.tasks
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_define_task
|
17
|
-
t = @tm.define_task(Rake::Task, :t)
|
18
|
-
assert_equal "t", t.name
|
19
|
-
assert_equal @tm, t.application
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_name_lookup
|
23
|
-
t = @tm.define_task(Rake::Task, :t)
|
24
|
-
assert_equal t, @tm[:t]
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_namespace_task_create
|
28
|
-
@tm.in_namespace("x") do
|
29
|
-
t = @tm.define_task(Rake::Task, :t)
|
30
|
-
assert_equal "x:t", t.name
|
31
|
-
end
|
32
|
-
assert_equal ["x:t"], @tm.tasks.collect { |t| t.name }
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_anonymous_namespace
|
36
|
-
anon_ns = @tm.in_namespace(nil) do
|
37
|
-
t = @tm.define_task(Rake::Task, :t)
|
38
|
-
assert_equal "_anon_1:t", t.name
|
39
|
-
end
|
40
|
-
task = anon_ns[:t]
|
41
|
-
assert_equal "_anon_1:t", task.name
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_create_filetask_in_namespace
|
45
|
-
@tm.in_namespace("x") do
|
46
|
-
t = @tm.define_task(Rake::FileTask, "fn")
|
47
|
-
assert_equal "fn", t.name
|
48
|
-
end
|
49
|
-
assert_equal ["fn"], @tm.tasks.collect { |t| t.name }
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_namespace_yields_same_namespace_as_returned
|
53
|
-
yielded_namespace = nil
|
54
|
-
returned_namespace = @tm.in_namespace("x") do |ns|
|
55
|
-
yielded_namespace = ns
|
56
|
-
end
|
57
|
-
assert_equal returned_namespace, yielded_namespace
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_name_lookup_with_implicit_file_tasks
|
61
|
-
t = @tm["README.rdoc"]
|
62
|
-
assert_equal "README.rdoc", t.name
|
63
|
-
assert Rake::FileTask === t
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_name_lookup_with_nonexistent_task
|
67
|
-
assert_raises(RuntimeError) {
|
68
|
-
@tm["DOES NOT EXIST"]
|
69
|
-
}
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_name_lookup_in_multiple_scopes
|
73
|
-
aa = nil
|
74
|
-
bb = nil
|
75
|
-
xx = @tm.define_task(Rake::Task, :xx)
|
76
|
-
top_z = @tm.define_task(Rake::Task, :z)
|
77
|
-
@tm.in_namespace("a") do
|
78
|
-
aa = @tm.define_task(Rake::Task, :aa)
|
79
|
-
mid_z = @tm.define_task(Rake::Task, :z)
|
80
|
-
@tm.in_namespace("b") do
|
81
|
-
bb = @tm.define_task(Rake::Task, :bb)
|
82
|
-
bot_z = @tm.define_task(Rake::Task, :z)
|
83
|
-
|
84
|
-
assert_equal ["a", "b"], @tm.current_scope
|
85
|
-
|
86
|
-
assert_equal bb, @tm["a:b:bb"]
|
87
|
-
assert_equal aa, @tm["a:aa"]
|
88
|
-
assert_equal xx, @tm["xx"]
|
89
|
-
assert_equal bot_z, @tm["z"]
|
90
|
-
assert_equal mid_z, @tm["^z"]
|
91
|
-
assert_equal top_z, @tm["^^z"]
|
92
|
-
assert_equal top_z, @tm["rake:z"]
|
93
|
-
end
|
94
|
-
|
95
|
-
assert_equal ["a"], @tm.current_scope
|
96
|
-
|
97
|
-
assert_equal bb, @tm["a:b:bb"]
|
98
|
-
assert_equal aa, @tm["a:aa"]
|
99
|
-
assert_equal xx, @tm["xx"]
|
100
|
-
assert_equal bb, @tm["b:bb"]
|
101
|
-
assert_equal aa, @tm["aa"]
|
102
|
-
assert_equal mid_z, @tm["z"]
|
103
|
-
assert_equal top_z, @tm["^z"]
|
104
|
-
assert_equal top_z, @tm["rake:z"]
|
105
|
-
end
|
106
|
-
|
107
|
-
assert_equal [], @tm.current_scope
|
108
|
-
|
109
|
-
assert_equal [], xx.scope
|
110
|
-
assert_equal ['a'], aa.scope
|
111
|
-
assert_equal ['a', 'b'], bb.scope
|
112
|
-
end
|
113
|
-
|
114
|
-
def test_lookup_with_explicit_scopes
|
115
|
-
t1, t2, t3, s = (0...4).collect { nil }
|
116
|
-
t1 = @tm.define_task(Rake::Task, :t)
|
117
|
-
@tm.in_namespace("a") do
|
118
|
-
t2 = @tm.define_task(Rake::Task, :t)
|
119
|
-
s = @tm.define_task(Rake::Task, :s)
|
120
|
-
@tm.in_namespace("b") do
|
121
|
-
t3 = @tm.define_task(Rake::Task, :t)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
assert_equal t1, @tm[:t, []]
|
125
|
-
assert_equal t2, @tm[:t, ["a"]]
|
126
|
-
assert_equal t3, @tm[:t, ["a", "b"]]
|
127
|
-
assert_equal s, @tm[:s, ["a", "b"]]
|
128
|
-
assert_equal s, @tm[:s, ["a"]]
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_correctly_scoped_prerequisites_are_invoked
|
132
|
-
values = []
|
133
|
-
@tm = Rake::Application.new
|
134
|
-
@tm.define_task(Rake::Task, :z) do values << "top z" end
|
135
|
-
@tm.in_namespace("a") do
|
136
|
-
@tm.define_task(Rake::Task, :z) do values << "next z" end
|
137
|
-
@tm.define_task(Rake::Task, :x => :z)
|
138
|
-
end
|
139
|
-
|
140
|
-
@tm["a:x"].invoke
|
141
|
-
assert_equal ["next z"], values
|
142
|
-
end
|
143
|
-
|
144
|
-
end
|
145
|
-
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestRakeTaskManagerArgumentResolution < Rake::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
super
|
7
|
-
|
8
|
-
Rake.application.options.ignore_deprecate = true
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
Rake.application.options.ignore_deprecate = false
|
13
|
-
|
14
|
-
super
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_good_arg_patterns
|
18
|
-
assert_equal [:t, [], []], task(:t)
|
19
|
-
assert_equal [:t, [], [:x]], task(:t => :x)
|
20
|
-
assert_equal [:t, [], [:x, :y]], task(:t => [:x, :y])
|
21
|
-
|
22
|
-
assert_equal [:t, [:a, :b], []], task(:t, :a, :b)
|
23
|
-
assert_equal [:t, [], [:x]], task(:t, :needs => :x)
|
24
|
-
assert_equal [:t, [:a, :b], [:x]], task(:t, :a, :b, :needs => :x)
|
25
|
-
assert_equal [:t, [:a, :b], [:x, :y]], task(:t, :a, :b, :needs => [:x, :y])
|
26
|
-
|
27
|
-
assert_equal [:t, [:a, :b], []], task(:t, [:a, :b])
|
28
|
-
assert_equal [:t, [:a, :b], [:x]], task(:t, [:a, :b] => :x)
|
29
|
-
assert_equal [:t, [:a, :b], [:x, :y]], task(:t, [:a, :b] => [:x, :y])
|
30
|
-
end
|
31
|
-
|
32
|
-
def task(*args)
|
33
|
-
tm = Rake::TestCase::TaskManager.new
|
34
|
-
tm.resolve_args(args)
|
35
|
-
end
|
36
|
-
end
|
@@ -1,162 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestRakeTaskWithArguments < Rake::TestCase
|
4
|
-
include Rake
|
5
|
-
|
6
|
-
def setup
|
7
|
-
super
|
8
|
-
|
9
|
-
Task.clear
|
10
|
-
Rake::TaskManager.record_task_metadata = true
|
11
|
-
end
|
12
|
-
|
13
|
-
def teardown
|
14
|
-
Rake::TaskManager.record_task_metadata = false
|
15
|
-
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_no_args_given
|
20
|
-
t = task :t
|
21
|
-
assert_equal [], t.arg_names
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_args_given
|
25
|
-
t = task :t, :a, :b
|
26
|
-
assert_equal [:a, :b], t.arg_names
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_name_and_needs
|
30
|
-
t = task(:t => [:pre])
|
31
|
-
assert_equal "t", t.name
|
32
|
-
assert_equal [], t.arg_names
|
33
|
-
assert_equal ["pre"], t.prerequisites
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_name_args_and_explicit_needs
|
37
|
-
ignore_deprecations do
|
38
|
-
t = task(:t, :x, :y, :needs => [:pre])
|
39
|
-
assert_equal "t", t.name
|
40
|
-
assert_equal [:x, :y], t.arg_names
|
41
|
-
assert_equal ["pre"], t.prerequisites
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_illegal_keys_in_task_name_hash
|
46
|
-
ignore_deprecations do
|
47
|
-
assert_raises RuntimeError do
|
48
|
-
t = task(:t, :x, :y => 1, :needs => [:pre])
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_arg_list_is_empty_if_no_args_given
|
54
|
-
t = task(:t) { |tt, args| assert_equal({}, args.to_hash) }
|
55
|
-
t.invoke(1, 2, 3)
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_tasks_can_access_arguments_as_hash
|
59
|
-
t = task :t, :a, :b, :c do |tt, args|
|
60
|
-
assert_equal({:a => 1, :b => 2, :c => 3}, args.to_hash)
|
61
|
-
assert_equal 1, args[:a]
|
62
|
-
assert_equal 2, args[:b]
|
63
|
-
assert_equal 3, args[:c]
|
64
|
-
assert_equal 1, args.a
|
65
|
-
assert_equal 2, args.b
|
66
|
-
assert_equal 3, args.c
|
67
|
-
end
|
68
|
-
t.invoke(1, 2, 3)
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_actions_of_various_arity_are_ok_with_args
|
72
|
-
notes = []
|
73
|
-
t = task(:t, :x) do
|
74
|
-
notes << :a
|
75
|
-
end
|
76
|
-
t.enhance do | |
|
77
|
-
notes << :b
|
78
|
-
end
|
79
|
-
t.enhance do |task|
|
80
|
-
notes << :c
|
81
|
-
assert_kind_of Task, task
|
82
|
-
end
|
83
|
-
t.enhance do |t2, args|
|
84
|
-
notes << :d
|
85
|
-
assert_equal t, t2
|
86
|
-
assert_equal({:x => 1}, args.to_hash)
|
87
|
-
end
|
88
|
-
t.invoke(1)
|
89
|
-
assert_equal [:a, :b, :c, :d], notes
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_arguments_are_passed_to_block
|
93
|
-
t = task(:t, :a, :b) { |tt, args|
|
94
|
-
assert_equal( { :a => 1, :b => 2 }, args.to_hash )
|
95
|
-
}
|
96
|
-
t.invoke(1, 2)
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_extra_parameters_are_ignored
|
100
|
-
t = task(:t, :a) { |tt, args|
|
101
|
-
assert_equal 1, args.a
|
102
|
-
assert_nil args.b
|
103
|
-
}
|
104
|
-
t.invoke(1, 2)
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_arguments_are_passed_to_all_blocks
|
108
|
-
counter = 0
|
109
|
-
t = task :t, :a
|
110
|
-
task :t do |tt, args|
|
111
|
-
assert_equal 1, args.a
|
112
|
-
counter += 1
|
113
|
-
end
|
114
|
-
task :t do |tt, args|
|
115
|
-
assert_equal 1, args.a
|
116
|
-
counter += 1
|
117
|
-
end
|
118
|
-
t.invoke(1)
|
119
|
-
assert_equal 2, counter
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_block_with_no_parameters_is_ok
|
123
|
-
t = task(:t) { }
|
124
|
-
t.invoke(1, 2)
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_name_with_args
|
128
|
-
desc "T"
|
129
|
-
t = task(:tt, :a, :b)
|
130
|
-
assert_equal "tt", t.name
|
131
|
-
assert_equal "T", t.comment
|
132
|
-
assert_equal "[a,b]", t.arg_description
|
133
|
-
assert_equal "tt[a,b]", t.name_with_args
|
134
|
-
assert_equal [:a, :b],t.arg_names
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_named_args_are_passed_to_prereqs
|
138
|
-
value = nil
|
139
|
-
pre = task(:pre, :rev) { |t, args| value = args.rev }
|
140
|
-
t = task(:t, [:name, :rev] => [:pre])
|
141
|
-
t.invoke("bill", "1.2")
|
142
|
-
assert_equal "1.2", value
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_args_not_passed_if_no_prereq_names
|
146
|
-
pre = task(:pre) { |t, args|
|
147
|
-
assert_equal({}, args.to_hash)
|
148
|
-
assert_equal "bill", args.name
|
149
|
-
}
|
150
|
-
t = task(:t, [:name, :rev] => [:pre])
|
151
|
-
t.invoke("bill", "1.2")
|
152
|
-
end
|
153
|
-
|
154
|
-
def test_args_not_passed_if_no_arg_names
|
155
|
-
pre = task(:pre, :rev) { |t, args|
|
156
|
-
assert_equal({}, args.to_hash)
|
157
|
-
}
|
158
|
-
t = task(:t => [:pre])
|
159
|
-
t.invoke("bill", "1.2")
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
data/test/test_rake_test_task.rb
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
require 'rake/testtask'
|
3
|
-
|
4
|
-
class TestRakeTestTask < Rake::TestCase
|
5
|
-
include Rake
|
6
|
-
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
|
10
|
-
Task.clear
|
11
|
-
ENV.delete('TEST')
|
12
|
-
end
|
13
|
-
|
14
|
-
def teardown
|
15
|
-
FileUtils.rm_rf("testdata")
|
16
|
-
|
17
|
-
super
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_no_task
|
21
|
-
assert ! Task.task_defined?(:test)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_defaults
|
25
|
-
tt = Rake::TestTask.new do |t| end
|
26
|
-
refute_nil tt
|
27
|
-
assert_equal :test, tt.name
|
28
|
-
assert_equal ['lib'], tt.libs
|
29
|
-
assert_equal 'test/test*.rb', tt.pattern
|
30
|
-
assert_equal false, tt.verbose
|
31
|
-
assert Task.task_defined?(:test)
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_non_defaults
|
35
|
-
tt = Rake::TestTask.new(:example) do |t|
|
36
|
-
t.libs = ['src', 'ext']
|
37
|
-
t.pattern = 'test/tc_*.rb'
|
38
|
-
t.verbose = true
|
39
|
-
end
|
40
|
-
refute_nil tt
|
41
|
-
assert_equal :example, tt.name
|
42
|
-
assert_equal ['src', 'ext'], tt.libs
|
43
|
-
assert_equal 'test/tc_*.rb', tt.pattern
|
44
|
-
assert_equal true, tt.verbose
|
45
|
-
assert Task.task_defined?(:example)
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_pattern
|
49
|
-
tt = Rake::TestTask.new do |t|
|
50
|
-
t.pattern = '*.rb'
|
51
|
-
end
|
52
|
-
assert_equal ['*.rb'], tt.file_list.to_a
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_env_test
|
56
|
-
ENV['TEST'] = 'testfile.rb'
|
57
|
-
tt = Rake::TestTask.new do |t|
|
58
|
-
t.pattern = '*'
|
59
|
-
end
|
60
|
-
assert_equal ["testfile.rb"], tt.file_list.to_a
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_test_files
|
64
|
-
tt = Rake::TestTask.new do |t|
|
65
|
-
t.test_files = FileList['a.rb', 'b.rb']
|
66
|
-
end
|
67
|
-
assert_equal ["a.rb", 'b.rb'], tt.file_list.to_a
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_both_pattern_and_test_files
|
71
|
-
tt = Rake::TestTask.new do |t|
|
72
|
-
t.test_files = FileList['a.rb', 'b.rb']
|
73
|
-
t.pattern = '*.rb'
|
74
|
-
end
|
75
|
-
assert_equal ['a.rb', 'b.rb', '*.rb'], tt.file_list.to_a
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_direct_run_has_quoted_paths
|
79
|
-
test_task = Rake::TestTask.new(:tx) do |t|
|
80
|
-
t.loader = :direct
|
81
|
-
end
|
82
|
-
assert_match(/-e ".*"/, test_task.run_code)
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_testrb_run_has_quoted_paths_on_ruby_182
|
86
|
-
test_task = Rake::TestTask.new(:tx) do |t|
|
87
|
-
t.loader = :testrb
|
88
|
-
end
|
89
|
-
flexmock(test_task).should_receive(:ruby_version).and_return('1.8.2')
|
90
|
-
assert_match(/^-S testrb +".*"$/, test_task.run_code)
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_testrb_run_has_quoted_paths_on_ruby_186
|
94
|
-
test_task = Rake::TestTask.new(:tx) do |t|
|
95
|
-
t.loader = :testrb
|
96
|
-
end
|
97
|
-
flexmock(test_task).should_receive(:ruby_version).and_return('1.8.6')
|
98
|
-
assert_match(/^-S testrb +$/, test_task.run_code)
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_rake_run_has_quoted_paths
|
102
|
-
test_task = Rake::TestTask.new(:tx) do |t|
|
103
|
-
t.loader = :rake
|
104
|
-
end
|
105
|
-
assert_match(/".*"/, test_task.run_code)
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_nested_libs_will_be_flattened
|
109
|
-
test_task = Rake::TestTask.new(:tx) do |t|
|
110
|
-
t.libs << ["A", "B"]
|
111
|
-
end
|
112
|
-
sep = File::PATH_SEPARATOR
|
113
|
-
assert_match(/lib#{sep}A#{sep}B/, test_task.ruby_opts_string)
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_empty_lib_path_implies_no_dash_I_option
|
117
|
-
test_task = Rake::TestTask.new(:tx) do |t|
|
118
|
-
t.libs = []
|
119
|
-
end
|
120
|
-
refute_match(/-I/, test_task.ruby_opts_string)
|
121
|
-
end
|
122
|
-
end
|