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.
- checksums.yaml +7 -0
- data/History.rdoc +2403 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +64 -106
- data/doc/command_line_usage.rdoc +65 -21
- data/doc/glossary.rdoc +40 -49
- data/doc/jamis.rb +1 -0
- data/doc/rake.1 +156 -0
- data/doc/rakefile.rdoc +127 -62
- data/{bin → exe}/rake +1 -7
- data/lib/rake/application.rb +507 -271
- data/lib/rake/backtrace.rb +24 -0
- data/lib/rake/clean.rb +54 -8
- data/lib/rake/cloneable.rb +11 -19
- data/lib/rake/cpu_counter.rb +107 -0
- data/lib/rake/default_loader.rb +5 -0
- data/lib/rake/dsl_definition.rb +67 -48
- data/lib/rake/early_time.rb +5 -1
- data/lib/rake/ext/core.rb +5 -6
- data/lib/rake/ext/string.rb +61 -52
- data/lib/rake/file_creation_task.rb +4 -3
- data/lib/rake/file_list.rb +81 -49
- data/lib/rake/file_task.rb +15 -8
- data/lib/rake/file_utils.rb +63 -43
- data/lib/rake/file_utils_ext.rb +14 -25
- data/lib/rake/invocation_chain.rb +25 -19
- data/lib/rake/invocation_exception_mixin.rb +1 -0
- data/lib/rake/late_time.rb +18 -0
- data/lib/rake/linked_list.rb +112 -0
- data/lib/rake/loaders/makefile.rb +23 -9
- data/lib/rake/multi_task.rb +4 -6
- data/lib/rake/name_space.rb +36 -23
- data/lib/rake/packagetask.rb +71 -34
- data/lib/rake/phony.rb +16 -0
- data/lib/rake/private_reader.rb +21 -0
- data/lib/rake/promise.rb +100 -0
- data/lib/rake/pseudo_status.rb +8 -2
- data/lib/rake/rake_module.rb +41 -3
- data/lib/rake/rake_test_loader.rb +9 -4
- data/lib/rake/rule_recursion_overflow_error.rb +2 -2
- data/lib/rake/scope.rb +43 -0
- data/lib/rake/task.rb +186 -79
- data/lib/rake/task_argument_error.rb +1 -0
- data/lib/rake/task_arguments.rb +46 -15
- data/lib/rake/task_manager.rb +91 -67
- data/lib/rake/tasklib.rb +2 -12
- data/lib/rake/testtask.rb +61 -63
- data/lib/rake/thread_history_display.rb +49 -0
- data/lib/rake/thread_pool.rb +163 -0
- data/lib/rake/trace_output.rb +23 -0
- data/lib/rake/version.rb +5 -3
- data/lib/rake/win32.rb +14 -18
- data/lib/rake.rb +35 -33
- data/rake.gemspec +100 -0
- metadata +74 -176
- data/.gemtest +0 -0
- data/CHANGES +0 -522
- data/Rakefile +0 -369
- data/TODO +0 -20
- data/doc/rake.1.gz +0 -0
- data/doc/release_notes/rake-0.4.14.rdoc +0 -23
- data/doc/release_notes/rake-0.4.15.rdoc +0 -35
- data/doc/release_notes/rake-0.5.0.rdoc +0 -53
- data/doc/release_notes/rake-0.5.3.rdoc +0 -78
- data/doc/release_notes/rake-0.5.4.rdoc +0 -46
- data/doc/release_notes/rake-0.6.0.rdoc +0 -141
- data/doc/release_notes/rake-0.7.0.rdoc +0 -119
- data/doc/release_notes/rake-0.7.1.rdoc +0 -59
- data/doc/release_notes/rake-0.7.2.rdoc +0 -121
- data/doc/release_notes/rake-0.7.3.rdoc +0 -47
- data/doc/release_notes/rake-0.8.0.rdoc +0 -114
- data/doc/release_notes/rake-0.8.2.rdoc +0 -165
- data/doc/release_notes/rake-0.8.3.rdoc +0 -112
- data/doc/release_notes/rake-0.8.4.rdoc +0 -147
- data/doc/release_notes/rake-0.8.5.rdoc +0 -53
- data/doc/release_notes/rake-0.8.6.rdoc +0 -55
- data/doc/release_notes/rake-0.8.7.rdoc +0 -55
- data/doc/release_notes/rake-0.9.0.rdoc +0 -112
- data/doc/release_notes/rake-0.9.1.rdoc +0 -52
- data/doc/release_notes/rake-0.9.2.rdoc +0 -49
- data/install.rb +0 -90
- data/lib/rake/alt_system.rb +0 -109
- data/lib/rake/classic_namespace.rb +0 -11
- data/lib/rake/contrib/compositepublisher.rb +0 -21
- data/lib/rake/contrib/ftptools.rb +0 -150
- data/lib/rake/contrib/publisher.rb +0 -73
- data/lib/rake/contrib/rubyforgepublisher.rb +0 -16
- data/lib/rake/contrib/sshpublisher.rb +0 -50
- data/lib/rake/contrib/sys.rb +0 -191
- data/lib/rake/ext/module.rb +0 -39
- data/lib/rake/ext/time.rb +0 -14
- data/lib/rake/gempackagetask.rb +0 -15
- data/lib/rake/pathmap.rb +0 -1
- data/lib/rake/rdoctask.rb +0 -234
- data/lib/rake/ruby182_test_unit_fix.rb +0 -25
- data/lib/rake/runtest.rb +0 -21
- data/test/file_creation.rb +0 -34
- data/test/helper.rb +0 -492
- data/test/test_rake.rb +0 -40
- data/test/test_rake_application.rb +0 -489
- data/test/test_rake_application_options.rb +0 -335
- data/test/test_rake_clean.rb +0 -14
- data/test/test_rake_definitions.rb +0 -80
- data/test/test_rake_directory_task.rb +0 -46
- data/test/test_rake_dsl.rb +0 -77
- data/test/test_rake_early_time.rb +0 -31
- data/test/test_rake_extension.rb +0 -59
- data/test/test_rake_file_creation_task.rb +0 -56
- data/test/test_rake_file_list.rb +0 -628
- data/test/test_rake_file_list_path_map.rb +0 -8
- data/test/test_rake_file_task.rb +0 -102
- data/test/test_rake_file_utils.rb +0 -305
- data/test/test_rake_ftp_file.rb +0 -59
- data/test/test_rake_functional.rb +0 -450
- data/test/test_rake_invocation_chain.rb +0 -52
- data/test/test_rake_makefile_loader.rb +0 -44
- data/test/test_rake_multi_task.rb +0 -51
- data/test/test_rake_name_space.rb +0 -43
- data/test/test_rake_package_task.rb +0 -79
- data/test/test_rake_path_map.rb +0 -157
- data/test/test_rake_path_map_explode.rb +0 -34
- data/test/test_rake_path_map_partial.rb +0 -18
- data/test/test_rake_pseudo_status.rb +0 -21
- data/test/test_rake_rake_test_loader.rb +0 -21
- data/test/test_rake_rdoc_task.rb +0 -83
- data/test/test_rake_require.rb +0 -40
- data/test/test_rake_rules.rb +0 -327
- data/test/test_rake_task.rb +0 -267
- data/test/test_rake_task_argument_parsing.rb +0 -103
- data/test/test_rake_task_arguments.rb +0 -88
- data/test/test_rake_task_lib.rb +0 -9
- data/test/test_rake_task_manager.rb +0 -157
- data/test/test_rake_task_manager_argument_resolution.rb +0 -36
- data/test/test_rake_task_with_arguments.rb +0 -173
- data/test/test_rake_test_task.rb +0 -120
- data/test/test_rake_top_level_functions.rb +0 -111
- data/test/test_rake_win32.rb +0 -72
- data/test/test_sys.rb +0 -20
@@ -1,450 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
require 'fileutils'
|
3
|
-
require 'open3'
|
4
|
-
|
5
|
-
class TestRakeFunctional < Rake::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@rake_path = File.expand_path("bin/rake")
|
9
|
-
lib_path = File.expand_path("lib")
|
10
|
-
@ruby_options = ["-I#{lib_path}", "-I."]
|
11
|
-
@verbose = ENV['VERBOSE']
|
12
|
-
|
13
|
-
if @verbose
|
14
|
-
puts
|
15
|
-
puts
|
16
|
-
puts '-' * 80
|
17
|
-
puts @__name__
|
18
|
-
puts '-' * 80
|
19
|
-
end
|
20
|
-
|
21
|
-
super
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_rake_default
|
25
|
-
rakefile_default
|
26
|
-
|
27
|
-
rake
|
28
|
-
|
29
|
-
assert_match(/^DEFAULT$/, @out)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_rake_error_on_bad_task
|
33
|
-
rakefile_default
|
34
|
-
|
35
|
-
rake '-t', 'xyz'
|
36
|
-
|
37
|
-
assert_match(/rake aborted/, @err)
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_env_available_at_top_scope
|
41
|
-
rakefile_default
|
42
|
-
|
43
|
-
rake "TESTTOPSCOPE=1"
|
44
|
-
|
45
|
-
assert_match(/^TOPSCOPE$/, @out)
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_env_available_at_task_scope
|
49
|
-
rakefile_default
|
50
|
-
|
51
|
-
rake 'TESTTASKSCOPE=1', 'task_scope'
|
52
|
-
|
53
|
-
assert_match(/^TASKSCOPE$/, @out)
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_multi_desc
|
57
|
-
ENV['RAKE_COLUMNS'] = '80'
|
58
|
-
rakefile_multidesc
|
59
|
-
|
60
|
-
rake "-T"
|
61
|
-
|
62
|
-
assert_match %r{^rake a *# A / A2 *$}, @out
|
63
|
-
assert_match %r{^rake b *# B *$}, @out
|
64
|
-
refute_match %r{^rake c}, @out
|
65
|
-
assert_match %r{^rake d *# x{65}\.\.\.$}, @out
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_long_description
|
69
|
-
rakefile_multidesc
|
70
|
-
|
71
|
-
rake "--describe"
|
72
|
-
|
73
|
-
assert_match %r{^rake a\n *A / A2 *$}m, @out
|
74
|
-
assert_match %r{^rake b\n *B *$}m, @out
|
75
|
-
assert_match %r{^rake d\n *x{80}}m, @out
|
76
|
-
refute_match %r{^rake c\n}m, @out
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_proper_namespace_access
|
80
|
-
rakefile_access
|
81
|
-
|
82
|
-
rake
|
83
|
-
|
84
|
-
refute_match %r{^BAD:}, @out
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_rbext
|
88
|
-
rakefile_rbext
|
89
|
-
|
90
|
-
rake "-N"
|
91
|
-
|
92
|
-
assert_match %r{^OK$}, @out
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_system
|
96
|
-
rake_system_dir
|
97
|
-
|
98
|
-
rake '-g', "sys1"
|
99
|
-
|
100
|
-
assert_match %r{^SYS1}, @out
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_system_excludes_rakelib_files_too
|
104
|
-
rake_system_dir
|
105
|
-
|
106
|
-
rake '-g', "sys1", '-T', 'extra'
|
107
|
-
|
108
|
-
refute_match %r{extra:extra}, @out
|
109
|
-
end
|
110
|
-
|
111
|
-
def test_by_default_rakelib_files_are_included
|
112
|
-
rake_system_dir
|
113
|
-
rakefile_extra
|
114
|
-
|
115
|
-
rake '-T', 'extra', '--trace'
|
116
|
-
|
117
|
-
assert_match %r{extra:extra}, @out
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_implicit_system
|
121
|
-
rake_system_dir
|
122
|
-
Dir.chdir @tempdir
|
123
|
-
|
124
|
-
rake "sys1", "--trace"
|
125
|
-
|
126
|
-
assert_match %r{^SYS1}, @out
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_no_system
|
130
|
-
rake_system_dir
|
131
|
-
rakefile_extra
|
132
|
-
|
133
|
-
rake '-G', "sys1"
|
134
|
-
|
135
|
-
assert_match %r{^Don't know how to build task}, @err # emacs wart: '
|
136
|
-
end
|
137
|
-
|
138
|
-
def test_nosearch_with_rakefile_uses_local_rakefile
|
139
|
-
rakefile_default
|
140
|
-
|
141
|
-
rake "--nosearch"
|
142
|
-
|
143
|
-
assert_match %r{^DEFAULT}, @out
|
144
|
-
end
|
145
|
-
|
146
|
-
def test_nosearch_without_rakefile_finds_system
|
147
|
-
rakefile_nosearch
|
148
|
-
rake_system_dir
|
149
|
-
|
150
|
-
rake "--nosearch", "sys1"
|
151
|
-
|
152
|
-
assert_match %r{^SYS1}, @out
|
153
|
-
end
|
154
|
-
|
155
|
-
def test_nosearch_without_rakefile_and_no_system_fails
|
156
|
-
rakefile_nosearch
|
157
|
-
ENV['RAKE_SYSTEM'] = 'not_exist'
|
158
|
-
|
159
|
-
rake "--nosearch"
|
160
|
-
|
161
|
-
assert_match %r{^No Rakefile found}, @err
|
162
|
-
end
|
163
|
-
|
164
|
-
def test_invalid_command_line_options
|
165
|
-
rakefile_default
|
166
|
-
|
167
|
-
rake "--bad-options"
|
168
|
-
|
169
|
-
assert_match %r{invalid +option}i, @err
|
170
|
-
end
|
171
|
-
|
172
|
-
def test_inline_verbose_default_should_show_command
|
173
|
-
rakefile_verbose
|
174
|
-
|
175
|
-
rake "inline_verbose_default"
|
176
|
-
|
177
|
-
assert_match(/#{Regexp.quote(RUBY)} -e/, @err)
|
178
|
-
end
|
179
|
-
|
180
|
-
def test_inline_verbose_true_should_show_command
|
181
|
-
rakefile_verbose
|
182
|
-
|
183
|
-
rake "inline_verbose_true"
|
184
|
-
|
185
|
-
assert_match(/#{Regexp.quote(RUBY)} -e/, @err)
|
186
|
-
end
|
187
|
-
|
188
|
-
def test_inline_verbose_false_should_not_show_command
|
189
|
-
rakefile_verbose
|
190
|
-
|
191
|
-
rake "inline_verbose_false"
|
192
|
-
|
193
|
-
refute_match(/#{Regexp.quote(RUBY)} -e/, @err)
|
194
|
-
end
|
195
|
-
|
196
|
-
def test_block_verbose_false_should_not_show_command
|
197
|
-
rakefile_verbose
|
198
|
-
|
199
|
-
rake "block_verbose_false"
|
200
|
-
|
201
|
-
refute_match(/#{Regexp.quote(RUBY)} -e/, @err)
|
202
|
-
end
|
203
|
-
|
204
|
-
def test_block_verbose_true_should_show_command
|
205
|
-
rakefile_verbose
|
206
|
-
|
207
|
-
rake "block_verbose_true"
|
208
|
-
|
209
|
-
assert_match(/#{Regexp.quote(RUBY)} -e/, @err)
|
210
|
-
end
|
211
|
-
|
212
|
-
def test_standalone_verbose_true_should_show_command
|
213
|
-
rakefile_verbose
|
214
|
-
|
215
|
-
rake "standalone_verbose_true"
|
216
|
-
|
217
|
-
assert_match(/#{Regexp.quote(RUBY)} -e/, @err)
|
218
|
-
end
|
219
|
-
|
220
|
-
def test_standalone_verbose_false_should_not_show_command
|
221
|
-
rakefile_verbose
|
222
|
-
|
223
|
-
rake "standalone_verbose_false"
|
224
|
-
|
225
|
-
refute_match(/#{Regexp.quote(RUBY)} -e/, @err)
|
226
|
-
end
|
227
|
-
|
228
|
-
def test_dry_run
|
229
|
-
rakefile_default
|
230
|
-
|
231
|
-
rake "-n", "other"
|
232
|
-
|
233
|
-
assert_match %r{Execute \(dry run\) default}, @err
|
234
|
-
assert_match %r{Execute \(dry run\) other}, @err
|
235
|
-
refute_match %r{DEFAULT}, @out
|
236
|
-
refute_match %r{OTHER}, @out
|
237
|
-
end
|
238
|
-
|
239
|
-
# Test for the trace/dry_run bug found by Brian Chandler
|
240
|
-
def test_dry_run_bug
|
241
|
-
rakefile_dryrun
|
242
|
-
|
243
|
-
rake
|
244
|
-
|
245
|
-
FileUtils.rm_f 'temp_one'
|
246
|
-
|
247
|
-
rake "--dry-run"
|
248
|
-
|
249
|
-
refute_match(/No such file/, @out)
|
250
|
-
end
|
251
|
-
|
252
|
-
# Test for the trace/dry_run bug found by Brian Chandler
|
253
|
-
def test_trace_bug
|
254
|
-
rakefile_dryrun
|
255
|
-
|
256
|
-
rake
|
257
|
-
|
258
|
-
FileUtils.rm_f 'temp_one'
|
259
|
-
|
260
|
-
rake "--trace"
|
261
|
-
|
262
|
-
refute_match(/No such file/, @out)
|
263
|
-
end
|
264
|
-
|
265
|
-
def test_imports
|
266
|
-
rakefile_imports
|
267
|
-
|
268
|
-
rake
|
269
|
-
|
270
|
-
assert File.exist?(File.join(@tempdir, 'dynamic_deps')),
|
271
|
-
"'dynamic_deps' file should exist"
|
272
|
-
assert_match(/^FIRST$\s+^DYNAMIC$\s+^STATIC$\s+^OTHER$/, @out)
|
273
|
-
end
|
274
|
-
|
275
|
-
def test_rules_chaining_to_file_task
|
276
|
-
rakefile_chains
|
277
|
-
|
278
|
-
rake
|
279
|
-
|
280
|
-
assert File.exist?(File.join(@tempdir, 'play.app')),
|
281
|
-
"'play.app' file should exist"
|
282
|
-
end
|
283
|
-
|
284
|
-
def test_file_creation_task
|
285
|
-
rakefile_file_creation
|
286
|
-
|
287
|
-
rake "prep"
|
288
|
-
rake "run"
|
289
|
-
rake "run"
|
290
|
-
|
291
|
-
assert(@err !~ /^cp src/, "Should not recopy data")
|
292
|
-
end
|
293
|
-
|
294
|
-
def test_dash_f_with_no_arg_foils_rakefile_lookup
|
295
|
-
rakefile_rakelib
|
296
|
-
|
297
|
-
rake '-I', 'rakelib', '-rtest1', '-f'
|
298
|
-
|
299
|
-
assert_match(/^TEST1$/, @out)
|
300
|
-
end
|
301
|
-
|
302
|
-
def test_dot_rake_files_can_be_loaded_with_dash_r
|
303
|
-
rakefile_rakelib
|
304
|
-
|
305
|
-
rake '-I', 'rakelib', '-rtest2', '-f'
|
306
|
-
|
307
|
-
assert_empty @err
|
308
|
-
assert_match(/^TEST2$/, @out)
|
309
|
-
end
|
310
|
-
|
311
|
-
def test_can_invoke_task_in_toplevel_namespace
|
312
|
-
rakefile_namespace
|
313
|
-
|
314
|
-
rake "copy"
|
315
|
-
|
316
|
-
assert_match(/^COPY$/, @out)
|
317
|
-
end
|
318
|
-
|
319
|
-
def test_can_invoke_task_in_nested_namespace
|
320
|
-
rakefile_namespace
|
321
|
-
|
322
|
-
rake "nest:copy"
|
323
|
-
|
324
|
-
assert_match(/^NEST COPY$/, @out)
|
325
|
-
end
|
326
|
-
|
327
|
-
def test_tasks_can_reference_task_in_same_namespace
|
328
|
-
rakefile_namespace
|
329
|
-
|
330
|
-
rake "nest:xx"
|
331
|
-
|
332
|
-
assert_match(/^NEST COPY$/m, @out)
|
333
|
-
end
|
334
|
-
|
335
|
-
def test_tasks_can_reference_task_in_other_namespaces
|
336
|
-
rakefile_namespace
|
337
|
-
|
338
|
-
rake "b:run"
|
339
|
-
|
340
|
-
assert_match(/^IN A\nIN B$/m, @out)
|
341
|
-
end
|
342
|
-
|
343
|
-
def test_anonymous_tasks_can_be_invoked_indirectly
|
344
|
-
rakefile_namespace
|
345
|
-
|
346
|
-
rake "anon"
|
347
|
-
|
348
|
-
assert_match(/^ANON COPY$/m, @out)
|
349
|
-
end
|
350
|
-
|
351
|
-
def test_rake_namespace_refers_to_toplevel
|
352
|
-
rakefile_namespace
|
353
|
-
|
354
|
-
rake "very:nested:run"
|
355
|
-
|
356
|
-
assert_match(/^COPY$/m, @out)
|
357
|
-
end
|
358
|
-
|
359
|
-
def test_file_task_are_not_scoped_by_namespaces
|
360
|
-
rakefile_namespace
|
361
|
-
|
362
|
-
rake "xyz.rb"
|
363
|
-
|
364
|
-
assert_match(/^XYZ1\nXYZ2$/m, @out)
|
365
|
-
end
|
366
|
-
|
367
|
-
def test_file_task_dependencies_scoped_by_namespaces
|
368
|
-
rakefile_namespace
|
369
|
-
|
370
|
-
rake "scopedep.rb"
|
371
|
-
|
372
|
-
assert_match(/^PREPARE\nSCOPEDEP$/m, @out)
|
373
|
-
end
|
374
|
-
|
375
|
-
def test_comment_before_task_acts_like_desc
|
376
|
-
rakefile_comments
|
377
|
-
|
378
|
-
rake "-T"
|
379
|
-
|
380
|
-
refute_match(/comment for t1/, @out)
|
381
|
-
end
|
382
|
-
|
383
|
-
def test_comment_separated_from_task_by_blank_line_is_not_picked_up
|
384
|
-
rakefile_comments
|
385
|
-
|
386
|
-
rake "-T"
|
387
|
-
|
388
|
-
refute_match("t2", @out)
|
389
|
-
end
|
390
|
-
|
391
|
-
def test_comment_after_desc_is_ignored
|
392
|
-
rakefile_comments
|
393
|
-
|
394
|
-
rake "-T"
|
395
|
-
|
396
|
-
assert_match("override comment for t3", @out)
|
397
|
-
end
|
398
|
-
|
399
|
-
def test_comment_before_desc_is_ignored
|
400
|
-
rakefile_comments
|
401
|
-
|
402
|
-
rake "-T"
|
403
|
-
|
404
|
-
assert_match("override comment for t4", @out)
|
405
|
-
end
|
406
|
-
|
407
|
-
def test_correct_number_of_tasks_reported
|
408
|
-
rakefile_comments
|
409
|
-
|
410
|
-
rake "-T"
|
411
|
-
|
412
|
-
assert_equal(2, @out.split(/\n/).grep(/t\d/).size)
|
413
|
-
end
|
414
|
-
|
415
|
-
def test_file_list_is_requirable_separately
|
416
|
-
ruby '-rrake/file_list', '-e', 'puts Rake::FileList["a"].size'
|
417
|
-
assert_equal "1\n", @out
|
418
|
-
end
|
419
|
-
|
420
|
-
private
|
421
|
-
|
422
|
-
# Run a shell Ruby command with command line options (using the
|
423
|
-
# default test options). Output is captured in @out and @err
|
424
|
-
def ruby(*option_list)
|
425
|
-
run_ruby(@ruby_options + option_list)
|
426
|
-
end
|
427
|
-
|
428
|
-
# Run a command line rake with the give rake options. Default
|
429
|
-
# command line ruby options are included. Output is captured in
|
430
|
-
# @out and @err
|
431
|
-
def rake(*rake_options)
|
432
|
-
run_ruby @ruby_options + [@rake_path] + rake_options
|
433
|
-
end
|
434
|
-
|
435
|
-
# Low level ruby command runner ...
|
436
|
-
def run_ruby(option_list)
|
437
|
-
puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose
|
438
|
-
|
439
|
-
inn, out, err = Open3.popen3(Gem.ruby, *option_list)
|
440
|
-
inn.close
|
441
|
-
|
442
|
-
@out = out.read
|
443
|
-
@err = err.read
|
444
|
-
|
445
|
-
puts "OUTPUT: [#{@out}]" if @verbose
|
446
|
-
puts "ERROR: [#{@err}]" if @verbose
|
447
|
-
puts "PWD: [#{Dir.pwd}]" if @verbose
|
448
|
-
end
|
449
|
-
|
450
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestRakeInvocationChain < Rake::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
super
|
7
|
-
|
8
|
-
@empty = Rake::InvocationChain::EMPTY
|
9
|
-
|
10
|
-
@first_member = "A"
|
11
|
-
@second_member = "B"
|
12
|
-
@one = @empty.append(@first_member)
|
13
|
-
@two = @one.append(@second_member)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_append
|
17
|
-
chain = @empty.append("A")
|
18
|
-
|
19
|
-
assert_equal 'TOP => A', chain.to_s # HACK
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_append_one_circular
|
23
|
-
ex = assert_raises RuntimeError do
|
24
|
-
@one.append(@first_member)
|
25
|
-
end
|
26
|
-
assert_match(/circular +dependency/i, ex.message)
|
27
|
-
assert_match(/A.*=>.*A/, ex.message)
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_append_two_circular
|
31
|
-
ex = assert_raises RuntimeError do
|
32
|
-
@two.append(@first_member)
|
33
|
-
end
|
34
|
-
assert_match(/A.*=>.*B.*=>.*A/, ex.message)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_member_eh_one
|
38
|
-
assert @one.member?(@first_member)
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_member_eh_two
|
42
|
-
assert @two.member?(@first_member)
|
43
|
-
assert @two.member?(@second_member)
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_to_s_empty
|
47
|
-
assert_equal "TOP", @empty.to_s
|
48
|
-
assert_equal "TOP => A", @one.to_s
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
require 'rake/loaders/makefile'
|
3
|
-
|
4
|
-
class TestRakeMakefileLoader < Rake::TestCase
|
5
|
-
include Rake
|
6
|
-
|
7
|
-
def test_parse
|
8
|
-
Dir.chdir @tempdir
|
9
|
-
|
10
|
-
open 'sample.mf', 'w' do |io|
|
11
|
-
io << <<-'SAMPLE_MF'
|
12
|
-
# Comments
|
13
|
-
a: a1 a2 a3 a4
|
14
|
-
b: b1 b2 b3 \
|
15
|
-
b4 b5 b6\
|
16
|
-
# Mid: Comment
|
17
|
-
b7
|
18
|
-
|
19
|
-
a : a5 a6 a7
|
20
|
-
c: c1
|
21
|
-
d: d1 d2 \
|
22
|
-
|
23
|
-
e f : e1 f1
|
24
|
-
|
25
|
-
g\ 0: g1 g\ 2 g\ 3 g4
|
26
|
-
SAMPLE_MF
|
27
|
-
end
|
28
|
-
|
29
|
-
Task.clear
|
30
|
-
loader = Rake::MakefileLoader.new
|
31
|
-
loader.load 'sample.mf'
|
32
|
-
%w(a b c d).each do |t|
|
33
|
-
assert Task.task_defined?(t), "#{t} should be a defined task"
|
34
|
-
end
|
35
|
-
assert_equal %w(a1 a2 a3 a4 a5 a6 a7).sort, Task['a'].prerequisites.sort
|
36
|
-
assert_equal %w(b1 b2 b3 b4 b5 b6 b7).sort, Task['b'].prerequisites.sort
|
37
|
-
assert_equal %w(c1).sort, Task['c'].prerequisites.sort
|
38
|
-
assert_equal %w(d1 d2).sort, Task['d'].prerequisites.sort
|
39
|
-
assert_equal %w(e1 f1).sort, Task['e'].prerequisites.sort
|
40
|
-
assert_equal %w(e1 f1).sort, Task['f'].prerequisites.sort
|
41
|
-
assert_equal ["g1", "g 2", "g 3", "g4"].sort, Task['g 0'].prerequisites.sort
|
42
|
-
assert_equal 7, Task.tasks.size
|
43
|
-
end
|
44
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
require 'thread'
|
3
|
-
|
4
|
-
class TestRakeMultiTask < Rake::TestCase
|
5
|
-
include Rake
|
6
|
-
include Rake::DSL
|
7
|
-
|
8
|
-
def setup
|
9
|
-
super
|
10
|
-
|
11
|
-
Task.clear
|
12
|
-
@runs = Array.new
|
13
|
-
@mutex = Mutex.new
|
14
|
-
end
|
15
|
-
|
16
|
-
def add_run(obj)
|
17
|
-
@mutex.synchronize do
|
18
|
-
@runs << obj
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_running_multitasks
|
23
|
-
task :a do 3.times do |i| add_run("A#{i}"); sleep 0.01; end end
|
24
|
-
task :b do 3.times do |i| add_run("B#{i}"); sleep 0.01; end end
|
25
|
-
multitask :both => [:a, :b]
|
26
|
-
Task[:both].invoke
|
27
|
-
assert_equal 6, @runs.size
|
28
|
-
assert @runs.index("A0") < @runs.index("A1")
|
29
|
-
assert @runs.index("A1") < @runs.index("A2")
|
30
|
-
assert @runs.index("B0") < @runs.index("B1")
|
31
|
-
assert @runs.index("B1") < @runs.index("B2")
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_all_multitasks_wait_on_slow_prerequisites
|
35
|
-
task :slow do 3.times do |i| add_run("S#{i}"); sleep 0.05 end end
|
36
|
-
task :a => [:slow] do 3.times do |i| add_run("A#{i}"); sleep 0.01 end end
|
37
|
-
task :b => [:slow] do 3.times do |i| add_run("B#{i}"); sleep 0.01 end end
|
38
|
-
multitask :both => [:a, :b]
|
39
|
-
Task[:both].invoke
|
40
|
-
assert_equal 9, @runs.size
|
41
|
-
assert @runs.index("S0") < @runs.index("S1")
|
42
|
-
assert @runs.index("S1") < @runs.index("S2")
|
43
|
-
assert @runs.index("S2") < @runs.index("A0")
|
44
|
-
assert @runs.index("S2") < @runs.index("B0")
|
45
|
-
assert @runs.index("A0") < @runs.index("A1")
|
46
|
-
assert @runs.index("A1") < @runs.index("A2")
|
47
|
-
assert @runs.index("B0") < @runs.index("B1")
|
48
|
-
assert @runs.index("B1") < @runs.index("B2")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestRakeNameSpace < Rake::TestCase
|
4
|
-
|
5
|
-
class TM
|
6
|
-
include Rake::TaskManager
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_namespace_creation
|
10
|
-
mgr = TM.new
|
11
|
-
ns = Rake::NameSpace.new(mgr, [])
|
12
|
-
refute_nil ns
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_namespace_lookup
|
16
|
-
mgr = TM.new
|
17
|
-
ns = mgr.in_namespace("n") do
|
18
|
-
mgr.define_task(Rake::Task, "t")
|
19
|
-
end
|
20
|
-
|
21
|
-
refute_nil ns["t"]
|
22
|
-
assert_equal mgr["n:t"], ns["t"]
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_namespace_reports_tasks_it_owns
|
26
|
-
mgr = TM.new
|
27
|
-
nns = nil
|
28
|
-
ns = mgr.in_namespace("n") do
|
29
|
-
mgr.define_task(Rake::Task, :x)
|
30
|
-
mgr.define_task(Rake::Task, :y)
|
31
|
-
nns = mgr.in_namespace("nn") do
|
32
|
-
mgr.define_task(Rake::Task, :z)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
mgr.in_namespace("m") do
|
36
|
-
mgr.define_task(Rake::Task, :x)
|
37
|
-
end
|
38
|
-
|
39
|
-
assert_equal ["n:nn:z", "n:x", "n:y"],
|
40
|
-
ns.tasks.map { |tsk| tsk.name }
|
41
|
-
assert_equal ["n:nn:z"], nns.tasks.map {|t| t.name}
|
42
|
-
end
|
43
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
require 'rake/packagetask'
|
3
|
-
|
4
|
-
class TestRakePackageTask < Rake::TestCase
|
5
|
-
|
6
|
-
def test_initialize
|
7
|
-
touch 'install.rb'
|
8
|
-
touch 'a.c'
|
9
|
-
touch 'b.c'
|
10
|
-
mkdir 'CVS'
|
11
|
-
touch 'a.rb~'
|
12
|
-
|
13
|
-
pkg = Rake::PackageTask.new("pkgr", "1.2.3") { |p|
|
14
|
-
p.package_files << "install.rb"
|
15
|
-
p.package_files.include '*.c'
|
16
|
-
p.package_files.exclude(/\bCVS\b/)
|
17
|
-
p.package_files.exclude(/~$/)
|
18
|
-
p.package_dir = 'pkg'
|
19
|
-
p.need_tar = true
|
20
|
-
p.need_tar_gz = true
|
21
|
-
p.need_tar_bz2 = true
|
22
|
-
p.need_zip = true
|
23
|
-
}
|
24
|
-
|
25
|
-
assert_equal "pkg", pkg.package_dir
|
26
|
-
|
27
|
-
assert_includes pkg.package_files, 'a.c'
|
28
|
-
|
29
|
-
assert_equal 'pkgr', pkg.name
|
30
|
-
assert_equal '1.2.3', pkg.version
|
31
|
-
assert Rake::Task[:package]
|
32
|
-
assert Rake::Task['pkg/pkgr-1.2.3.tgz']
|
33
|
-
assert Rake::Task['pkg/pkgr-1.2.3.tar.gz']
|
34
|
-
assert Rake::Task['pkg/pkgr-1.2.3.tar.bz2']
|
35
|
-
assert Rake::Task['pkg/pkgr-1.2.3.zip']
|
36
|
-
assert Rake::Task['pkg/pkgr-1.2.3']
|
37
|
-
assert Rake::Task[:clobber_package]
|
38
|
-
assert Rake::Task[:repackage]
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_initialize_no_version
|
42
|
-
e = assert_raises RuntimeError do
|
43
|
-
Rake::PackageTask.new 'pkgr'
|
44
|
-
end
|
45
|
-
|
46
|
-
assert_equal 'Version required (or :noversion)', e.message
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_initialize_noversion
|
50
|
-
pkg = Rake::PackageTask.new 'pkgr', :noversion
|
51
|
-
|
52
|
-
assert_equal 'pkg', pkg.package_dir
|
53
|
-
assert_equal 'pkgr', pkg.name
|
54
|
-
assert_equal nil, pkg.version
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_clone
|
58
|
-
pkg = Rake::PackageTask.new("x", :noversion)
|
59
|
-
p2 = pkg.clone
|
60
|
-
pkg.package_files << "y"
|
61
|
-
p2.package_files << "x"
|
62
|
-
assert_equal ["y"], pkg.package_files
|
63
|
-
assert_equal ["x"], p2.package_files
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_package_name
|
67
|
-
pkg = Rake::PackageTask.new 'a', '1'
|
68
|
-
|
69
|
-
assert_equal 'a-1', pkg.package_name
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_package_name_noversion
|
73
|
-
pkg = Rake::PackageTask.new 'a', :noversion
|
74
|
-
|
75
|
-
assert_equal 'a', pkg.package_name
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
|