drake 0.8.1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/CHANGES +386 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +396 -0
  4. data/Rakefile +505 -0
  5. data/TODO +20 -0
  6. data/bin/drake +31 -0
  7. data/bin/rake +31 -0
  8. data/doc/example/Rakefile1 +38 -0
  9. data/doc/example/Rakefile2 +35 -0
  10. data/doc/example/a.c +6 -0
  11. data/doc/example/b.c +6 -0
  12. data/doc/example/main.c +11 -0
  13. data/doc/glossary.rdoc +51 -0
  14. data/doc/jamis.rb +591 -0
  15. data/doc/proto_rake.rdoc +127 -0
  16. data/doc/rake.1.gz +0 -0
  17. data/doc/rakefile.rdoc +534 -0
  18. data/doc/rational.rdoc +151 -0
  19. data/doc/release_notes/rake-0.4.14.rdoc +23 -0
  20. data/doc/release_notes/rake-0.4.15.rdoc +35 -0
  21. data/doc/release_notes/rake-0.5.0.rdoc +53 -0
  22. data/doc/release_notes/rake-0.5.3.rdoc +78 -0
  23. data/doc/release_notes/rake-0.5.4.rdoc +46 -0
  24. data/doc/release_notes/rake-0.6.0.rdoc +141 -0
  25. data/doc/release_notes/rake-0.7.0.rdoc +119 -0
  26. data/doc/release_notes/rake-0.7.1.rdoc +59 -0
  27. data/doc/release_notes/rake-0.7.2.rdoc +121 -0
  28. data/doc/release_notes/rake-0.7.3.rdoc +47 -0
  29. data/doc/release_notes/rake-0.8.0.rdoc +114 -0
  30. data/doc/release_notes/rake-0.8.2.rdoc +163 -0
  31. data/install.rb +88 -0
  32. data/lib/rake.rb +2538 -0
  33. data/lib/rake/classic_namespace.rb +8 -0
  34. data/lib/rake/clean.rb +33 -0
  35. data/lib/rake/comp_tree/algorithm.rb +234 -0
  36. data/lib/rake/comp_tree/bucket_ipc.rb +175 -0
  37. data/lib/rake/comp_tree/driver.rb +291 -0
  38. data/lib/rake/comp_tree/error.rb +51 -0
  39. data/lib/rake/comp_tree/node.rb +189 -0
  40. data/lib/rake/comp_tree/quix/builtin/kernel/tap.rb +57 -0
  41. data/lib/rake/comp_tree/quix/diagnostic.rb +92 -0
  42. data/lib/rake/comp_tree/quix/kernel.rb +109 -0
  43. data/lib/rake/comp_tree/retriable_fork.rb +66 -0
  44. data/lib/rake/comp_tree/task_node.rb +46 -0
  45. data/lib/rake/contrib/compositepublisher.rb +24 -0
  46. data/lib/rake/contrib/ftptools.rb +153 -0
  47. data/lib/rake/contrib/publisher.rb +75 -0
  48. data/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  49. data/lib/rake/contrib/sshpublisher.rb +47 -0
  50. data/lib/rake/contrib/sys.rb +209 -0
  51. data/lib/rake/gempackagetask.rb +103 -0
  52. data/lib/rake/loaders/makefile.rb +35 -0
  53. data/lib/rake/packagetask.rb +185 -0
  54. data/lib/rake/parallel.rb +54 -0
  55. data/lib/rake/rake_test_loader.rb +5 -0
  56. data/lib/rake/rdoctask.rb +147 -0
  57. data/lib/rake/ruby182_test_unit_fix.rb +23 -0
  58. data/lib/rake/runtest.rb +23 -0
  59. data/lib/rake/tasklib.rb +23 -0
  60. data/lib/rake/testtask.rb +161 -0
  61. data/test/capture_stdout.rb +26 -0
  62. data/test/check_expansion.rb +5 -0
  63. data/test/contrib/test_sys.rb +47 -0
  64. data/test/data/chains/Rakefile +15 -0
  65. data/test/data/default/Rakefile +19 -0
  66. data/test/data/dryrun/Rakefile +22 -0
  67. data/test/data/file_creation_task/Rakefile +33 -0
  68. data/test/data/imports/Rakefile +19 -0
  69. data/test/data/imports/deps.mf +1 -0
  70. data/test/data/multidesc/Rakefile +17 -0
  71. data/test/data/namespace/Rakefile +57 -0
  72. data/test/data/rakelib/test1.rb +3 -0
  73. data/test/data/rbext/rakefile.rb +3 -0
  74. data/test/data/sample.mf +12 -0
  75. data/test/data/statusreturn/Rakefile +8 -0
  76. data/test/data/unittest/Rakefile +1 -0
  77. data/test/filecreation.rb +32 -0
  78. data/test/functional.rb +15 -0
  79. data/test/in_environment.rb +30 -0
  80. data/test/parallel.rb +3 -0
  81. data/test/rake_test_setup.rb +5 -0
  82. data/test/reqfile.rb +3 -0
  83. data/test/reqfile2.rb +3 -0
  84. data/test/session_functional.rb +324 -0
  85. data/test/shellcommand.rb +3 -0
  86. data/test/single_threaded.rb +2 -0
  87. data/test/test_application.rb +714 -0
  88. data/test/test_clean.rb +14 -0
  89. data/test/test_definitions.rb +82 -0
  90. data/test/test_earlytime.rb +35 -0
  91. data/test/test_extension.rb +63 -0
  92. data/test/test_file_creation_task.rb +62 -0
  93. data/test/test_file_task.rb +139 -0
  94. data/test/test_filelist.rb +618 -0
  95. data/test/test_fileutils.rb +250 -0
  96. data/test/test_ftp.rb +59 -0
  97. data/test/test_invocation_chain.rb +75 -0
  98. data/test/test_makefile_loader.rb +25 -0
  99. data/test/test_namespace.rb +36 -0
  100. data/test/test_package_task.rb +116 -0
  101. data/test/test_parallel.rb +47 -0
  102. data/test/test_pathmap.rb +209 -0
  103. data/test/test_rake.rb +41 -0
  104. data/test/test_require.rb +33 -0
  105. data/test/test_rules.rb +348 -0
  106. data/test/test_task_arguments.rb +89 -0
  107. data/test/test_task_manager.rb +172 -0
  108. data/test/test_tasklib.rb +12 -0
  109. data/test/test_tasks.rb +373 -0
  110. data/test/test_test_task.rb +75 -0
  111. data/test/test_top_level_functions.rb +84 -0
  112. metadata +190 -0
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake/tasklib'
5
+
6
+
7
+ class TestTaskLib < Test::Unit::TestCase
8
+ def test_paste
9
+ tl = Rake::TaskLib.new
10
+ assert_equal :ab, tl.paste(:a, :b)
11
+ end
12
+ end
@@ -0,0 +1,373 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'fileutils'
5
+ require 'rake'
6
+ require 'test/filecreation'
7
+ require 'test/capture_stdout'
8
+
9
+ ######################################################################
10
+ class TestTask < Test::Unit::TestCase
11
+ include CaptureStdout
12
+ include Rake
13
+
14
+ def setup
15
+ Task.clear
16
+ end
17
+
18
+ def test_create
19
+ arg = nil
20
+ t = task(:name) { |task| arg = task; 1234 }
21
+ assert_equal "name", t.name
22
+ assert_equal [], t.prerequisites
23
+ assert t.needed?
24
+ t.execute(0)
25
+ assert_equal t, arg
26
+ assert_nil t.source
27
+ assert_equal [], t.sources
28
+ end
29
+
30
+ def test_inspect
31
+ t = task(:foo, :needs => [:bar, :baz])
32
+ assert_equal "<Rake::Task foo => [bar, baz]>", t.inspect
33
+ end
34
+
35
+ def test_invoke
36
+ runlist = []
37
+ t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
38
+ t2 = task(:t2) { |t| runlist << t.name }
39
+ t3 = task(:t3) { |t| runlist << t.name }
40
+ assert_equal ["t2", "t3"], t1.prerequisites
41
+ t1.invoke
42
+ assert_equal ["t2", "t3", "t1"], runlist
43
+ end
44
+
45
+ def test_invoke_with_circular_dependencies
46
+ runlist = []
47
+ t1 = task(:t1 => [:t2]) { |t| runlist << t.name; 3321 }
48
+ t2 = task(:t2 => [:t1]) { |t| runlist << t.name }
49
+ assert_equal ["t2"], t1.prerequisites
50
+ assert_equal ["t1"], t2.prerequisites
51
+ ex = assert_raise RuntimeError do
52
+ t1.invoke
53
+ end
54
+ assert_match(/circular dependency/i, ex.message)
55
+ assert_match(/t1 => t2 => t1/, ex.message)
56
+ end
57
+
58
+ def test_dry_run_prevents_actions
59
+ Rake.application.options.dryrun = true
60
+ runlist = []
61
+ t1 = task(:t1) { |t| runlist << t.name; 3321 }
62
+ out = capture_stdout { t1.invoke }
63
+ assert_match(/execute .*t1/i, out)
64
+ assert_match(/dry run/i, out)
65
+ assert_no_match(/invoke/i, out)
66
+ assert_equal [], runlist
67
+ ensure
68
+ Rake.application.options.dryrun = false
69
+ end
70
+
71
+ def test_tasks_can_be_traced
72
+ Rake.application.options.trace = true
73
+ t1 = task(:t1)
74
+ out = capture_stdout {
75
+ t1.invoke
76
+ }
77
+ if Rake.application.num_threads == 1
78
+ assert_match(/invoke t1/i, out)
79
+ end
80
+ assert_match(/execute t1/i, out)
81
+ ensure
82
+ Rake.application.options.trace = false
83
+ end
84
+
85
+ def test_no_double_invoke
86
+ runlist = []
87
+ t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
88
+ t2 = task(:t2 => [:t3]) { |t| runlist << t.name }
89
+ t3 = task(:t3) { |t| runlist << t.name }
90
+ t1.invoke
91
+ assert_equal ["t3", "t2", "t1"], runlist
92
+ end
93
+
94
+ def test_can_double_invoke_with_reenable
95
+ runlist = []
96
+ t1 = task(:t1) { |t| runlist << t.name }
97
+ t1.invoke
98
+ t1.reenable
99
+ t1.invoke
100
+ assert_equal ["t1", "t1"], runlist
101
+ end
102
+
103
+ def test_clear
104
+ t = task("t" => "a") { }
105
+ t.clear
106
+ assert t.prerequisites.empty?, "prerequisites should be empty"
107
+ assert t.actions.empty?, "actions should be empty"
108
+ end
109
+
110
+ def test_clear_prerequisites
111
+ t = task("t" => ["a", "b"])
112
+ assert_equal ['a', 'b'], t.prerequisites
113
+ t.clear_prerequisites
114
+ assert_equal [], t.prerequisites
115
+ end
116
+
117
+ def test_clear_actions
118
+ t = task("t") { }
119
+ t.clear_actions
120
+ assert t.actions.empty?, "actions should be empty"
121
+ end
122
+
123
+ def test_find
124
+ task :tfind
125
+ assert_equal "tfind", Task[:tfind].name
126
+ ex = assert_raises(RuntimeError) { Task[:leaves] }
127
+ assert_equal "Don't know how to build task 'leaves'", ex.message
128
+ end
129
+
130
+ def test_defined
131
+ assert ! Task.task_defined?(:a)
132
+ task :a
133
+ assert Task.task_defined?(:a)
134
+ end
135
+
136
+ def test_multi_invocations
137
+ runs = []
138
+ p = proc do |t| runs << t.name end
139
+ task({:t1=>[:t2,:t3]}, &p)
140
+ task({:t2=>[:t3]}, &p)
141
+ task(:t3, &p)
142
+ Task[:t1].invoke
143
+ assert_equal ["t1", "t2", "t3"], runs.sort
144
+ end
145
+
146
+ def test_task_list
147
+ task :t2
148
+ task :t1 => [:t2]
149
+ assert_equal ["t1", "t2"], Task.tasks.collect {|t| t.name}
150
+ end
151
+
152
+ def test_task_gives_name_on_to_s
153
+ task :abc
154
+ assert_equal "abc", Task[:abc].to_s
155
+ end
156
+
157
+ def test_symbols_can_be_prerequisites
158
+ task :a => :b
159
+ assert_equal ["b"], Task[:a].prerequisites
160
+ end
161
+
162
+ def test_strings_can_be_prerequisites
163
+ task :a => "b"
164
+ assert_equal ["b"], Task[:a].prerequisites
165
+ end
166
+
167
+ def test_arrays_can_be_prerequisites
168
+ task :a => ["b", "c"]
169
+ assert_equal ["b", "c"], Task[:a].prerequisites
170
+ end
171
+
172
+ def test_filelists_can_be_prerequisites
173
+ task :a => FileList.new.include("b", "c")
174
+ assert_equal ["b", "c"], Task[:a].prerequisites
175
+ end
176
+
177
+ def test_investigation_output
178
+ t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
179
+ task(:t2)
180
+ task(:t3)
181
+ out = t1.investigation
182
+ assert_match(/class:\s*Rake::Task/, out)
183
+ assert_match(/needed:\s*true/, out)
184
+ assert_match(/pre-requisites:\s*--t2/, out)
185
+ end
186
+
187
+
188
+ def test_extended_comments
189
+ desc %{
190
+ This is a comment.
191
+
192
+ And this is the extended comment.
193
+ name -- Name of task to execute.
194
+ rev -- Software revision to use.
195
+ }
196
+ t = task(:t, :name, :rev)
197
+ assert_equal "[name,rev]", t.arg_description
198
+ assert_equal "This is a comment.", t.comment
199
+ assert_match(/^\s*name -- Name/, t.full_comment)
200
+ assert_match(/^\s*rev -- Software/, t.full_comment)
201
+ assert_match(/\A\s*This is a comment\.$/, t.full_comment)
202
+ end
203
+
204
+ def test_multiple_comments
205
+ desc "line one"
206
+ t = task(:t)
207
+ desc "line two"
208
+ task(:t)
209
+ assert_equal "line one / line two", t.comment
210
+ end
211
+
212
+ def test_settable_comments
213
+ t = task(:t)
214
+ t.comment = "HI"
215
+ assert_equal "HI", t.comment
216
+ end
217
+ end
218
+
219
+ ######################################################################
220
+ class TestTaskWithArguments < Test::Unit::TestCase
221
+ include CaptureStdout
222
+ include Rake
223
+
224
+ def setup
225
+ Task.clear
226
+ end
227
+
228
+ def test_no_args_given
229
+ t = task :t
230
+ assert_equal [], t.arg_names
231
+ end
232
+
233
+ def test_args_given
234
+ t = task :t, :a, :b
235
+ assert_equal [:a, :b], t.arg_names
236
+ end
237
+
238
+ def test_name_and_needs
239
+ t = task(:t => [:pre])
240
+ assert_equal "t", t.name
241
+ assert_equal [], t.arg_names
242
+ assert_equal ["pre"], t.prerequisites
243
+ end
244
+
245
+ def test_name_and_explicit_needs
246
+ t = task(:t, :needs => [:pre])
247
+ assert_equal "t", t.name
248
+ assert_equal [], t.arg_names
249
+ assert_equal ["pre"], t.prerequisites
250
+ end
251
+
252
+ def test_name_args_and_explicit_needs
253
+ t = task(:t, :x, :y, :needs => [:pre])
254
+ assert_equal "t", t.name
255
+ assert_equal [:x, :y], t.arg_names
256
+ assert_equal ["pre"], t.prerequisites
257
+ end
258
+
259
+ def test_illegal_keys_in_task_name_hash
260
+ assert_raise RuntimeError do
261
+ t = task(:t, :x, :y => 1, :needs => [:pre])
262
+ end
263
+ end
264
+
265
+ def test_arg_list_is_empty_if_no_args_given
266
+ t = task(:t) { |tt, args| assert_equal({}, args.to_hash) }
267
+ t.invoke(1, 2, 3)
268
+ end
269
+
270
+ def test_tasks_can_access_arguments_as_hash
271
+ t = task :t, :a, :b, :c do |tt, args|
272
+ assert_equal({:a => 1, :b => 2, :c => 3}, args.to_hash)
273
+ assert_equal 1, args[:a]
274
+ assert_equal 2, args[:b]
275
+ assert_equal 3, args[:c]
276
+ assert_equal 1, args.a
277
+ assert_equal 2, args.b
278
+ assert_equal 3, args.c
279
+ end
280
+ t.invoke(1, 2, 3)
281
+ end
282
+
283
+ def test_actions_of_various_arity_are_ok_with_args
284
+ notes = []
285
+ t = task(:t, :x) do
286
+ notes << :a
287
+ end
288
+ t.enhance do | |
289
+ notes << :b
290
+ end
291
+ t.enhance do |task|
292
+ notes << :c
293
+ assert_kind_of Task, task
294
+ end
295
+ t.enhance do |t2, args|
296
+ notes << :d
297
+ assert_equal t, t2
298
+ assert_equal({:x => 1}, args.to_hash)
299
+ end
300
+ assert_nothing_raised do t.invoke(1) end
301
+ assert_equal [:a, :b, :c, :d], notes
302
+ end
303
+
304
+ def test_arguments_are_passed_to_block
305
+ t = task(:t, :a, :b) { |tt, args|
306
+ assert_equal( { :a => 1, :b => 2 }, args.to_hash )
307
+ }
308
+ t.invoke(1, 2)
309
+ end
310
+
311
+ def test_extra_parameters_are_ignored
312
+ t = task(:t, :a) { |tt, args|
313
+ assert_equal 1, args.a
314
+ assert_nil args.b
315
+ }
316
+ t.invoke(1, 2)
317
+ end
318
+
319
+ def test_arguments_are_passed_to_all_blocks
320
+ counter = 0
321
+ t = task :t, :a
322
+ task :t do |tt, args|
323
+ assert_equal 1, args.a
324
+ counter += 1
325
+ end
326
+ task :t do |tt, args|
327
+ assert_equal 1, args.a
328
+ counter += 1
329
+ end
330
+ t.invoke(1)
331
+ assert_equal 2, counter
332
+ end
333
+
334
+ def test_block_with_no_parameters_is_ok
335
+ t = task(:t) { }
336
+ t.invoke(1, 2)
337
+ end
338
+
339
+ def test_name_with_args
340
+ desc "T"
341
+ t = task(:tt, :a, :b)
342
+ assert_equal "tt", t.name
343
+ assert_equal "T", t.comment
344
+ assert_equal "[a,b]", t.arg_description
345
+ assert_equal "tt[a,b]", t.name_with_args
346
+ assert_equal [:a, :b],t.arg_names
347
+ end
348
+
349
+ def test_named_args_are_passed_to_prereqs
350
+ value = nil
351
+ pre = task(:pre, :rev) { |t, args| value = args.rev }
352
+ t = task(:t, :name, :rev, :needs => [:pre])
353
+ t.invoke("bill", "1.2")
354
+ assert_equal "1.2", value
355
+ end
356
+
357
+ def test_args_not_passed_if_no_prereq_names
358
+ pre = task(:pre) { |t, args|
359
+ assert_equal({}, args.to_hash)
360
+ assert_equal "bill", args.name
361
+ }
362
+ t = task(:t, :name, :rev, :needs => [:pre])
363
+ t.invoke("bill", "1.2")
364
+ end
365
+
366
+ def test_args_not_passed_if_no_arg_names
367
+ pre = task(:pre, :rev) { |t, args|
368
+ assert_equal({}, args.to_hash)
369
+ }
370
+ t = task(:t, :needs => [:pre])
371
+ t.invoke("bill", "1.2")
372
+ end
373
+ end
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake/testtask'
5
+
6
+ class TestTestTask < Test::Unit::TestCase
7
+ include Rake
8
+ def setup
9
+ Task.clear
10
+ ENV.delete('TEST')
11
+ end
12
+
13
+ def teardown
14
+ FileUtils.rm_rf("testdata")
15
+ end
16
+
17
+ def test_no_task
18
+ assert ! Task.task_defined?(:test)
19
+ end
20
+
21
+ def test_defaults
22
+ tt = Rake::TestTask.new do |t| end
23
+ assert_not_nil tt
24
+ assert_equal :test, tt.name
25
+ assert_equal ['lib'], tt.libs
26
+ assert_equal 'test/test*.rb', tt.pattern
27
+ assert_equal false, tt.verbose
28
+ assert Task.task_defined?(:test)
29
+ end
30
+
31
+ def test_non_defaults
32
+ tt = Rake::TestTask.new(:example) do |t|
33
+ t.libs = ['src', 'ext']
34
+ t.pattern = 'test/tc_*.rb'
35
+ t.verbose = true
36
+ end
37
+ assert_not_nil tt
38
+ assert_equal :example, tt.name
39
+ assert_equal ['src', 'ext'], tt.libs
40
+ assert_equal 'test/tc_*.rb', tt.pattern
41
+ assert_equal true, tt.verbose
42
+ assert Task.task_defined?(:example)
43
+ end
44
+
45
+ def test_pattern
46
+ tt = Rake::TestTask.new do |t|
47
+ t.pattern = '*.rb'
48
+ end
49
+ assert_equal ['install.rb'], tt.file_list.to_a
50
+ end
51
+
52
+ def test_env_test
53
+ ENV['TEST'] = 'testfile.rb'
54
+ tt = Rake::TestTask.new do |t|
55
+ t.pattern = '*'
56
+ end
57
+ assert_equal ["testfile.rb"], tt.file_list.to_a
58
+ end
59
+
60
+ def test_test_files
61
+ tt = Rake::TestTask.new do |t|
62
+ t.test_files = FileList['a.rb', 'b.rb']
63
+ end
64
+ assert_equal ["a.rb", 'b.rb'], tt.file_list.to_a
65
+ end
66
+
67
+ def test_both_pattern_and_test_files
68
+ tt = Rake::TestTask.new do |t|
69
+ t.test_files = FileList['a.rb', 'b.rb']
70
+ t.pattern = '*.rb'
71
+ end
72
+ assert_equal ['a.rb', 'b.rb', 'install.rb'], tt.file_list.to_a
73
+ end
74
+
75
+ end