rake 0.9.2 → 13.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTING.rdoc +43 -0
- data/Gemfile +10 -0
- data/History.rdoc +2386 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +64 -109
- data/Rakefile +22 -386
- data/bin/bundle +105 -0
- data/bin/console +7 -0
- data/bin/rake +20 -23
- data/bin/rdoc +29 -0
- data/bin/rubocop +29 -0
- data/bin/setup +6 -0
- 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/exe/rake +27 -0
- data/lib/rake.rb +37 -31
- data/lib/rake/application.rb +507 -272
- data/lib/rake/backtrace.rb +24 -0
- data/lib/rake/clean.rb +55 -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 +74 -46
- 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 +69 -47
- data/lib/rake/file_utils_ext.rb +18 -26
- 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 +21 -7
- 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 +50 -15
- data/lib/rake/task_manager.rb +89 -65
- 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 +7 -7
- data/lib/rake/win32.rb +14 -18
- data/rake.gemspec +43 -0
- metadata +82 -221
- data/.gemtest +0 -0
- data/CHANGES +0 -509
- data/RRR +0 -9
- 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 -9
- data/lib/rake/contrib/compositepublisher.rb +0 -21
- data/lib/rake/contrib/ftptools.rb +0 -150
- data/lib/rake/contrib/publisher.rb +0 -69
- data/lib/rake/contrib/rubyforgepublisher.rb +0 -16
- data/lib/rake/contrib/sshpublisher.rb +0 -45
- 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 -13
- data/lib/rake/pathmap.rb +0 -1
- data/lib/rake/rdoctask.rb +0 -230
- data/lib/rake/ruby182_test_unit_fix.rb +0 -25
- data/lib/rake/runtest.rb +0 -21
- data/test/check_expansion.rb +0 -5
- data/test/check_no_expansion.rb +0 -5
- data/test/data/access/Rakefile +0 -35
- data/test/data/chains/Rakefile +0 -15
- data/test/data/comments/Rakefile +0 -18
- data/test/data/default/Rakefile +0 -17
- data/test/data/deprecated_import/Rakefile +0 -1
- data/test/data/dryrun/Rakefile +0 -22
- data/test/data/extra/Rakefile +0 -1
- data/test/data/file_creation_task/Rakefile +0 -31
- data/test/data/imports/Rakefile +0 -19
- data/test/data/imports/deps.mf +0 -1
- data/test/data/multidesc/Rakefile +0 -15
- data/test/data/namespace/Rakefile +0 -64
- data/test/data/rakelib/test1.rb +0 -4
- data/test/data/rbext/rakefile.rb +0 -3
- data/test/data/sample.mf +0 -14
- data/test/data/statusreturn/Rakefile +0 -6
- data/test/data/unittest/Rakefile +0 -1
- data/test/data/verbose/Rakefile +0 -34
- data/test/file_creation.rb +0 -34
- data/test/helper.rb +0 -44
- data/test/in_environment.rb +0 -35
- data/test/reqfile.rb +0 -3
- data/test/reqfile2.rb +0 -3
- data/test/shellcommand.rb +0 -3
- data/test/test_rake.rb +0 -38
- data/test/test_rake_application.rb +0 -364
- data/test/test_rake_application_options.rb +0 -382
- data/test/test_rake_clean.rb +0 -12
- data/test/test_rake_definitions.rb +0 -80
- data/test/test_rake_directory_task.rb +0 -55
- data/test/test_rake_dsl.rb +0 -73
- 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 -62
- data/test/test_rake_file_list.rb +0 -633
- data/test/test_rake_file_list_path_map.rb +0 -8
- data/test/test_rake_file_task.rb +0 -104
- data/test/test_rake_file_utils.rb +0 -252
- data/test/test_rake_ftp_file.rb +0 -59
- data/test/test_rake_functional.rb +0 -468
- data/test/test_rake_invocation_chain.rb +0 -52
- data/test/test_rake_makefile_loader.rb +0 -23
- 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 -78
- data/test/test_rake_path_map.rb +0 -157
- data/test/test_rake_path_map_explode.rb +0 -31
- data/test/test_rake_path_map_partial.rb +0 -18
- data/test/test_rake_pseudo_status.rb +0 -20
- data/test/test_rake_rdoc_task.rb +0 -81
- data/test/test_rake_require.rb +0 -35
- data/test/test_rake_rules.rb +0 -346
- data/test/test_rake_task.rb +0 -271
- data/test/test_rake_task_argument_parsing.rb +0 -116
- data/test/test_rake_task_arguments.rb +0 -86
- data/test/test_rake_task_lib.rb +0 -9
- data/test/test_rake_task_manager.rb +0 -145
- data/test/test_rake_task_manager_argument_resolution.rb +0 -36
- data/test/test_rake_task_with_arguments.rb +0 -162
- data/test/test_rake_test_task.rb +0 -122
- data/test/test_rake_top_level_functions.rb +0 -76
- data/test/test_rake_win32.rb +0 -83
- 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
|
-
|
data/test/test_rake_clean.rb
DELETED
@@ -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
|
-
|