rake 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rake might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/CHANGES +24 -0
- data/README +28 -11
- data/Rakefile +22 -30
- data/bin/rake +1 -1
- data/doc/jamis.rb +132 -105
- data/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/lib/rake.rb +661 -455
- data/lib/rake/classic_namespace.rb +8 -0
- data/lib/rake/gempackagetask.rb +5 -3
- data/lib/rake/packagetask.rb +0 -2
- data/lib/rake/rake_test_loader.rb +1 -1
- data/lib/rake/testtask.rb +8 -2
- data/test/data/chains/Rakefile +15 -0
- data/test/data/default/Rakefile +19 -0
- data/test/data/dryrun/Rakefile +22 -0
- data/test/data/file_creation_task/Rakefile +30 -0
- data/test/data/imports/Rakefile +19 -0
- data/test/data/imports/deps.mf +1 -0
- data/test/data/multidesc/Rakefile +14 -0
- data/test/data/sample.mf +9 -0
- data/test/filecreation.rb +18 -9
- data/test/functional.rb +2 -130
- data/test/session_functional.rb +159 -0
- data/test/{testclean.rb → test_clean.rb} +1 -0
- data/test/test_definitions.rb +82 -0
- data/test/test_earlytime.rb +31 -0
- data/test/test_file_creation_task.rb +56 -0
- data/test/test_file_task.rb +140 -0
- data/test/{testfilelist.rb → test_filelist.rb} +17 -2
- data/test/{testfileutils.rb → test_fileutils.rb} +10 -2
- data/test/{testftp.rb → test_ftp.rb} +0 -0
- data/test/test_makefile_loader.rb +2 -0
- data/test/{testpackagetask.rb → test_package_task.rb} +45 -0
- data/test/test_rake.rb +21 -0
- data/test/test_rules.rb +206 -0
- data/test/test_tasks.rb +77 -0
- data/test/{testtesttask.rb → test_test_task.rb} +5 -0
- metadata +72 -12
- metadata.gz.sig +2 -0
- data/TAGS +0 -126
- data/test/testtasks.rb +0 -400
metadata.gz.sig
ADDED
data/TAGS
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
|
2
|
-
install.rb,12
|
3
|
-
$ruby 7,68
|
4
|
-
|
5
|
-
doc/jamis.rb,98
|
6
|
-
function toggleSource(toggleSource194,2852
|
7
|
-
function openCode(openCode222,3520
|
8
|
-
|
9
|
-
lib/rake.rb,49
|
10
|
-
RAKEVERSION 32,1333
|
11
|
-
# define methods 652,18022
|
12
|
-
|
13
|
-
lib/rake/clean.rb,14
|
14
|
-
CLEAN 18,641
|
15
|
-
|
16
|
-
lib/rake/tasklib.rb,0
|
17
|
-
|
18
|
-
lib/rake/packagetask.rb,28
|
19
|
-
def initialize(72,2269
|
20
|
-
|
21
|
-
lib/rake/rdoctask.rb,28
|
22
|
-
def initialize(68,2002
|
23
|
-
|
24
|
-
lib/rake/runtest.rb,23
|
25
|
-
def run_tests(9,119
|
26
|
-
|
27
|
-
lib/rake/testtask.rb,28
|
28
|
-
def test_files=73,2340
|
29
|
-
|
30
|
-
lib/rake/gempackagetask.rb,29
|
31
|
-
rescue NoMethodError 12,184
|
32
|
-
|
33
|
-
lib/rake/ruby182_test_unit_fix.rb,31
|
34
|
-
def collect_file(6,83
|
35
|
-
|
36
|
-
lib/rake/rake_test_loader.rb,0
|
37
|
-
|
38
|
-
lib/rake/contrib/ftptools.rb,165
|
39
|
-
attr_reader :name,17,352
|
40
|
-
attr_reader :name, :size,17,352
|
41
|
-
attr_reader :name, :size, :owner,17,352
|
42
|
-
attr_reader :name, :size, :owner, :group,17,352
|
43
|
-
|
44
|
-
lib/rake/contrib/sys.rb,16
|
45
|
-
RUBY 40,1674
|
46
|
-
|
47
|
-
lib/rake/contrib/compositepublisher.rb,25
|
48
|
-
@publishers 8,130
|
49
|
-
|
50
|
-
lib/rake/contrib/publisher.rb,17
|
51
|
-
HostInfo 17,637
|
52
|
-
|
53
|
-
lib/rake/contrib/rubyforgepublisher.rb,101
|
54
|
-
attr_reader :project,8,116
|
55
|
-
attr_reader :project, :proj_id,8,116
|
56
|
-
def initialize(10,163
|
57
|
-
|
58
|
-
lib/rake/contrib/sshpublisher.rb,27
|
59
|
-
def initialize(10,180
|
60
|
-
|
61
|
-
lib/rake/loaders/makefile.rb,20
|
62
|
-
def load(9,164
|
63
|
-
|
64
|
-
test/filecreation.rb,31
|
65
|
-
def create_timed_files(6,59
|
66
|
-
|
67
|
-
test/testclean.rb,70
|
68
|
-
assert Task[8,119
|
69
|
-
assert Task[9,167
|
70
|
-
assert Task[10,219
|
71
|
-
|
72
|
-
test/testfilelist.rb,17
|
73
|
-
FileList 7,99
|
74
|
-
|
75
|
-
test/testtasks.rb,165
|
76
|
-
arg 15,266
|
77
|
-
assert_equal 18,375
|
78
|
-
assert_equal t,22,490
|
79
|
-
runlist 27,563
|
80
|
-
t2 29,658
|
81
|
-
t2 39,1013
|
82
|
-
task :t1 223,6177
|
83
|
-
task :t1 224,6224
|
84
|
-
|
85
|
-
test/testftp.rb,20
|
86
|
-
Date.new(9,121
|
87
|
-
|
88
|
-
test/testfileutils.rb,315
|
89
|
-
create_file(12,195
|
90
|
-
assert_equal true,35,789
|
91
|
-
assert_equal false,37,838
|
92
|
-
verbose(38,870
|
93
|
-
assert_equal false,41,928
|
94
|
-
assert_equal true,46,1003
|
95
|
-
assert_equal false,48,1052
|
96
|
-
nowrite(49,1084
|
97
|
-
assert_equal false,52,1142
|
98
|
-
verbose(56,1195
|
99
|
-
assert true,57,1245
|
100
|
-
ENV[61,1320
|
101
|
-
|
102
|
-
test/shellcommand.rb,0
|
103
|
-
|
104
|
-
test/testpackagetask.rb,15
|
105
|
-
pkg 8,132
|
106
|
-
|
107
|
-
test/functional.rb,21
|
108
|
-
@debug 21,466
|
109
|
-
|
110
|
-
test/testtesttask.rb,15
|
111
|
-
ENV[9,135
|
112
|
-
|
113
|
-
test/test_makefile_loader.rb,19
|
114
|
-
loader 10,170
|
115
|
-
|
116
|
-
test/contrib/testsys.rb,154
|
117
|
-
assert_equal 40,955
|
118
|
-
assert_equal 41,998
|
119
|
-
assert_equal 42,1043
|
120
|
-
assert_equal 43,1086
|
121
|
-
assert_equal 44,1136
|
122
|
-
assert_equal 45,1192
|
123
|
-
|
124
|
-
test/data/rbext/rakefile.rb,0
|
125
|
-
|
126
|
-
bin/rake,0
|
data/test/testtasks.rb
DELETED
@@ -1,400 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'fileutils'
|
5
|
-
require 'rake'
|
6
|
-
require 'test/filecreation'
|
7
|
-
|
8
|
-
######################################################################
|
9
|
-
class TestTask < Test::Unit::TestCase
|
10
|
-
def setup
|
11
|
-
Task.clear
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_create
|
15
|
-
arg = nil
|
16
|
-
t = Task.lookup(:name).enhance { |task| arg = task; 1234 }
|
17
|
-
assert_equal "name", t.name
|
18
|
-
assert_equal [], t.prerequisites
|
19
|
-
assert t.prerequisites.is_a?(FileList)
|
20
|
-
assert t.needed?
|
21
|
-
t.execute
|
22
|
-
assert_equal t, arg
|
23
|
-
assert_nil t.source
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_invoke
|
27
|
-
runlist = []
|
28
|
-
t1 = Task.lookup(:t1).enhance([:t2, :t3]) { |t| runlist << t.name; 3321 }
|
29
|
-
t2 = Task.lookup(:t2).enhance { |t| runlist << t.name }
|
30
|
-
t3 = Task.lookup(:t3).enhance { |t| runlist << t.name }
|
31
|
-
assert_equal [:t2, :t3], t1.prerequisites
|
32
|
-
t1.invoke
|
33
|
-
assert_equal ["t2", "t3", "t1"], runlist
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_no_double_invoke
|
37
|
-
runlist = []
|
38
|
-
t1 = Task.lookup(:t1).enhance([:t2, :t3]) { |t| runlist << t.name; 3321 }
|
39
|
-
t2 = Task.lookup(:t2).enhance([:t3]) { |t| runlist << t.name }
|
40
|
-
t3 = Task.lookup(:t3).enhance { |t| runlist << t.name }
|
41
|
-
t1.invoke
|
42
|
-
assert_equal ["t3", "t2", "t1"], runlist
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_find
|
46
|
-
task :tfind
|
47
|
-
assert_equal "tfind", Task[:tfind].name
|
48
|
-
ex = assert_raises(RuntimeError) { Task[:leaves] }
|
49
|
-
assert_equal "Don't know how to build task 'leaves'", ex.message
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_defined
|
53
|
-
assert ! Task.task_defined?(:a)
|
54
|
-
task :a
|
55
|
-
assert Task.task_defined?(:a)
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_multi_invocations
|
59
|
-
runs = []
|
60
|
-
p = proc do |t| runs << t.name end
|
61
|
-
task({:t1=>[:t2,:t3]}, &p)
|
62
|
-
task({:t2=>[:t3]}, &p)
|
63
|
-
task(:t3, &p)
|
64
|
-
Task[:t1].invoke
|
65
|
-
assert_equal ["t1", "t2", "t3"], runs.sort
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_task_list
|
69
|
-
task :t2
|
70
|
-
task :t1 => [:t2]
|
71
|
-
assert_equal ["t1", "t2"], Task.tasks.collect {|t| t.name}
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
######################################################################
|
77
|
-
class TestFileTask < Test::Unit::TestCase
|
78
|
-
include FileCreation
|
79
|
-
|
80
|
-
def setup
|
81
|
-
Task.clear
|
82
|
-
@runs = Array.new
|
83
|
-
FileUtils.rm_f NEWFILE
|
84
|
-
FileUtils.rm_f OLDFILE
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_file_need
|
88
|
-
name = "testdata/dummy"
|
89
|
-
file name
|
90
|
-
ftask = Task[name]
|
91
|
-
assert_equal name.to_s, ftask.name
|
92
|
-
File.delete(ftask.name) rescue nil
|
93
|
-
assert ftask.needed?, "file should be needed"
|
94
|
-
open(ftask.name, "w") { |f| f.puts "HI" }
|
95
|
-
assert_equal nil, ftask.prerequisites.collect{|n| Task[n].timestamp}.max
|
96
|
-
assert ! ftask.needed?, "file should not be needed"
|
97
|
-
File.delete(ftask.name) rescue nil
|
98
|
-
end
|
99
|
-
|
100
|
-
OLDFILE = "testdata/old"
|
101
|
-
NEWFILE = "testdata/new"
|
102
|
-
|
103
|
-
def test_file_times_new_depends_on_old
|
104
|
-
create_timed_files(OLDFILE, NEWFILE)
|
105
|
-
|
106
|
-
t1 = FileTask.lookup(NEWFILE).enhance([OLDFILE])
|
107
|
-
t2 = FileTask.lookup(OLDFILE)
|
108
|
-
assert ! t2.needed?, "Should not need to build old file"
|
109
|
-
assert ! t1.needed?, "Should not need to rebuild new file because of old"
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_file_times_old_depends_on_new
|
113
|
-
create_timed_files(OLDFILE, NEWFILE)
|
114
|
-
|
115
|
-
t1 = FileTask.lookup(OLDFILE).enhance([NEWFILE])
|
116
|
-
t2 = FileTask.lookup(NEWFILE)
|
117
|
-
assert ! t2.needed?, "Should not need to build new file"
|
118
|
-
preq_stamp = t1.prerequisites.collect{|t| Task[t].timestamp}.max
|
119
|
-
assert_equal t2.timestamp, preq_stamp
|
120
|
-
assert t1.timestamp < preq_stamp, "T1 should be older"
|
121
|
-
assert t1.needed?, "Should need to rebuild old file because of new"
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_file_depends_on_task_depend_on_file
|
125
|
-
create_timed_files(OLDFILE, NEWFILE)
|
126
|
-
|
127
|
-
file NEWFILE => [:obj] do |t| @runs << t.name end
|
128
|
-
task :obj => [OLDFILE] do |t| @runs << t.name end
|
129
|
-
file OLDFILE do |t| @runs << t.name end
|
130
|
-
|
131
|
-
Task[:obj].invoke
|
132
|
-
Task[NEWFILE].invoke
|
133
|
-
assert ! @runs.include?(NEWFILE)
|
134
|
-
end
|
135
|
-
|
136
|
-
# I have currently disabled this test. I'm not convinced that
|
137
|
-
# deleting the file target on failure is always the proper thing to
|
138
|
-
# do. I'm willing to hear input on this topic.
|
139
|
-
def ztest_file_deletes_on_failure
|
140
|
-
task :obj
|
141
|
-
file NEWFILE => [:obj] do |t|
|
142
|
-
FileUtils.touch NEWFILE
|
143
|
-
fail "Ooops"
|
144
|
-
end
|
145
|
-
assert Task[NEWFILE]
|
146
|
-
begin
|
147
|
-
Task[NEWFILE].invoke
|
148
|
-
rescue Exception
|
149
|
-
end
|
150
|
-
assert( ! File.exist?(NEWFILE), "NEWFILE should be deleted")
|
151
|
-
end
|
152
|
-
|
153
|
-
end
|
154
|
-
|
155
|
-
######################################################################
|
156
|
-
class TestDirectoryTask < Test::Unit::TestCase
|
157
|
-
def setup
|
158
|
-
rm_rf "testdata", :verbose=>false
|
159
|
-
end
|
160
|
-
|
161
|
-
def teardown
|
162
|
-
rm_rf "testdata", :verbose=>false
|
163
|
-
end
|
164
|
-
|
165
|
-
def test_directory
|
166
|
-
desc "DESC"
|
167
|
-
directory "testdata/a/b/c"
|
168
|
-
assert_equal FileTask, Task["testdata"].class
|
169
|
-
assert_equal FileTask, Task["testdata/a"].class
|
170
|
-
assert_equal FileTask, Task["testdata/a/b/c"].class
|
171
|
-
assert_nil Task["testdata"].comment
|
172
|
-
assert_equal "DESC", Task["testdata/a/b/c"].comment
|
173
|
-
assert_nil Task["testdata/a/b"].comment
|
174
|
-
verbose(false) {
|
175
|
-
Task['testdata/a/b'].invoke
|
176
|
-
}
|
177
|
-
assert File.exist?("testdata/a/b")
|
178
|
-
assert ! File.exist?("testdata/a/b/c")
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
######################################################################
|
183
|
-
class TestDefinitions < Test::Unit::TestCase
|
184
|
-
EXISTINGFILE = "testdata/existing"
|
185
|
-
|
186
|
-
def setup
|
187
|
-
Task.clear
|
188
|
-
end
|
189
|
-
|
190
|
-
def test_task
|
191
|
-
done = false
|
192
|
-
task :one => [:two] do done = true end
|
193
|
-
task :two
|
194
|
-
task :three => [:one, :two]
|
195
|
-
check_tasks(:one, :two, :three)
|
196
|
-
assert done, "Should be done"
|
197
|
-
end
|
198
|
-
|
199
|
-
def test_file_task
|
200
|
-
done = false
|
201
|
-
file "testdata/one" => "testdata/two" do done = true end
|
202
|
-
file "testdata/two"
|
203
|
-
file "testdata/three" => ["testdata/one", "testdata/two"]
|
204
|
-
check_tasks("testdata/one", "testdata/two", "testdata/three")
|
205
|
-
assert done, "Should be done"
|
206
|
-
end
|
207
|
-
|
208
|
-
def check_tasks(n1, n2, n3)
|
209
|
-
t = Task[n1]
|
210
|
-
assert Task === t, "Should be a Task"
|
211
|
-
assert_equal n1.to_s, t.name
|
212
|
-
assert_equal [n2.to_s], t.prerequisites.collect{|n| n.to_s}
|
213
|
-
t.invoke
|
214
|
-
t2 = Task[n2]
|
215
|
-
assert_equal FileList[], t2.prerequisites
|
216
|
-
t3 = Task[n3]
|
217
|
-
assert_equal [n1.to_s, n2.to_s], t3.prerequisites.collect{|n|n.to_s}
|
218
|
-
end
|
219
|
-
|
220
|
-
def test_incremental_definitions
|
221
|
-
runs = []
|
222
|
-
task :t1 => [:t2] do runs << "A"; 4321 end
|
223
|
-
task :t1 => [:t3] do runs << "B"; 1234 end
|
224
|
-
task :t1 => [:t3]
|
225
|
-
task :t2
|
226
|
-
task :t3
|
227
|
-
Task[:t1].invoke
|
228
|
-
assert_equal ["A", "B"], runs
|
229
|
-
assert_equal ["t2", "t3"], Task[:t1].prerequisites
|
230
|
-
end
|
231
|
-
|
232
|
-
def test_missing_dependencies
|
233
|
-
task :x => ["testdata/missing"]
|
234
|
-
assert_raises(RuntimeError) { Task[:x].invoke }
|
235
|
-
end
|
236
|
-
|
237
|
-
def test_implicit_file_dependencies
|
238
|
-
runs = []
|
239
|
-
create_existing_file
|
240
|
-
task :y => [EXISTINGFILE] do |t| runs << t.name end
|
241
|
-
Task[:y].invoke
|
242
|
-
assert_equal runs, ['y']
|
243
|
-
end
|
244
|
-
|
245
|
-
private # ----------------------------------------------------------
|
246
|
-
|
247
|
-
def create_existing_file
|
248
|
-
Dir.mkdir File.dirname(EXISTINGFILE) unless
|
249
|
-
File.exist?(File.dirname(EXISTINGFILE))
|
250
|
-
open(EXISTINGFILE, "w") do |f| f.puts "HI" end unless
|
251
|
-
File.exist?(EXISTINGFILE)
|
252
|
-
end
|
253
|
-
|
254
|
-
end
|
255
|
-
|
256
|
-
######################################################################
|
257
|
-
class TestRules < Test::Unit::TestCase
|
258
|
-
include FileCreation
|
259
|
-
|
260
|
-
SRCFILE = "testdata/abc.c"
|
261
|
-
SRCFILE2 = "testdata/xyz.c"
|
262
|
-
FTNFILE = "testdata/abc.f"
|
263
|
-
OBJFILE = "testdata/abc.o"
|
264
|
-
|
265
|
-
def setup
|
266
|
-
Task.clear
|
267
|
-
@runs = []
|
268
|
-
end
|
269
|
-
|
270
|
-
def teardown
|
271
|
-
FileList['testdata/*'].each do |f| rm_r(f, :verbose=>false) end
|
272
|
-
end
|
273
|
-
|
274
|
-
def test_multiple_rules1
|
275
|
-
create_file(FTNFILE)
|
276
|
-
delete_file(SRCFILE)
|
277
|
-
delete_file(OBJFILE)
|
278
|
-
rule(/\.o$/ => ['.c']) do @runs << :C end
|
279
|
-
rule(/\.o$/ => ['.f']) do @runs << :F end
|
280
|
-
t = Task[OBJFILE]
|
281
|
-
t.invoke
|
282
|
-
Task[OBJFILE].invoke
|
283
|
-
assert_equal [:F], @runs
|
284
|
-
end
|
285
|
-
|
286
|
-
def test_multiple_rules2
|
287
|
-
create_file(FTNFILE)
|
288
|
-
delete_file(SRCFILE)
|
289
|
-
delete_file(OBJFILE)
|
290
|
-
rule(/\.o$/ => ['.f']) do @runs << :F end
|
291
|
-
rule(/\.o$/ => ['.c']) do @runs << :C end
|
292
|
-
Task[OBJFILE].invoke
|
293
|
-
assert_equal [:F], @runs
|
294
|
-
end
|
295
|
-
|
296
|
-
def test_create_with_source
|
297
|
-
create_file(SRCFILE)
|
298
|
-
rule(/\.o$/ => ['.c']) do |t|
|
299
|
-
@runs << t.name
|
300
|
-
assert_equal OBJFILE, t.name
|
301
|
-
assert_equal SRCFILE, t.source
|
302
|
-
end
|
303
|
-
Task[OBJFILE].invoke
|
304
|
-
assert_equal [OBJFILE], @runs
|
305
|
-
end
|
306
|
-
|
307
|
-
def test_single_dependent
|
308
|
-
create_file(SRCFILE)
|
309
|
-
rule(/\.o$/ => '.c') do |t|
|
310
|
-
@runs << t.name
|
311
|
-
end
|
312
|
-
Task[OBJFILE].invoke
|
313
|
-
assert_equal [OBJFILE], @runs
|
314
|
-
end
|
315
|
-
|
316
|
-
def test_create_by_string
|
317
|
-
create_file(SRCFILE)
|
318
|
-
rule '.o' => ['.c'] do |t|
|
319
|
-
@runs << t.name
|
320
|
-
end
|
321
|
-
Task[OBJFILE].invoke
|
322
|
-
assert_equal [OBJFILE], @runs
|
323
|
-
end
|
324
|
-
|
325
|
-
def test_rule_and_no_action_task
|
326
|
-
create_file(SRCFILE)
|
327
|
-
create_file(SRCFILE2)
|
328
|
-
delete_file(OBJFILE)
|
329
|
-
rule '.o' => '.c' do |t|
|
330
|
-
@runs << t.source
|
331
|
-
end
|
332
|
-
file OBJFILE => [SRCFILE2]
|
333
|
-
Task[OBJFILE].invoke
|
334
|
-
assert_equal [SRCFILE], @runs
|
335
|
-
end
|
336
|
-
|
337
|
-
def test_string_close_matches
|
338
|
-
create_file("testdata/x.c")
|
339
|
-
rule '.o' => ['.c'] do |t|
|
340
|
-
@runs << t.name
|
341
|
-
end
|
342
|
-
assert_raises(RuntimeError) { Task['testdata/x.obj'].invoke }
|
343
|
-
assert_raises(RuntimeError) { Task['testdata/x.xyo'].invoke }
|
344
|
-
end
|
345
|
-
|
346
|
-
def test_precedence_rule_vs_implicit
|
347
|
-
create_timed_files(OBJFILE, SRCFILE)
|
348
|
-
rule(/\.o$/ => ['.c']) do
|
349
|
-
@runs << :RULE
|
350
|
-
end
|
351
|
-
Task[OBJFILE].invoke
|
352
|
-
assert_equal [:RULE], @runs
|
353
|
-
end
|
354
|
-
|
355
|
-
def test_too_many_dependents
|
356
|
-
assert_raises(RuntimeError) { rule '.o' => ['.c', '.cpp'] }
|
357
|
-
end
|
358
|
-
|
359
|
-
def test_proc_dependent
|
360
|
-
ran = false
|
361
|
-
File.makedirs("testdata/src/jw")
|
362
|
-
create_file("testdata/src/jw/X.java")
|
363
|
-
rule %r(classes/.*\.class) => [
|
364
|
-
proc { |fn| fn.sub(/^classes/, 'testdata/src').sub(/\.class$/, '.java') }
|
365
|
-
] do |task|
|
366
|
-
assert_equal task.name, 'classes/jw/X.class'
|
367
|
-
assert_equal task.source, 'testdata/src/jw/X.java'
|
368
|
-
ran = true
|
369
|
-
end
|
370
|
-
Task['classes/jw/X.class'].invoke
|
371
|
-
assert ran, "Should have triggered rule"
|
372
|
-
ensure
|
373
|
-
rm_r("testdata/src", :verbose=>false) rescue nil
|
374
|
-
end
|
375
|
-
|
376
|
-
def test_recursive_rules
|
377
|
-
actions = []
|
378
|
-
create_file("testdata/abc.xml")
|
379
|
-
rule '.y' => '.xml' do actions << 'y' end
|
380
|
-
rule '.c' => '.y' do actions << 'c'end
|
381
|
-
rule '.o' => '.c' do actions << 'o'end
|
382
|
-
rule '.exe' => '.o' do actions << 'exe'end
|
383
|
-
Task["testdata/abc.exe"].invoke
|
384
|
-
assert_equal ['y', 'c', 'o', 'exe'], actions
|
385
|
-
end
|
386
|
-
|
387
|
-
def test_recursive_overflow
|
388
|
-
create_file("testdata/a.a")
|
389
|
-
prev = 'a'
|
390
|
-
('b'..'z').each do |letter|
|
391
|
-
rule ".#{letter}" => ".#{prev}" do |t| puts "#{t.name}" end
|
392
|
-
prev = letter
|
393
|
-
end
|
394
|
-
ex = assert_raises(Rake::RuleRecursionOverflowError) {
|
395
|
-
Task["testdata/a.z"].invoke
|
396
|
-
}
|
397
|
-
assert_match(/a\.z => testdata\/a.y/, ex.message)
|
398
|
-
end
|
399
|
-
|
400
|
-
end
|