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,382 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- TESTING_REQUIRE = [ ]
4
-
5
- class TestRakeApplicationOptions < Rake::TestCase
6
-
7
- def setup
8
- super
9
-
10
- clear_argv
11
- Rake::FileUtilsExt.verbose_flag = false
12
- Rake::FileUtilsExt.nowrite_flag = false
13
- TESTING_REQUIRE.clear
14
- end
15
-
16
- def teardown
17
- clear_argv
18
- Rake::FileUtilsExt.verbose_flag = false
19
- Rake::FileUtilsExt.nowrite_flag = false
20
-
21
- super
22
- end
23
-
24
- def clear_argv
25
- while ! ARGV.empty?
26
- ARGV.pop
27
- end
28
- end
29
-
30
- def test_default_options
31
- in_environment("RAKEOPT" => nil) do
32
- opts = command_line
33
- assert_nil opts.classic_namespace
34
- assert_nil opts.dryrun
35
- assert_nil opts.ignore_system
36
- assert_nil opts.load_system
37
- assert_nil opts.nosearch
38
- assert_equal ['rakelib'], opts.rakelib
39
- assert_nil opts.show_prereqs
40
- assert_nil opts.show_task_pattern
41
- assert_nil opts.show_tasks
42
- assert_nil opts.silent
43
- assert_nil opts.trace
44
- assert_equal ['rakelib'], opts.rakelib
45
- assert ! Rake::FileUtilsExt.verbose_flag
46
- assert ! Rake::FileUtilsExt.nowrite_flag
47
- end
48
- end
49
-
50
- def test_dry_run
51
- in_environment do
52
- flags('--dry-run', '-n') do |opts|
53
- assert opts.dryrun
54
- assert opts.trace
55
- assert Rake::FileUtilsExt.verbose_flag
56
- assert Rake::FileUtilsExt.nowrite_flag
57
- end
58
- end
59
- end
60
-
61
- def test_describe
62
- in_environment do
63
- flags('--describe') do |opts|
64
- assert_equal :describe, opts.show_tasks
65
- assert_equal(//.to_s, opts.show_task_pattern.to_s)
66
- end
67
- end
68
- end
69
-
70
- def test_describe_with_pattern
71
- in_environment do
72
- flags('--describe=X') do |opts|
73
- assert_equal :describe, opts.show_tasks
74
- assert_equal(/X/.to_s, opts.show_task_pattern.to_s)
75
- end
76
- end
77
- end
78
-
79
- def test_execute
80
- in_environment do
81
- $xyzzy = 0
82
- flags('--execute=$xyzzy=1', '-e $xyzzy=1') do |opts|
83
- assert_equal 1, $xyzzy
84
- assert_equal :exit, @exit
85
- $xyzzy = 0
86
- end
87
- end
88
- end
89
-
90
- def test_execute_and_continue
91
- in_environment do
92
- $xyzzy = 0
93
- flags('--execute-continue=$xyzzy=1', '-E $xyzzy=1') do |opts|
94
- assert_equal 1, $xyzzy
95
- refute_equal :exit, @exit
96
- $xyzzy = 0
97
- end
98
- end
99
- end
100
-
101
- def test_execute_and_print
102
- in_environment do
103
- $xyzzy = 0
104
- out, = capture_io do
105
- flags('--execute-print=$xyzzy="pugh"', '-p $xyzzy="pugh"') do |opts|
106
- assert_equal 'pugh', $xyzzy
107
- assert_equal :exit, @exit
108
- $xyzzy = 0
109
- end
110
- end
111
-
112
- assert_match(/^pugh$/, out)
113
- end
114
- end
115
-
116
- def test_help
117
- in_environment do
118
- out, = capture_io do
119
- flags '--help', '-H', '-h'
120
- end
121
-
122
- assert_match(/\Arake/, out)
123
- assert_match(/\boptions\b/, out)
124
- assert_match(/\btargets\b/, out)
125
- assert_equal :exit, @exit
126
- end
127
- end
128
-
129
- def test_libdir
130
- in_environment do
131
- flags(['--libdir', 'xx'], ['-I', 'xx'], ['-Ixx']) do |opts|
132
- $:.include?('xx')
133
- end
134
- end
135
- ensure
136
- $:.delete('xx')
137
- end
138
-
139
- def test_rakefile
140
- in_environment do
141
- flags(['--rakefile', 'RF'], ['--rakefile=RF'], ['-f', 'RF'], ['-fRF']) do |opts|
142
- assert_equal ['RF'], @app.instance_eval { @rakefiles }
143
- end
144
- end
145
- end
146
-
147
- def test_rakelib
148
- in_environment do
149
- flags(['--rakelibdir', 'A:B:C'], ['--rakelibdir=A:B:C'], ['-R', 'A:B:C'], ['-RA:B:C']) do |opts|
150
- assert_equal ['A', 'B', 'C'], opts.rakelib
151
- end
152
- end
153
- end
154
-
155
- def test_require
156
- in_environment do
157
- flags(['--require', 'test/reqfile'], '-rtest/reqfile2', '-rtest/reqfile3') do |opts|
158
- end
159
- assert TESTING_REQUIRE.include?(1)
160
- assert TESTING_REQUIRE.include?(2)
161
- assert TESTING_REQUIRE.include?(3)
162
- assert_equal 3, TESTING_REQUIRE.size
163
- end
164
- end
165
-
166
- def test_missing_require
167
- in_environment do
168
- ex = assert_raises(LoadError) do
169
- flags(['--require', 'test/missing']) do |opts|
170
- end
171
- end
172
- assert_match(/such file/, ex.message)
173
- assert_match(/test\/missing/, ex.message)
174
- end
175
- end
176
-
177
- def test_prereqs
178
- in_environment do
179
- flags('--prereqs', '-P') do |opts|
180
- assert opts.show_prereqs
181
- end
182
- end
183
- end
184
-
185
- def test_quiet
186
- in_environment do
187
- flags('--quiet', '-q') do |opts|
188
- assert ! Rake::FileUtilsExt.verbose_flag
189
- assert ! opts.silent
190
- end
191
- end
192
- end
193
-
194
- def test_no_search
195
- in_environment do
196
- flags('--nosearch', '--no-search', '-N') do |opts|
197
- assert opts.nosearch
198
- end
199
- end
200
- end
201
-
202
- def test_silent
203
- in_environment do
204
- flags('--silent', '-s') do |opts|
205
- assert ! Rake::FileUtilsExt.verbose_flag
206
- assert opts.silent
207
- end
208
- end
209
- end
210
-
211
- def test_system
212
- in_environment do
213
- flags('--system', '-g') do |opts|
214
- assert opts.load_system
215
- end
216
- end
217
- end
218
-
219
- def test_no_system
220
- in_environment do
221
- flags('--no-system', '-G') do |opts|
222
- assert opts.ignore_system
223
- end
224
- end
225
- end
226
-
227
- def test_trace
228
- in_environment do
229
- flags('--trace', '-t') do |opts|
230
- assert opts.trace
231
- assert Rake::FileUtilsExt.verbose_flag
232
- assert ! Rake::FileUtilsExt.nowrite_flag
233
- end
234
- end
235
- end
236
-
237
- def test_trace_rules
238
- in_environment do
239
- flags('--rules') do |opts|
240
- assert opts.trace_rules
241
- end
242
- end
243
- end
244
-
245
- def test_tasks
246
- in_environment do
247
- flags('--tasks', '-T') do |opts|
248
- assert_equal :tasks, opts.show_tasks
249
- assert_equal(//.to_s, opts.show_task_pattern.to_s)
250
- end
251
- flags(['--tasks', 'xyz'], ['-Txyz']) do |opts|
252
- assert_equal :tasks, opts.show_tasks
253
- assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
254
- end
255
- end
256
- end
257
-
258
- def test_where
259
- in_environment do
260
- flags('--where', '-W') do |opts|
261
- assert_equal :lines, opts.show_tasks
262
- assert_equal(//.to_s, opts.show_task_pattern.to_s)
263
- end
264
- flags(['--where', 'xyz'], ['-Wxyz']) do |opts|
265
- assert_equal :lines, opts.show_tasks
266
- assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
267
- end
268
- end
269
- end
270
-
271
- def test_no_deprecated_messages
272
- in_environment do
273
- flags('--no-deprecation-warnings', '-X') do |opts|
274
- assert opts.ignore_deprecate
275
- end
276
- end
277
- end
278
-
279
- def test_verbose
280
- in_environment do
281
- out, = capture_io do
282
- flags('--verbose', '-V') do |opts|
283
- assert Rake::FileUtilsExt.verbose_flag
284
- assert ! opts.silent
285
- end
286
- end
287
-
288
- assert_equal "rake, version #{Rake::VERSION}\n", out
289
- end
290
- end
291
-
292
- def test_version
293
- in_environment do
294
- out, = capture_io do
295
- flags '--version', '-V'
296
- end
297
-
298
- assert_match(/\bversion\b/, out)
299
- assert_match(/\b#{RAKEVERSION}\b/, out)
300
- assert_equal :exit, @exit
301
- end
302
- end
303
-
304
- def test_classic_namespace
305
- in_environment do
306
- _, err = capture_io do
307
- flags(['--classic-namespace'],
308
- ['-C', '-T', '-P', '-n', '-s', '-t']) do |opts|
309
- assert opts.classic_namespace
310
- assert_equal opts.show_tasks, $show_tasks
311
- assert_equal opts.show_prereqs, $show_prereqs
312
- assert_equal opts.trace, $trace
313
- assert_equal opts.dryrun, $dryrun
314
- assert_equal opts.silent, $silent
315
- end
316
- end
317
-
318
- assert_match(/deprecated/, err)
319
- end
320
- end
321
-
322
- def test_bad_option
323
- in_environment do
324
- _, err = capture_io do
325
- ex = assert_raises(OptionParser::InvalidOption) do
326
- flags('--bad-option')
327
- end
328
- if ex.message =~ /^While/ # Ruby 1.9 error message
329
- assert_match(/while parsing/i, ex.message)
330
- else # Ruby 1.8 error message
331
- assert_match(/(invalid|unrecognized) option/i, ex.message)
332
- assert_match(/--bad-option/, ex.message)
333
- end
334
- end
335
- assert_equal '', err
336
- end
337
- end
338
-
339
- def test_task_collection
340
- command_line("a", "b")
341
- assert_equal ["a", "b"], @tasks.sort
342
- end
343
-
344
- def test_default_task_collection
345
- command_line()
346
- assert_equal ["default"], @tasks
347
- end
348
-
349
- def test_environment_definition
350
- ENV.delete('TESTKEY')
351
- command_line("a", "TESTKEY=12")
352
- assert_equal ["a"], @tasks.sort
353
- assert '12', ENV['TESTKEY']
354
- end
355
-
356
- private
357
-
358
- def flags(*sets)
359
- sets.each do |set|
360
- ARGV.clear
361
-
362
- @exit = catch(:system_exit) { command_line(*set) }
363
-
364
- yield(@app.options) if block_given?
365
- end
366
- end
367
-
368
- def command_line(*options)
369
- options.each do |opt| ARGV << opt end
370
- @app = Rake::Application.new
371
- def @app.exit(*args)
372
- throw :system_exit, :exit
373
- end
374
- @app.instance_eval do
375
- handle_options
376
- collect_tasks
377
- end
378
- @tasks = @app.top_level_tasks
379
- @app.options
380
- end
381
- end
382
-
@@ -1,12 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
- require 'rake/clean'
3
-
4
- class TestRakeClean < Rake::TestCase
5
- include Rake
6
- def test_clean
7
- assert Task['clean'], "Should define clean"
8
- assert Task['clobber'], "Should define clobber"
9
- assert Task['clobber'].prerequisites.include?("clean"),
10
- "Clobber should require clean"
11
- end
12
- end
@@ -1,80 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
- require 'fileutils'
3
-
4
- class TestRakeDefinitions < Rake::TestCase
5
- include Rake
6
-
7
- EXISTINGFILE = "testdata/existing"
8
-
9
- def setup
10
- super
11
-
12
- Task.clear
13
- end
14
-
15
- def test_task
16
- done = false
17
- task :one => [:two] do done = true end
18
- task :two
19
- task :three => [:one, :two]
20
- check_tasks(:one, :two, :three)
21
- assert done, "Should be done"
22
- end
23
-
24
- def test_file_task
25
- done = false
26
- file "testdata/one" => "testdata/two" do done = true end
27
- file "testdata/two"
28
- file "testdata/three" => ["testdata/one", "testdata/two"]
29
- check_tasks("testdata/one", "testdata/two", "testdata/three")
30
- assert done, "Should be done"
31
- end
32
-
33
- def check_tasks(n1, n2, n3)
34
- t = Task[n1]
35
- assert Task === t, "Should be a Task"
36
- assert_equal n1.to_s, t.name
37
- assert_equal [n2.to_s], t.prerequisites.collect{|n| n.to_s}
38
- t.invoke
39
- t2 = Task[n2]
40
- assert_equal FileList[], t2.prerequisites
41
- t3 = Task[n3]
42
- assert_equal [n1.to_s, n2.to_s], t3.prerequisites.collect{|n|n.to_s}
43
- end
44
-
45
- def test_incremental_definitions
46
- runs = []
47
- task :t1 => [:t2] do runs << "A"; 4321 end
48
- task :t1 => [:t3] do runs << "B"; 1234 end
49
- task :t1 => [:t3]
50
- task :t2
51
- task :t3
52
- Task[:t1].invoke
53
- assert_equal ["A", "B"], runs
54
- assert_equal ["t2", "t3"], Task[:t1].prerequisites
55
- end
56
-
57
- def test_missing_dependencies
58
- task :x => ["testdata/missing"]
59
- assert_raises(RuntimeError) { Task[:x].invoke }
60
- end
61
-
62
- def test_implicit_file_dependencies
63
- runs = []
64
- create_existing_file
65
- task :y => [EXISTINGFILE] do |t| runs << t.name end
66
- Task[:y].invoke
67
- assert_equal runs, ['y']
68
- end
69
-
70
- private # ----------------------------------------------------------
71
-
72
- def create_existing_file
73
- Dir.mkdir File.dirname(EXISTINGFILE) unless
74
- File.exist?(File.dirname(EXISTINGFILE))
75
- open(EXISTINGFILE, "w") do |f| f.puts "HI" end unless
76
- File.exist?(EXISTINGFILE)
77
- end
78
-
79
- end
80
-