rake 0.9.2 → 13.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.rdoc +43 -0
  3. data/Gemfile +10 -0
  4. data/History.rdoc +2386 -0
  5. data/MIT-LICENSE +1 -1
  6. data/README.rdoc +64 -109
  7. data/Rakefile +22 -386
  8. data/bin/bundle +105 -0
  9. data/bin/console +7 -0
  10. data/bin/rake +20 -23
  11. data/bin/rdoc +29 -0
  12. data/bin/rubocop +29 -0
  13. data/bin/setup +6 -0
  14. data/doc/command_line_usage.rdoc +65 -21
  15. data/doc/glossary.rdoc +40 -49
  16. data/doc/jamis.rb +1 -0
  17. data/doc/rake.1 +156 -0
  18. data/doc/rakefile.rdoc +127 -62
  19. data/exe/rake +27 -0
  20. data/lib/rake.rb +37 -31
  21. data/lib/rake/application.rb +507 -272
  22. data/lib/rake/backtrace.rb +24 -0
  23. data/lib/rake/clean.rb +55 -8
  24. data/lib/rake/cloneable.rb +11 -19
  25. data/lib/rake/cpu_counter.rb +107 -0
  26. data/lib/rake/default_loader.rb +5 -0
  27. data/lib/rake/dsl_definition.rb +74 -46
  28. data/lib/rake/early_time.rb +5 -1
  29. data/lib/rake/ext/core.rb +5 -6
  30. data/lib/rake/ext/string.rb +61 -52
  31. data/lib/rake/file_creation_task.rb +4 -3
  32. data/lib/rake/file_list.rb +81 -49
  33. data/lib/rake/file_task.rb +15 -8
  34. data/lib/rake/file_utils.rb +69 -47
  35. data/lib/rake/file_utils_ext.rb +18 -26
  36. data/lib/rake/invocation_chain.rb +25 -19
  37. data/lib/rake/invocation_exception_mixin.rb +1 -0
  38. data/lib/rake/late_time.rb +18 -0
  39. data/lib/rake/linked_list.rb +112 -0
  40. data/lib/rake/loaders/makefile.rb +23 -9
  41. data/lib/rake/multi_task.rb +4 -6
  42. data/lib/rake/name_space.rb +36 -23
  43. data/lib/rake/packagetask.rb +71 -34
  44. data/lib/rake/phony.rb +16 -0
  45. data/lib/rake/private_reader.rb +21 -0
  46. data/lib/rake/promise.rb +100 -0
  47. data/lib/rake/pseudo_status.rb +8 -2
  48. data/lib/rake/rake_module.rb +41 -3
  49. data/lib/rake/rake_test_loader.rb +21 -7
  50. data/lib/rake/rule_recursion_overflow_error.rb +2 -2
  51. data/lib/rake/scope.rb +43 -0
  52. data/lib/rake/task.rb +186 -79
  53. data/lib/rake/task_argument_error.rb +1 -0
  54. data/lib/rake/task_arguments.rb +50 -15
  55. data/lib/rake/task_manager.rb +89 -65
  56. data/lib/rake/tasklib.rb +2 -12
  57. data/lib/rake/testtask.rb +61 -63
  58. data/lib/rake/thread_history_display.rb +49 -0
  59. data/lib/rake/thread_pool.rb +163 -0
  60. data/lib/rake/trace_output.rb +23 -0
  61. data/lib/rake/version.rb +7 -7
  62. data/lib/rake/win32.rb +14 -18
  63. data/rake.gemspec +43 -0
  64. metadata +82 -221
  65. data/.gemtest +0 -0
  66. data/CHANGES +0 -509
  67. data/RRR +0 -9
  68. data/TODO +0 -20
  69. data/doc/rake.1.gz +0 -0
  70. data/doc/release_notes/rake-0.4.14.rdoc +0 -23
  71. data/doc/release_notes/rake-0.4.15.rdoc +0 -35
  72. data/doc/release_notes/rake-0.5.0.rdoc +0 -53
  73. data/doc/release_notes/rake-0.5.3.rdoc +0 -78
  74. data/doc/release_notes/rake-0.5.4.rdoc +0 -46
  75. data/doc/release_notes/rake-0.6.0.rdoc +0 -141
  76. data/doc/release_notes/rake-0.7.0.rdoc +0 -119
  77. data/doc/release_notes/rake-0.7.1.rdoc +0 -59
  78. data/doc/release_notes/rake-0.7.2.rdoc +0 -121
  79. data/doc/release_notes/rake-0.7.3.rdoc +0 -47
  80. data/doc/release_notes/rake-0.8.0.rdoc +0 -114
  81. data/doc/release_notes/rake-0.8.2.rdoc +0 -165
  82. data/doc/release_notes/rake-0.8.3.rdoc +0 -112
  83. data/doc/release_notes/rake-0.8.4.rdoc +0 -147
  84. data/doc/release_notes/rake-0.8.5.rdoc +0 -53
  85. data/doc/release_notes/rake-0.8.6.rdoc +0 -55
  86. data/doc/release_notes/rake-0.8.7.rdoc +0 -55
  87. data/doc/release_notes/rake-0.9.0.rdoc +0 -112
  88. data/doc/release_notes/rake-0.9.1.rdoc +0 -52
  89. data/doc/release_notes/rake-0.9.2.rdoc +0 -49
  90. data/install.rb +0 -90
  91. data/lib/rake/alt_system.rb +0 -109
  92. data/lib/rake/classic_namespace.rb +0 -9
  93. data/lib/rake/contrib/compositepublisher.rb +0 -21
  94. data/lib/rake/contrib/ftptools.rb +0 -150
  95. data/lib/rake/contrib/publisher.rb +0 -69
  96. data/lib/rake/contrib/rubyforgepublisher.rb +0 -16
  97. data/lib/rake/contrib/sshpublisher.rb +0 -45
  98. data/lib/rake/contrib/sys.rb +0 -191
  99. data/lib/rake/ext/module.rb +0 -39
  100. data/lib/rake/ext/time.rb +0 -14
  101. data/lib/rake/gempackagetask.rb +0 -13
  102. data/lib/rake/pathmap.rb +0 -1
  103. data/lib/rake/rdoctask.rb +0 -230
  104. data/lib/rake/ruby182_test_unit_fix.rb +0 -25
  105. data/lib/rake/runtest.rb +0 -21
  106. data/test/check_expansion.rb +0 -5
  107. data/test/check_no_expansion.rb +0 -5
  108. data/test/data/access/Rakefile +0 -35
  109. data/test/data/chains/Rakefile +0 -15
  110. data/test/data/comments/Rakefile +0 -18
  111. data/test/data/default/Rakefile +0 -17
  112. data/test/data/deprecated_import/Rakefile +0 -1
  113. data/test/data/dryrun/Rakefile +0 -22
  114. data/test/data/extra/Rakefile +0 -1
  115. data/test/data/file_creation_task/Rakefile +0 -31
  116. data/test/data/imports/Rakefile +0 -19
  117. data/test/data/imports/deps.mf +0 -1
  118. data/test/data/multidesc/Rakefile +0 -15
  119. data/test/data/namespace/Rakefile +0 -64
  120. data/test/data/rakelib/test1.rb +0 -4
  121. data/test/data/rbext/rakefile.rb +0 -3
  122. data/test/data/sample.mf +0 -14
  123. data/test/data/statusreturn/Rakefile +0 -6
  124. data/test/data/unittest/Rakefile +0 -1
  125. data/test/data/verbose/Rakefile +0 -34
  126. data/test/file_creation.rb +0 -34
  127. data/test/helper.rb +0 -44
  128. data/test/in_environment.rb +0 -35
  129. data/test/reqfile.rb +0 -3
  130. data/test/reqfile2.rb +0 -3
  131. data/test/shellcommand.rb +0 -3
  132. data/test/test_rake.rb +0 -38
  133. data/test/test_rake_application.rb +0 -364
  134. data/test/test_rake_application_options.rb +0 -382
  135. data/test/test_rake_clean.rb +0 -12
  136. data/test/test_rake_definitions.rb +0 -80
  137. data/test/test_rake_directory_task.rb +0 -55
  138. data/test/test_rake_dsl.rb +0 -73
  139. data/test/test_rake_early_time.rb +0 -31
  140. data/test/test_rake_extension.rb +0 -59
  141. data/test/test_rake_file_creation_task.rb +0 -62
  142. data/test/test_rake_file_list.rb +0 -633
  143. data/test/test_rake_file_list_path_map.rb +0 -8
  144. data/test/test_rake_file_task.rb +0 -104
  145. data/test/test_rake_file_utils.rb +0 -252
  146. data/test/test_rake_ftp_file.rb +0 -59
  147. data/test/test_rake_functional.rb +0 -468
  148. data/test/test_rake_invocation_chain.rb +0 -52
  149. data/test/test_rake_makefile_loader.rb +0 -23
  150. data/test/test_rake_multi_task.rb +0 -51
  151. data/test/test_rake_name_space.rb +0 -43
  152. data/test/test_rake_package_task.rb +0 -78
  153. data/test/test_rake_path_map.rb +0 -157
  154. data/test/test_rake_path_map_explode.rb +0 -31
  155. data/test/test_rake_path_map_partial.rb +0 -18
  156. data/test/test_rake_pseudo_status.rb +0 -20
  157. data/test/test_rake_rdoc_task.rb +0 -81
  158. data/test/test_rake_require.rb +0 -35
  159. data/test/test_rake_rules.rb +0 -346
  160. data/test/test_rake_task.rb +0 -271
  161. data/test/test_rake_task_argument_parsing.rb +0 -116
  162. data/test/test_rake_task_arguments.rb +0 -86
  163. data/test/test_rake_task_lib.rb +0 -9
  164. data/test/test_rake_task_manager.rb +0 -145
  165. data/test/test_rake_task_manager_argument_resolution.rb +0 -36
  166. data/test/test_rake_task_with_arguments.rb +0 -162
  167. data/test/test_rake_test_task.rb +0 -122
  168. data/test/test_rake_top_level_functions.rb +0 -76
  169. data/test/test_rake_win32.rb +0 -83
  170. data/test/test_sys.rb +0 -20
@@ -1,20 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- class TestRakePseudoStatus < Rake::TestCase
4
- def test_with_zero_exit_status
5
- s = Rake::PseudoStatus.new
6
- assert_equal 0, s.exitstatus
7
- assert_equal 0, s.to_i
8
- assert_equal 0, s >> 8
9
- assert ! s.stopped?
10
- assert s.exited?
11
- end
12
- def test_with_99_exit_status
13
- s = Rake::PseudoStatus.new(99)
14
- assert_equal 99, s.exitstatus
15
- assert_equal 25344, s.to_i
16
- assert_equal 99, s >> 8
17
- assert ! s.stopped?
18
- assert s.exited?
19
- end
20
- end
@@ -1,81 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
- begin
3
- old_verbose = $VERBOSE
4
- $VERBOSE = nil
5
- require 'rake/rdoctask'
6
- ensure
7
- $VERBOSE = old_verbose
8
- end
9
-
10
- class TestRakeRDocTask < Rake::TestCase
11
- include Rake
12
-
13
- def setup
14
- super
15
-
16
- Task.clear
17
- end
18
-
19
- def test_tasks_creation
20
- Rake::RDocTask.new
21
- assert Task[:rdoc]
22
- assert Task[:clobber_rdoc]
23
- assert Task[:rerdoc]
24
- end
25
-
26
- def test_tasks_creation_with_custom_name_symbol
27
- rd = Rake::RDocTask.new(:rdoc_dev)
28
- assert Task[:rdoc_dev]
29
- assert Task[:clobber_rdoc_dev]
30
- assert Task[:rerdoc_dev]
31
- assert_equal :rdoc_dev, rd.name
32
- end
33
-
34
- def test_tasks_creation_with_custom_name_string
35
- rd = Rake::RDocTask.new("rdoc_dev")
36
- assert Task[:rdoc_dev]
37
- assert Task[:clobber_rdoc_dev]
38
- assert Task[:rerdoc_dev]
39
- assert_equal "rdoc_dev", rd.name
40
- end
41
-
42
- def test_tasks_creation_with_custom_name_hash
43
- options = { :rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force" }
44
- rd = Rake::RDocTask.new(options)
45
- assert Task[:"rdoc"]
46
- assert Task[:"rdoc:clean"]
47
- assert Task[:"rdoc:force"]
48
- assert_raises(RuntimeError) { Task[:clobber_rdoc] }
49
- assert_equal options, rd.name
50
- end
51
-
52
- def test_tasks_creation_with_custom_name_hash_will_use_default_if_an_option_isnt_given
53
- Rake::RDocTask.new(:clobber_rdoc => "rdoc:clean")
54
- assert Task[:rdoc]
55
- assert Task[:"rdoc:clean"]
56
- assert Task[:rerdoc]
57
- end
58
-
59
- def test_tasks_creation_with_custom_name_hash_raises_exception_if_invalid_option_given
60
- assert_raises(ArgumentError) do
61
- Rake::RDocTask.new(:foo => "bar")
62
- end
63
-
64
- begin
65
- Rake::RDocTask.new(:foo => "bar")
66
- rescue ArgumentError => e
67
- assert_match(/foo/, e.message)
68
- end
69
- end
70
-
71
- def test_inline_source_option_is_only_appended_if_option_not_already_given
72
- rd = Rake::RDocTask.new
73
- rd.options << '--inline-source'
74
- assert_equal 1, rd.option_list.grep('--inline-source').size
75
-
76
- rd = Rake::RDocTask.new
77
- rd.options << '-S'
78
- assert_equal 1, rd.option_list.grep('-S').size
79
- assert_equal 0, rd.option_list.grep('--inline-source').size
80
- end
81
- end
@@ -1,35 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- class TestRakeRequire < Rake::TestCase
4
-
5
- def test_can_load_rake_library
6
- app = Rake::Application.new
7
- assert app.instance_eval {
8
- rake_require("test2", ['test/data/rakelib'], [])
9
- }
10
- end
11
-
12
- def test_wont_reload_rake_library
13
- app = Rake::Application.new
14
-
15
- paths = ['test/data/rakelib']
16
- loaded_files = []
17
- app.rake_require("test2", paths, loaded_files)
18
-
19
- assert ! app.instance_eval {
20
- rake_require("test2", paths, loaded_files)
21
- }
22
- end
23
-
24
- def test_throws_error_if_library_not_found
25
- app = Rake::Application.new
26
- ex = assert_raises(LoadError) {
27
- assert app.instance_eval {
28
- rake_require("testx", ['test/data/rakelib'], [])
29
- }
30
- }
31
- assert_match(/(can *not|can't)\s+find/i, ex.message)
32
- assert_match(/testx/, ex.message)
33
- end
34
- end
35
-
@@ -1,346 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
- require 'fileutils'
3
-
4
- ######################################################################
5
- class TestRakeRules < Rake::TestCase
6
- include Rake
7
-
8
- SRCFILE = "testdata/abc.c"
9
- SRCFILE2 = "testdata/xyz.c"
10
- FTNFILE = "testdata/abc.f"
11
- OBJFILE = "testdata/abc.o"
12
- FOOFILE = "testdata/foo"
13
- DOTFOOFILE = "testdata/.foo"
14
-
15
- def setup
16
- super
17
-
18
- Task.clear
19
- @runs = []
20
- FileUtils.mkdir_p 'testdata' # HACK use tmpdir
21
- end
22
-
23
- def teardown
24
- FileList['testdata/*'].uniq.each do |f| rm_r(f, :verbose=>false) end
25
-
26
- super
27
- end
28
-
29
- def test_multiple_rules1
30
- create_file(FTNFILE)
31
- delete_file(SRCFILE)
32
- delete_file(OBJFILE)
33
- rule(/\.o$/ => ['.c']) do @runs << :C end
34
- rule(/\.o$/ => ['.f']) do @runs << :F end
35
- t = Task[OBJFILE]
36
- t.invoke
37
- Task[OBJFILE].invoke
38
- assert_equal [:F], @runs
39
- end
40
-
41
- def test_multiple_rules2
42
- create_file(FTNFILE)
43
- delete_file(SRCFILE)
44
- delete_file(OBJFILE)
45
- rule(/\.o$/ => ['.f']) do @runs << :F end
46
- rule(/\.o$/ => ['.c']) do @runs << :C end
47
- Task[OBJFILE].invoke
48
- assert_equal [:F], @runs
49
- end
50
-
51
- def test_create_with_source
52
- create_file(SRCFILE)
53
- rule(/\.o$/ => ['.c']) do |t|
54
- @runs << t.name
55
- assert_equal OBJFILE, t.name
56
- assert_equal SRCFILE, t.source
57
- end
58
- Task[OBJFILE].invoke
59
- assert_equal [OBJFILE], @runs
60
- end
61
-
62
- def test_single_dependent
63
- create_file(SRCFILE)
64
- rule(/\.o$/ => '.c') do |t|
65
- @runs << t.name
66
- end
67
- Task[OBJFILE].invoke
68
- assert_equal [OBJFILE], @runs
69
- end
70
-
71
- def test_rule_can_be_created_by_string
72
- create_file(SRCFILE)
73
- rule '.o' => ['.c'] do |t|
74
- @runs << t.name
75
- end
76
- Task[OBJFILE].invoke
77
- assert_equal [OBJFILE], @runs
78
- end
79
-
80
- def test_rule_prereqs_can_be_created_by_string
81
- create_file(SRCFILE)
82
- rule '.o' => '.c' do |t|
83
- @runs << t.name
84
- end
85
- Task[OBJFILE].invoke
86
- assert_equal [OBJFILE], @runs
87
- end
88
-
89
- def test_plain_strings_as_dependents_refer_to_files
90
- create_file(SRCFILE)
91
- rule '.o' => SRCFILE do |t|
92
- @runs << t.name
93
- end
94
- Task[OBJFILE].invoke
95
- assert_equal [OBJFILE], @runs
96
- end
97
-
98
- def test_file_names_beginning_with_dot_can_be_tricked_into_referring_to_file
99
- verbose(false) do
100
- chdir("testdata") do
101
- create_file('.foo')
102
- rule '.o' => "./.foo" do |t|
103
- @runs << t.name
104
- end
105
- Task[OBJFILE].invoke
106
- assert_equal [OBJFILE], @runs
107
- end
108
- end
109
- end
110
-
111
- def test_file_names_beginning_with_dot_can_be_wrapped_in_lambda
112
- verbose(false) do
113
- chdir("testdata") do
114
- create_file(".foo")
115
- rule '.o' => lambda{".foo"} do |t|
116
- @runs << "#{t.name} - #{t.source}"
117
- end
118
- Task[OBJFILE].invoke
119
- assert_equal ["#{OBJFILE} - .foo"], @runs
120
- end
121
- end
122
- end
123
-
124
- def test_file_names_containing_percent_can_be_wrapped_in_lambda
125
- verbose(false) do
126
- chdir("testdata") do
127
- create_file("foo%x")
128
- rule '.o' => lambda{"foo%x"} do |t|
129
- @runs << "#{t.name} - #{t.source}"
130
- end
131
- Task[OBJFILE].invoke
132
- assert_equal ["#{OBJFILE} - foo%x"], @runs
133
- end
134
- end
135
- end
136
-
137
- def test_non_extension_rule_name_refers_to_file
138
- verbose(false) do
139
- chdir("testdata") do
140
- create_file("abc.c")
141
- rule "abc" => '.c' do |t|
142
- @runs << t.name
143
- end
144
- Task["abc"].invoke
145
- assert_equal ["abc"], @runs
146
- end
147
- end
148
- end
149
-
150
- def test_pathmap_automatically_applies_to_name
151
- verbose(false) do
152
- chdir("testdata") do
153
- create_file("zzabc.c")
154
- rule ".o" => 'zz%{x,a}n.c' do |t|
155
- @runs << "#{t.name} - #{t.source}"
156
- end
157
- Task["xbc.o"].invoke
158
- assert_equal ["xbc.o - zzabc.c"], @runs
159
- end
160
- end
161
- end
162
-
163
- def test_plain_strings_are_just_filenames
164
- verbose(false) do
165
- chdir("testdata") do
166
- create_file("plainname")
167
- rule ".o" => 'plainname' do |t|
168
- @runs << "#{t.name} - #{t.source}"
169
- end
170
- Task["xbc.o"].invoke
171
- assert_equal ["xbc.o - plainname"], @runs
172
- end
173
- end
174
- end
175
-
176
- def test_rule_runs_when_explicit_task_has_no_actions
177
- create_file(SRCFILE)
178
- create_file(SRCFILE2)
179
- delete_file(OBJFILE)
180
- rule '.o' => '.c' do |t|
181
- @runs << t.source
182
- end
183
- file OBJFILE => [SRCFILE2]
184
- Task[OBJFILE].invoke
185
- assert_equal [SRCFILE], @runs
186
- end
187
-
188
- def test_close_matches_on_name_do_not_trigger_rule
189
- create_file("testdata/x.c")
190
- rule '.o' => ['.c'] do |t|
191
- @runs << t.name
192
- end
193
- assert_raises(RuntimeError) { Task['testdata/x.obj'].invoke }
194
- assert_raises(RuntimeError) { Task['testdata/x.xyo'].invoke }
195
- end
196
-
197
- def test_rule_rebuilds_obj_when_source_is_newer
198
- create_timed_files(OBJFILE, SRCFILE)
199
- rule(/\.o$/ => ['.c']) do
200
- @runs << :RULE
201
- end
202
- Task[OBJFILE].invoke
203
- assert_equal [:RULE], @runs
204
- end
205
-
206
- def test_rule_with_two_sources_runs_if_both_sources_are_present
207
- create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
208
- rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
209
- @runs << :RULE
210
- end
211
- Task[OBJFILE].invoke
212
- assert_equal [:RULE], @runs
213
- end
214
-
215
- def test_rule_with_two_sources_but_one_missing_does_not_run
216
- create_timed_files(OBJFILE, SRCFILE)
217
- delete_file(SRCFILE2)
218
- rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
219
- @runs << :RULE
220
- end
221
- Task[OBJFILE].invoke
222
- assert_equal [], @runs
223
- end
224
-
225
- def test_rule_with_two_sources_builds_both_sources
226
- task 'x.aa'
227
- task 'x.bb'
228
- rule '.a' => '.aa' do
229
- @runs << "A"
230
- end
231
- rule '.b' => '.bb' do
232
- @runs << "B"
233
- end
234
- rule ".c" => ['.a', '.b'] do
235
- @runs << "C"
236
- end
237
- Task["x.c"].invoke
238
- assert_equal ["A", "B", "C"], @runs.sort
239
- end
240
-
241
- def test_second_rule_runs_when_first_rule_doesnt
242
- create_timed_files(OBJFILE, SRCFILE)
243
- delete_file(SRCFILE2)
244
- rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
245
- @runs << :RULE1
246
- end
247
- rule OBJFILE => [lambda{SRCFILE}] do
248
- @runs << :RULE2
249
- end
250
- Task[OBJFILE].invoke
251
- assert_equal [:RULE2], @runs
252
- end
253
-
254
- def test_second_rule_doest_run_if_first_triggers
255
- create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
256
- rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
257
- @runs << :RULE1
258
- end
259
- rule OBJFILE => [lambda{SRCFILE}] do
260
- @runs << :RULE2
261
- end
262
- Task[OBJFILE].invoke
263
- assert_equal [:RULE1], @runs
264
- end
265
-
266
- def test_second_rule_doest_run_if_first_triggers_with_reversed_rules
267
- create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
268
- rule OBJFILE => [lambda{SRCFILE}] do
269
- @runs << :RULE1
270
- end
271
- rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
272
- @runs << :RULE2
273
- end
274
- Task[OBJFILE].invoke
275
- assert_equal [:RULE1], @runs
276
- end
277
-
278
- def test_rule_with_proc_dependent_will_trigger
279
- mkdir_p("testdata/src/jw")
280
- create_file("testdata/src/jw/X.java")
281
- rule %r(classes/.*\.class) => [
282
- proc { |fn| fn.pathmap("%{classes,testdata/src}d/%n.java") }
283
- ] do |task|
284
- assert_equal task.name, 'classes/jw/X.class'
285
- assert_equal task.source, 'testdata/src/jw/X.java'
286
- @runs << :RULE
287
- end
288
- Task['classes/jw/X.class'].invoke
289
- assert_equal [:RULE], @runs
290
- ensure
291
- rm_r("testdata/src", :verbose=>false) rescue nil
292
- end
293
-
294
- def test_proc_returning_lists_are_flattened_into_prereqs
295
- ran = false
296
- mkdir_p("testdata/flatten")
297
- create_file("testdata/flatten/a.txt")
298
- task 'testdata/flatten/b.data' do |t|
299
- ran = true
300
- touch t.name, :verbose => false
301
- end
302
- rule '.html' =>
303
- proc { |fn|
304
- [
305
- fn.ext("txt"),
306
- "testdata/flatten/b.data"
307
- ]
308
- } do |task|
309
- end
310
- Task['testdata/flatten/a.html'].invoke
311
- assert ran, "Should have triggered flattened dependency"
312
- ensure
313
- rm_r("testdata/flatten", :verbose=>false) rescue nil
314
- end
315
-
316
- def test_recursive_rules_will_work_as_long_as_they_terminate
317
- actions = []
318
- create_file("testdata/abc.xml")
319
- rule '.y' => '.xml' do actions << 'y' end
320
- rule '.c' => '.y' do actions << 'c'end
321
- rule '.o' => '.c' do actions << 'o'end
322
- rule '.exe' => '.o' do actions << 'exe'end
323
- Task["testdata/abc.exe"].invoke
324
- assert_equal ['y', 'c', 'o', 'exe'], actions
325
- end
326
-
327
- def test_recursive_rules_that_dont_terminate_will_overflow
328
- create_file("testdata/a.a")
329
- prev = 'a'
330
- ('b'..'z').each do |letter|
331
- rule ".#{letter}" => ".#{prev}" do |t| puts "#{t.name}" end
332
- prev = letter
333
- end
334
- ex = assert_raises(Rake::RuleRecursionOverflowError) {
335
- Task["testdata/a.z"].invoke
336
- }
337
- assert_match(/a\.z => testdata\/a.y/, ex.message)
338
- end
339
-
340
- def test_rules_with_bad_dependents_will_fail
341
- rule "a" => [ 1 ] do |t| puts t.name end
342
- assert_raises(RuntimeError) do Task['a'].invoke end
343
- end
344
-
345
- end
346
-