rake 0.9.2.2 → 13.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +7 -0
  2. data/History.rdoc +2403 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +64 -106
  5. data/doc/command_line_usage.rdoc +65 -21
  6. data/doc/glossary.rdoc +40 -49
  7. data/doc/jamis.rb +1 -0
  8. data/doc/rake.1 +156 -0
  9. data/doc/rakefile.rdoc +127 -62
  10. data/{bin → exe}/rake +1 -7
  11. data/lib/rake/application.rb +507 -271
  12. data/lib/rake/backtrace.rb +24 -0
  13. data/lib/rake/clean.rb +54 -8
  14. data/lib/rake/cloneable.rb +11 -19
  15. data/lib/rake/cpu_counter.rb +107 -0
  16. data/lib/rake/default_loader.rb +5 -0
  17. data/lib/rake/dsl_definition.rb +67 -48
  18. data/lib/rake/early_time.rb +5 -1
  19. data/lib/rake/ext/core.rb +5 -6
  20. data/lib/rake/ext/string.rb +61 -52
  21. data/lib/rake/file_creation_task.rb +4 -3
  22. data/lib/rake/file_list.rb +81 -49
  23. data/lib/rake/file_task.rb +15 -8
  24. data/lib/rake/file_utils.rb +63 -43
  25. data/lib/rake/file_utils_ext.rb +14 -25
  26. data/lib/rake/invocation_chain.rb +25 -19
  27. data/lib/rake/invocation_exception_mixin.rb +1 -0
  28. data/lib/rake/late_time.rb +18 -0
  29. data/lib/rake/linked_list.rb +112 -0
  30. data/lib/rake/loaders/makefile.rb +23 -9
  31. data/lib/rake/multi_task.rb +4 -6
  32. data/lib/rake/name_space.rb +36 -23
  33. data/lib/rake/packagetask.rb +71 -34
  34. data/lib/rake/phony.rb +16 -0
  35. data/lib/rake/private_reader.rb +21 -0
  36. data/lib/rake/promise.rb +100 -0
  37. data/lib/rake/pseudo_status.rb +8 -2
  38. data/lib/rake/rake_module.rb +41 -3
  39. data/lib/rake/rake_test_loader.rb +9 -4
  40. data/lib/rake/rule_recursion_overflow_error.rb +2 -2
  41. data/lib/rake/scope.rb +43 -0
  42. data/lib/rake/task.rb +186 -79
  43. data/lib/rake/task_argument_error.rb +1 -0
  44. data/lib/rake/task_arguments.rb +46 -15
  45. data/lib/rake/task_manager.rb +91 -67
  46. data/lib/rake/tasklib.rb +2 -12
  47. data/lib/rake/testtask.rb +61 -63
  48. data/lib/rake/thread_history_display.rb +49 -0
  49. data/lib/rake/thread_pool.rb +163 -0
  50. data/lib/rake/trace_output.rb +23 -0
  51. data/lib/rake/version.rb +5 -3
  52. data/lib/rake/win32.rb +14 -18
  53. data/lib/rake.rb +35 -33
  54. data/rake.gemspec +100 -0
  55. metadata +74 -176
  56. data/.gemtest +0 -0
  57. data/CHANGES +0 -522
  58. data/Rakefile +0 -369
  59. data/TODO +0 -20
  60. data/doc/rake.1.gz +0 -0
  61. data/doc/release_notes/rake-0.4.14.rdoc +0 -23
  62. data/doc/release_notes/rake-0.4.15.rdoc +0 -35
  63. data/doc/release_notes/rake-0.5.0.rdoc +0 -53
  64. data/doc/release_notes/rake-0.5.3.rdoc +0 -78
  65. data/doc/release_notes/rake-0.5.4.rdoc +0 -46
  66. data/doc/release_notes/rake-0.6.0.rdoc +0 -141
  67. data/doc/release_notes/rake-0.7.0.rdoc +0 -119
  68. data/doc/release_notes/rake-0.7.1.rdoc +0 -59
  69. data/doc/release_notes/rake-0.7.2.rdoc +0 -121
  70. data/doc/release_notes/rake-0.7.3.rdoc +0 -47
  71. data/doc/release_notes/rake-0.8.0.rdoc +0 -114
  72. data/doc/release_notes/rake-0.8.2.rdoc +0 -165
  73. data/doc/release_notes/rake-0.8.3.rdoc +0 -112
  74. data/doc/release_notes/rake-0.8.4.rdoc +0 -147
  75. data/doc/release_notes/rake-0.8.5.rdoc +0 -53
  76. data/doc/release_notes/rake-0.8.6.rdoc +0 -55
  77. data/doc/release_notes/rake-0.8.7.rdoc +0 -55
  78. data/doc/release_notes/rake-0.9.0.rdoc +0 -112
  79. data/doc/release_notes/rake-0.9.1.rdoc +0 -52
  80. data/doc/release_notes/rake-0.9.2.rdoc +0 -49
  81. data/install.rb +0 -90
  82. data/lib/rake/alt_system.rb +0 -109
  83. data/lib/rake/classic_namespace.rb +0 -11
  84. data/lib/rake/contrib/compositepublisher.rb +0 -21
  85. data/lib/rake/contrib/ftptools.rb +0 -150
  86. data/lib/rake/contrib/publisher.rb +0 -73
  87. data/lib/rake/contrib/rubyforgepublisher.rb +0 -16
  88. data/lib/rake/contrib/sshpublisher.rb +0 -50
  89. data/lib/rake/contrib/sys.rb +0 -191
  90. data/lib/rake/ext/module.rb +0 -39
  91. data/lib/rake/ext/time.rb +0 -14
  92. data/lib/rake/gempackagetask.rb +0 -15
  93. data/lib/rake/pathmap.rb +0 -1
  94. data/lib/rake/rdoctask.rb +0 -234
  95. data/lib/rake/ruby182_test_unit_fix.rb +0 -25
  96. data/lib/rake/runtest.rb +0 -21
  97. data/test/file_creation.rb +0 -34
  98. data/test/helper.rb +0 -492
  99. data/test/test_rake.rb +0 -40
  100. data/test/test_rake_application.rb +0 -489
  101. data/test/test_rake_application_options.rb +0 -335
  102. data/test/test_rake_clean.rb +0 -14
  103. data/test/test_rake_definitions.rb +0 -80
  104. data/test/test_rake_directory_task.rb +0 -46
  105. data/test/test_rake_dsl.rb +0 -77
  106. data/test/test_rake_early_time.rb +0 -31
  107. data/test/test_rake_extension.rb +0 -59
  108. data/test/test_rake_file_creation_task.rb +0 -56
  109. data/test/test_rake_file_list.rb +0 -628
  110. data/test/test_rake_file_list_path_map.rb +0 -8
  111. data/test/test_rake_file_task.rb +0 -102
  112. data/test/test_rake_file_utils.rb +0 -305
  113. data/test/test_rake_ftp_file.rb +0 -59
  114. data/test/test_rake_functional.rb +0 -450
  115. data/test/test_rake_invocation_chain.rb +0 -52
  116. data/test/test_rake_makefile_loader.rb +0 -44
  117. data/test/test_rake_multi_task.rb +0 -51
  118. data/test/test_rake_name_space.rb +0 -43
  119. data/test/test_rake_package_task.rb +0 -79
  120. data/test/test_rake_path_map.rb +0 -157
  121. data/test/test_rake_path_map_explode.rb +0 -34
  122. data/test/test_rake_path_map_partial.rb +0 -18
  123. data/test/test_rake_pseudo_status.rb +0 -21
  124. data/test/test_rake_rake_test_loader.rb +0 -21
  125. data/test/test_rake_rdoc_task.rb +0 -83
  126. data/test/test_rake_require.rb +0 -40
  127. data/test/test_rake_rules.rb +0 -327
  128. data/test/test_rake_task.rb +0 -267
  129. data/test/test_rake_task_argument_parsing.rb +0 -103
  130. data/test/test_rake_task_arguments.rb +0 -88
  131. data/test/test_rake_task_lib.rb +0 -9
  132. data/test/test_rake_task_manager.rb +0 -157
  133. data/test/test_rake_task_manager_argument_resolution.rb +0 -36
  134. data/test/test_rake_task_with_arguments.rb +0 -173
  135. data/test/test_rake_test_task.rb +0 -120
  136. data/test/test_rake_top_level_functions.rb +0 -111
  137. data/test/test_rake_win32.rb +0 -72
  138. data/test/test_sys.rb +0 -20
@@ -1,489 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- class TestRakeApplication < Rake::TestCase
4
-
5
- def setup
6
- super
7
-
8
- @app = Rake.application
9
- @app.options.rakelib = []
10
- end
11
-
12
- def test_constant_warning
13
- _, err = capture_io do @app.instance_eval { const_warning("Task") } end
14
- assert_match(/warning/i, err)
15
- assert_match(/deprecated/i, err)
16
- assert_match(/Task/i, err)
17
- end
18
-
19
- def test_display_tasks
20
- @app.options.show_tasks = :tasks
21
- @app.options.show_task_pattern = //
22
- @app.last_description = "COMMENT"
23
- @app.define_task(Rake::Task, "t")
24
- out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
25
- assert_match(/^rake t/, out)
26
- assert_match(/# COMMENT/, out)
27
- end
28
-
29
- def test_display_tasks_with_long_comments
30
- @app.terminal_columns = 80
31
- @app.options.show_tasks = :tasks
32
- @app.options.show_task_pattern = //
33
- @app.last_description = "1234567890" * 8
34
- @app.define_task(Rake::Task, "t")
35
-
36
- out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
37
-
38
- assert_match(/^rake t/, out)
39
- assert_match(/# 12345678901234567890123456789012345678901234567890123456789012345\.\.\./, out)
40
- end
41
-
42
- def test_display_tasks_with_task_name_wider_than_tty_display
43
- @app.terminal_columns = 80
44
- @app.options.show_tasks = :tasks
45
- @app.options.show_task_pattern = //
46
- task_name = "task name" * 80
47
- @app.last_description = "something short"
48
- @app.define_task(Rake::Task, task_name )
49
-
50
- out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
51
-
52
- # Ensure the entire task name is output and we end up showing no description
53
- assert_match(/rake #{task_name} # .../, out)
54
- end
55
-
56
- def test_display_tasks_with_very_long_task_name_to_a_non_tty_shows_name_and_comment
57
- @app.options.show_tasks = :tasks
58
- @app.options.show_task_pattern = //
59
- @app.tty_output = false
60
- description = "something short"
61
- task_name = "task name" * 80
62
- @app.last_description = "something short"
63
- @app.define_task(Rake::Task, task_name )
64
-
65
- out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
66
-
67
- # Ensure the entire task name is output and we end up showing no description
68
- assert_match(/rake #{task_name} # #{description}/, out)
69
- end
70
-
71
- def test_display_tasks_with_long_comments_to_a_non_tty_shows_entire_comment
72
- @app.options.show_tasks = :tasks
73
- @app.options.show_task_pattern = //
74
- @app.tty_output = false
75
- @app.last_description = "1234567890" * 8
76
- @app.define_task(Rake::Task, "t")
77
- out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
78
- assert_match(/^rake t/, out)
79
- assert_match(/# #{@app.last_description}/, out)
80
- end
81
-
82
- def test_display_tasks_with_long_comments_to_a_non_tty_with_columns_set_truncates_comments
83
- @app.terminal_columns = 80
84
- @app.options.show_tasks = :tasks
85
- @app.options.show_task_pattern = //
86
- @app.tty_output = false
87
- @app.last_description = "1234567890" * 8
88
- @app.define_task(Rake::Task, "t")
89
-
90
- out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
91
-
92
- assert_match(/^rake t/, out)
93
- assert_match(/# 12345678901234567890123456789012345678901234567890123456789012345\.\.\./, out)
94
- end
95
-
96
- def test_describe_tasks
97
- @app.options.show_tasks = :describe
98
- @app.options.show_task_pattern = //
99
- @app.last_description = "COMMENT"
100
- @app.define_task(Rake::Task, "t")
101
- out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
102
- assert_match(/^rake t$/, out)
103
- assert_match(/^ {4}COMMENT$/, out)
104
- end
105
-
106
- def test_show_lines
107
- @app.options.show_tasks = :lines
108
- @app.options.show_task_pattern = //
109
- @app.last_description = "COMMENT"
110
- @app.define_task(Rake::Task, "t")
111
- @app['t'].locations << "HERE:1"
112
- out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
113
- assert_match(/^rake t +[^:]+:\d+ *$/, out)
114
- end
115
-
116
- def test_finding_rakefile
117
- rakefile_default
118
-
119
- assert_match(/Rakefile/i, @app.instance_eval { have_rakefile })
120
- end
121
-
122
- def test_not_finding_rakefile
123
- @app.instance_eval { @rakefiles = ['NEVER_FOUND'] }
124
- assert( ! @app.instance_eval do have_rakefile end )
125
- assert_nil @app.rakefile
126
- end
127
-
128
- def test_load_rakefile
129
- rakefile_unittest
130
-
131
- @app.instance_eval do
132
- handle_options
133
- options.silent = true
134
- load_rakefile
135
- end
136
-
137
- assert_equal "rakefile", @app.rakefile.downcase
138
- assert_equal @tempdir, Dir.pwd
139
- end
140
-
141
- def test_load_rakefile_doesnt_print_rakefile_directory_from_same_dir
142
- rakefile_unittest
143
-
144
- _, err = capture_io do
145
- @app.instance_eval do
146
- # pretend we started from the unittest dir
147
- @original_dir = File.expand_path(".")
148
- raw_load_rakefile
149
- end
150
- end
151
-
152
- assert_empty err
153
- end
154
-
155
- def test_load_rakefile_from_subdir
156
- rakefile_unittest
157
- Dir.chdir 'subdir'
158
-
159
- @app.instance_eval do
160
- handle_options
161
- options.silent = true
162
- load_rakefile
163
- end
164
-
165
- assert_equal "rakefile", @app.rakefile.downcase
166
- assert_equal @tempdir, Dir.pwd
167
- end
168
-
169
- def test_load_rakefile_prints_rakefile_directory_from_subdir
170
- rakefile_unittest
171
- Dir.chdir 'subdir'
172
-
173
- app = Rake::Application.new
174
- app.options.rakelib = []
175
-
176
- _, err = capture_io do
177
- app.instance_eval do
178
- raw_load_rakefile
179
- end
180
- end
181
-
182
- assert_equal "(in #{@tempdir}\)\n", err
183
- end
184
-
185
- def test_load_rakefile_doesnt_print_rakefile_directory_from_subdir_if_silent
186
- rakefile_unittest
187
- Dir.chdir 'subdir'
188
-
189
- _, err = capture_io do
190
- @app.instance_eval do
191
- handle_options
192
- options.silent = true
193
- raw_load_rakefile
194
- end
195
- end
196
-
197
- assert_empty err
198
- end
199
-
200
- def test_load_rakefile_not_found
201
- Dir.chdir @tempdir
202
- ENV['RAKE_SYSTEM'] = 'not_exist'
203
-
204
- @app.instance_eval do
205
- handle_options
206
- options.silent = true
207
- end
208
-
209
- ex = assert_raises(RuntimeError) do
210
- @app.instance_eval do raw_load_rakefile end
211
- end
212
-
213
- assert_match(/no rakefile found/i, ex.message)
214
- end
215
-
216
- def test_load_from_system_rakefile
217
- rake_system_dir
218
-
219
- @app.instance_eval do
220
- handle_options
221
- options.silent = true
222
- options.load_system = true
223
- options.rakelib = []
224
- load_rakefile
225
- end
226
-
227
- assert_equal @system_dir, @app.system_dir
228
- assert_nil @app.rakefile
229
- rescue SystemExit
230
- flunk 'failed to load rakefile'
231
- end
232
-
233
- def test_load_from_calculated_system_rakefile
234
- rakefile_default
235
- def @app.standard_system_dir
236
- "__STD_SYS_DIR__"
237
- end
238
-
239
- ENV['RAKE_SYSTEM'] = nil
240
-
241
- @app.instance_eval do
242
- handle_options
243
- options.silent = true
244
- options.load_system = true
245
- options.rakelib = []
246
- load_rakefile
247
- end
248
-
249
- assert_equal "__STD_SYS_DIR__", @app.system_dir
250
- rescue SystemExit
251
- flunk 'failed to find system rakefile'
252
- end
253
-
254
- def test_terminal_columns
255
- old_RAKE_COLUMNS = ENV['RAKE_COLUMNS']
256
-
257
- ENV['RAKE_COLUMNS'] = '42'
258
-
259
- app = Rake::Application.new
260
-
261
- assert_equal 42, app.terminal_columns
262
- ensure
263
- if old_RAKE_COLUMNS then
264
- ENV['RAKE_COLUMNS'].delete
265
- else
266
- ENV['RAKE_COLUMNS'] = old_RAKE_COLUMNS
267
- end
268
- end
269
-
270
- def test_windows
271
- assert ! (@app.windows? && @app.unix?)
272
- end
273
-
274
- def test_loading_imports
275
- loader = util_loader
276
-
277
- @app.instance_eval do
278
- add_loader("dummy", loader)
279
- add_import("x.dummy")
280
- load_imports
281
- end
282
-
283
- # HACK no assertions
284
- end
285
-
286
- def test_building_imported_files_on_demand
287
- loader = util_loader
288
-
289
- @app.instance_eval do
290
- intern(Rake::Task, "x.dummy").enhance do loader.make_dummy end
291
- add_loader("dummy", loader)
292
- add_import("x.dummy")
293
- load_imports
294
- end
295
-
296
- # HACK no assertions
297
- end
298
-
299
- def test_handle_options_should_strip_options_from_ARGV
300
- assert !@app.options.trace
301
-
302
- valid_option = '--trace'
303
- ARGV.clear
304
- ARGV << valid_option
305
-
306
- @app.handle_options
307
-
308
- assert !ARGV.include?(valid_option)
309
- assert @app.options.trace
310
- end
311
-
312
- def test_good_run
313
- ran = false
314
-
315
- ARGV << '--rakelib=""'
316
-
317
- @app.options.silent = true
318
-
319
- @app.instance_eval do
320
- intern(Rake::Task, "default").enhance { ran = true }
321
- end
322
-
323
- rakefile_default
324
-
325
- out, err = capture_io do
326
- @app.run
327
- end
328
-
329
- assert ran
330
- assert_empty err
331
- assert_equal "DEFAULT\n", out
332
- end
333
-
334
- def test_display_task_run
335
- ran = false
336
- ARGV.clear
337
- ARGV << '-f' << '-s' << '--tasks' << '--rakelib=""'
338
- @app.last_description = "COMMENT"
339
- @app.define_task(Rake::Task, "default")
340
- out, = capture_io { @app.run }
341
- assert @app.options.show_tasks
342
- assert ! ran
343
- assert_match(/rake default/, out)
344
- assert_match(/# COMMENT/, out)
345
- end
346
-
347
- def test_display_prereqs
348
- ran = false
349
- ARGV.clear
350
- ARGV << '-f' << '-s' << '--prereqs' << '--rakelib=""'
351
- @app.last_description = "COMMENT"
352
- t = @app.define_task(Rake::Task, "default")
353
- t.enhance([:a, :b])
354
- @app.define_task(Rake::Task, "a")
355
- @app.define_task(Rake::Task, "b")
356
- out, = capture_io { @app.run }
357
- assert @app.options.show_prereqs
358
- assert ! ran
359
- assert_match(/rake a$/, out)
360
- assert_match(/rake b$/, out)
361
- assert_match(/rake default\n( *(a|b)\n){2}/m, out)
362
- end
363
-
364
- def test_bad_run
365
- @app.intern(Rake::Task, "default").enhance { fail }
366
- ARGV.clear
367
- ARGV << '-f' << '-s' << '--rakelib=""'
368
- assert_raises(SystemExit) {
369
- _, err = capture_io { @app.run }
370
- assert_match(/see full trace/, err)
371
- }
372
- ensure
373
- ARGV.clear
374
- end
375
-
376
- def test_bad_run_with_trace
377
- @app.intern(Rake::Task, "default").enhance { fail }
378
- ARGV.clear
379
- ARGV << '-f' << '-s' << '-t'
380
- assert_raises(SystemExit) {
381
- _, err = capture_io { @app.run }
382
- refute_match(/see full trace/, err)
383
- }
384
- ensure
385
- ARGV.clear
386
- end
387
-
388
- def test_run_with_bad_options
389
- @app.intern(Rake::Task, "default").enhance { fail }
390
- ARGV.clear
391
- ARGV << '-f' << '-s' << '--xyzzy'
392
- assert_raises(SystemExit) {
393
- capture_io { @app.run }
394
- }
395
- ensure
396
- ARGV.clear
397
- end
398
-
399
- def test_deprecation_message
400
- _, err = capture_io do
401
- @app.deprecate("a", "b", "c")
402
- end
403
- assert_match(/'a' is deprecated/i, err)
404
- assert_match(/use 'b' instead/i, err)
405
- assert_match(/at c$/i, err)
406
- end
407
-
408
- def test_standard_exception_handling_invalid_option
409
- out, err = capture_io do
410
- e = assert_raises SystemExit do
411
- @app.standard_exception_handling do
412
- raise OptionParser::InvalidOption, 'blah'
413
- end
414
- end
415
-
416
- assert_equal 1, e.status
417
- end
418
-
419
- assert_empty out
420
- assert_equal "invalid option: blah\n", err
421
- end
422
-
423
- def test_standard_exception_handling_other
424
- out, err = capture_io do
425
- e = assert_raises SystemExit do
426
- @app.standard_exception_handling do
427
- raise 'blah'
428
- end
429
- end
430
-
431
- assert_equal 1, e.status
432
- end
433
-
434
- assert_empty out
435
- assert_match "rake aborted!\n", err
436
- assert_match "blah\n", err
437
- end
438
-
439
- def test_standard_exception_handling_system_exit
440
- out, err = capture_io do
441
- e = assert_raises SystemExit do
442
- @app.standard_exception_handling do
443
- exit 0
444
- end
445
- end
446
-
447
- assert_equal 0, e.status
448
- end
449
-
450
- assert_empty out
451
- assert_empty err
452
- end
453
-
454
- def test_standard_exception_handling_system_exit_nonzero
455
- out, err = capture_io do
456
- e = assert_raises SystemExit do
457
- @app.standard_exception_handling do
458
- exit 5
459
- end
460
- end
461
-
462
- assert_equal 5, e.status
463
- end
464
-
465
- assert_empty out
466
- assert_empty err
467
- end
468
-
469
- def util_loader
470
- loader = Object.new
471
-
472
- loader.instance_variable_set :@load_called, false
473
- def loader.load arg
474
- raise 'called more than once' if @load_called
475
- raise ArgumentError, arg unless arg == 'x.dummy'
476
- @load_called = true
477
- end
478
-
479
- loader.instance_variable_set :@make_dummy_called, false
480
- def loader.make_dummy
481
- raise 'called more than once' if @make_dummy_called
482
- @make_dummy_called = true
483
- end
484
-
485
- loader
486
- end
487
-
488
- end
489
-