rake 10.1.0.beta.3 → 10.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rake might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/doc/command_line_usage.rdoc +1 -1
- data/doc/rakefile.rdoc +9 -14
- data/doc/release_notes/rake-10.1.0.rdoc +61 -0
- data/install.rb +5 -15
- data/lib/rake/application.rb +1 -1
- data/lib/rake/clean.rb +27 -4
- data/lib/rake/gempackagetask.rb +1 -1
- data/lib/rake/version.rb +1 -1
- data/test/helper.rb +7 -441
- data/test/support/rakefile_definitions.rb +444 -0
- data/test/support/ruby_runner.rb +33 -0
- data/test/test_rake_backtrace.rb +8 -13
- data/test/test_rake_clean.rb +36 -4
- data/test/test_rake_functional.rb +1 -33
- data/test/test_rake_reduce_compat.rb +2 -6
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9ac6688e8d46823918ca8cd748b966dee93b7ff
|
4
|
+
data.tar.gz: 5f05d5240b1dd8fcebea6018e9568b9f36d5e5f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6617192f68ee233d4cabf2f58fdef451ff54fbeb35b06fc9bea87fb19c59f95a78e41e9d08afa0b8e0301e62dd2587ed6712ba8c74bb544ca164d1d2f656b54
|
7
|
+
data.tar.gz: 37536f5ea5bd04eca463ad8c78d524249960c4a5a612cfa840ea20487a4f9971c5703e5be2c7249eb558dacf4421a252ec0aea9d7dac0dde217eb842cab3c85e
|
data/doc/command_line_usage.rdoc
CHANGED
@@ -144,7 +144,7 @@ Options are:
|
|
144
144
|
number where the task is defined. By default this option will
|
145
145
|
display all tasks, not just the tasks that have descriptions.
|
146
146
|
|
147
|
-
[<tt>--no-deprecation-warnings</tt> (-
|
147
|
+
[<tt>--no-deprecation-warnings</tt> (-X)]
|
148
148
|
Do not display the deprecation warnings.
|
149
149
|
|
150
150
|
In addition, any command line option of the form
|
data/doc/rakefile.rdoc
CHANGED
@@ -280,7 +280,7 @@ parameters as well:
|
|
280
280
|
end
|
281
281
|
|
282
282
|
There is also the convenience method to_a that returns all parameters
|
283
|
-
in the sequential order they were given, including those associated
|
283
|
+
in the sequential order they were given, including those associated
|
284
284
|
with named parameters.
|
285
285
|
|
286
286
|
=== Deprecated Task Parameters Format
|
@@ -386,21 +386,16 @@ required file are just added to the definitions already accumulated.
|
|
386
386
|
|
387
387
|
Because the files are loaded _before_ the rake targets are evaluated,
|
388
388
|
the loaded files must be "ready to go" when the rake command is
|
389
|
-
invoked.
|
389
|
+
invoked. This makes generated dependency files difficult to use. By
|
390
390
|
the time rake gets around to updating the dependencies file, it is too
|
391
391
|
late to load it.
|
392
392
|
|
393
|
-
The +
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
<b>NOTE:</b> Starting in Rake version 0.9.0, the top level +import+
|
401
|
-
command is deprecated and we recommend using the scoped
|
402
|
-
"+Rake.import+" command mentioned above. Future versions of Rake will
|
403
|
-
drop support for the top level +import+ command.
|
393
|
+
The +import+ command addresses this by specifying a file to be loaded
|
394
|
+
_after_ the main rakefile is loaded, but _before_ any targets on the
|
395
|
+
command line are invoked. In addition, if the file name matches an
|
396
|
+
explicit task, that task is invoked before loading the file. This
|
397
|
+
allows dependency files to be generated and used in a single rake
|
398
|
+
command invocation.
|
404
399
|
|
405
400
|
=== Example:
|
406
401
|
|
@@ -410,7 +405,7 @@ drop support for the top level +import+ command.
|
|
410
405
|
sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}"
|
411
406
|
end
|
412
407
|
|
413
|
-
|
408
|
+
import ".depends.mf"
|
414
409
|
|
415
410
|
If ".depends" does not exist, or is out of date w.r.t. the source
|
416
411
|
files, a new ".depends" file is generated using +makedepend+ before
|
@@ -0,0 +1,61 @@
|
|
1
|
+
= Rake 10.1.0 Released
|
2
|
+
|
3
|
+
== Changes in Version 10.1
|
4
|
+
|
5
|
+
Here are new features in this version of Rake:
|
6
|
+
|
7
|
+
* Add support for variable length task argument lists. If more actual
|
8
|
+
arguments are supplied than named arguments, then the extra
|
9
|
+
arguments values will be in args.extras.
|
10
|
+
|
11
|
+
* Application name is not displayed in the help banner. (Previously
|
12
|
+
"rake" was hardcoded, now rake-based applications can display their
|
13
|
+
own names).
|
14
|
+
|
15
|
+
=== Bug Fixes (in 10.1)
|
16
|
+
|
17
|
+
Bug fixes include:
|
18
|
+
|
19
|
+
* Fix backtrace suppression issues.
|
20
|
+
|
21
|
+
* Rules now explicit get task arguments passed to them.
|
22
|
+
|
23
|
+
* Rename FileList#exclude? to FileList#exclude_from_list? to avoid
|
24
|
+
conflict with new Rails method.
|
25
|
+
|
26
|
+
* Clean / Clobber tasks now report failure to remove files.
|
27
|
+
|
28
|
+
* Plus heaps of internal code cleanup.
|
29
|
+
|
30
|
+
== What is Rake
|
31
|
+
|
32
|
+
Rake is a build tool similar to the make program in many ways. But
|
33
|
+
instead of cryptic make recipes, Rake uses standard Ruby code to
|
34
|
+
declare tasks and dependencies. You have the full power of a modern
|
35
|
+
scripting language built right into your build tool.
|
36
|
+
|
37
|
+
== Availability
|
38
|
+
|
39
|
+
The easiest way to get and install rake is via RubyGems ...
|
40
|
+
|
41
|
+
gem install rake (you may need root/admin privileges)
|
42
|
+
|
43
|
+
Otherwise, you can get it from the more from GitHub:
|
44
|
+
|
45
|
+
GitHub:: git://github.com/jimweirich/rake.git
|
46
|
+
|
47
|
+
== Thanks
|
48
|
+
|
49
|
+
As usual, it was input from users that drove a lot of these changes.
|
50
|
+
The following people contributed patches, made suggestions or made
|
51
|
+
otherwise helpful comments. Thanks to ...
|
52
|
+
|
53
|
+
* Michael Nikitochkin (general code cleanup)
|
54
|
+
* Vipul A M (general code cleanup)
|
55
|
+
* Dennis Bell (variable length task argument lists)
|
56
|
+
* Jacob Swanner (rules arguments)
|
57
|
+
* Rafael Rosa Fu (documentation typo)
|
58
|
+
* Stuart Nelson (install.rb fixes)
|
59
|
+
* Lee Hambley (application name in help banner)
|
60
|
+
|
61
|
+
-- Jim Weirich
|
data/install.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
require 'find'
|
3
3
|
require 'fileutils'
|
4
|
+
require 'tempfile'
|
4
5
|
|
5
6
|
include RbConfig
|
6
7
|
|
@@ -11,22 +12,12 @@ $ruby = CONFIG['ruby_install_name']
|
|
11
12
|
# insert a #! line. If this is a Unix install, we name
|
12
13
|
# the command (for example) 'rake' and let the shebang line
|
13
14
|
# handle running it. Under windows, we add a '.rb' extension
|
14
|
-
# and let file associations
|
15
|
+
# and let file associations do their stuff
|
15
16
|
#
|
16
17
|
|
17
18
|
def installBIN(from, opfile)
|
18
19
|
|
19
|
-
|
20
|
-
for t in [".", "/tmp", "c:/temp", $bindir]
|
21
|
-
stat = File.stat(t) rescue next
|
22
|
-
if stat.directory? and stat.writable?
|
23
|
-
tmp_dir = t
|
24
|
-
break
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
fail "Cannot find a temporary directory" unless tmp_dir
|
29
|
-
tmp_file = File.join(tmp_dir, "_tmp")
|
20
|
+
tmp_file = Tempfile.new("_tmp")
|
30
21
|
|
31
22
|
File.open(from) do |ip|
|
32
23
|
File.open(tmp_file, "w") do |op|
|
@@ -39,7 +30,7 @@ def installBIN(from, opfile)
|
|
39
30
|
opfile += ".rb" if CONFIG["target_os"] =~ /mswin/i
|
40
31
|
FileUtils.install(tmp_file, File.join($bindir, opfile),
|
41
32
|
{:mode => 0755, :verbose => true})
|
42
|
-
|
33
|
+
tmp_file.unlink
|
43
34
|
end
|
44
35
|
|
45
36
|
$sitedir = CONFIG["sitelibdir"]
|
@@ -54,11 +45,10 @@ unless $sitedir
|
|
54
45
|
end
|
55
46
|
end
|
56
47
|
|
57
|
-
$bindir =
|
48
|
+
$bindir = CONFIG["bindir"]
|
58
49
|
|
59
50
|
$realbindir = $bindir
|
60
51
|
|
61
|
-
bindir = CONFIG["bindir"]
|
62
52
|
if (destdir = ENV['DESTDIR'])
|
63
53
|
$bindir = destdir + $bindir
|
64
54
|
$sitedir = destdir + $sitedir
|
data/lib/rake/application.rb
CHANGED
@@ -572,7 +572,7 @@ module Rake
|
|
572
572
|
options.trace_output = $stderr
|
573
573
|
|
574
574
|
OptionParser.new do |opts|
|
575
|
-
opts.banner = "
|
575
|
+
opts.banner = "#{Rake.application.name} [-f rakefile] {options} targets..."
|
576
576
|
opts.separator ""
|
577
577
|
opts.separator "Options are ..."
|
578
578
|
|
data/lib/rake/clean.rb
CHANGED
@@ -14,19 +14,42 @@
|
|
14
14
|
require 'rake'
|
15
15
|
|
16
16
|
# :stopdoc:
|
17
|
-
|
17
|
+
|
18
|
+
module Rake
|
19
|
+
module Cleaner
|
20
|
+
extend FileUtils
|
21
|
+
|
22
|
+
module_function
|
23
|
+
|
24
|
+
def cleanup_files(file_names)
|
25
|
+
file_names.each do |file_name|
|
26
|
+
cleanup(file_name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def cleanup(file_name, opts={})
|
31
|
+
begin
|
32
|
+
rm_r file_name, opts
|
33
|
+
rescue StandardError => ex
|
34
|
+
puts "Failed to remove #{file_name}: #{ex}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
CLEAN = ::Rake::FileList["**/*~", "**/*.bak", "**/core"]
|
18
41
|
CLEAN.clear_exclude.exclude { |fn|
|
19
42
|
fn.pathmap("%f").downcase == 'core' && File.directory?(fn)
|
20
43
|
}
|
21
44
|
|
22
45
|
desc "Remove any temporary products."
|
23
46
|
task :clean do
|
24
|
-
CLEAN
|
47
|
+
Rake::Cleaner.cleanup_files(CLEAN)
|
25
48
|
end
|
26
49
|
|
27
|
-
CLOBBER = Rake::FileList.new
|
50
|
+
CLOBBER = ::Rake::FileList.new
|
28
51
|
|
29
52
|
desc "Remove any generated file."
|
30
53
|
task :clobber => [:clean] do
|
31
|
-
CLOBBER
|
54
|
+
Rake::Cleaner.cleanup_files(CLOBBER)
|
32
55
|
end
|
data/lib/rake/gempackagetask.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
fail "ERROR: 'rake/gempackagetask' is obsolete and no longer supported. " +
|
2
|
-
"Use 'rubygems/
|
2
|
+
"Use 'rubygems/packagetask' instead."
|
data/lib/rake/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -11,6 +11,9 @@ require 'rake'
|
|
11
11
|
require 'tmpdir'
|
12
12
|
require File.expand_path('../file_creation', __FILE__)
|
13
13
|
|
14
|
+
require 'test/support/ruby_runner'
|
15
|
+
require 'test/support/rakefile_definitions'
|
16
|
+
|
14
17
|
begin
|
15
18
|
require_relative '../ruby/envutil'
|
16
19
|
rescue NoMethodError, LoadError
|
@@ -42,8 +45,11 @@ class Rake::TestCase < MiniTest::Unit::TestCase
|
|
42
45
|
File.expand_path '../../../', __FILE__
|
43
46
|
end
|
44
47
|
|
48
|
+
@verbose = ENV['VERBOSE']
|
49
|
+
|
45
50
|
@rake_exec = File.join @rake_root, 'bin', 'rake'
|
46
51
|
@rake_lib = File.join @rake_root, 'lib'
|
52
|
+
@ruby_options = ["-I#{@rake_lib}", "-I."]
|
47
53
|
|
48
54
|
@orig_pwd = Dir.pwd
|
49
55
|
@orig_appdata = ENV['APPDATA']
|
@@ -118,445 +124,5 @@ end
|
|
118
124
|
end
|
119
125
|
end
|
120
126
|
|
121
|
-
|
122
|
-
rakefile <<-ACCESS
|
123
|
-
TOP_LEVEL_CONSTANT = 0
|
124
|
-
|
125
|
-
def a_top_level_function
|
126
|
-
end
|
127
|
-
|
128
|
-
task :default => [:work, :obj, :const]
|
129
|
-
|
130
|
-
task :work do
|
131
|
-
begin
|
132
|
-
a_top_level_function
|
133
|
-
puts "GOOD:M Top level methods can be called in tasks"
|
134
|
-
rescue NameError => ex
|
135
|
-
puts "BAD:M Top level methods can not be called in tasks"
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
# TODO: remove `disabled_' when DeprecatedObjectDSL removed
|
140
|
-
task :obj
|
141
|
-
task :disabled_obj do
|
142
|
-
begin
|
143
|
-
Object.new.instance_eval { task :xyzzy }
|
144
|
-
puts "BAD:D Rake DSL are polluting objects"
|
145
|
-
rescue StandardError => ex
|
146
|
-
puts "GOOD:D Rake DSL are not polluting objects"
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
task :const do
|
151
|
-
begin
|
152
|
-
TOP_LEVEL_CONSTANT
|
153
|
-
puts "GOOD:C Top level constants are available in tasks"
|
154
|
-
rescue StandardError => ex
|
155
|
-
puts "BAD:C Top level constants are NOT available in tasks"
|
156
|
-
end
|
157
|
-
end
|
158
|
-
ACCESS
|
159
|
-
end
|
160
|
-
|
161
|
-
def rakefile_chains
|
162
|
-
rakefile <<-DEFAULT
|
163
|
-
task :default => "play.app"
|
164
|
-
|
165
|
-
file "play.scpt" => "base" do |t|
|
166
|
-
cp t.prerequisites.first, t.name
|
167
|
-
end
|
168
|
-
|
169
|
-
rule ".app" => ".scpt" do |t|
|
170
|
-
cp t.source, t.name
|
171
|
-
end
|
172
|
-
|
173
|
-
file 'base' do
|
174
|
-
touch 'base'
|
175
|
-
end
|
176
|
-
DEFAULT
|
177
|
-
end
|
178
|
-
|
179
|
-
def rakefile_comments
|
180
|
-
rakefile <<-COMMENTS
|
181
|
-
# comment for t1
|
182
|
-
task :t1 do
|
183
|
-
end
|
184
|
-
|
185
|
-
# no comment or task because there's a blank line
|
186
|
-
|
187
|
-
task :t2 do
|
188
|
-
end
|
189
|
-
|
190
|
-
desc "override comment for t3"
|
191
|
-
# this is not the description
|
192
|
-
multitask :t3 do
|
193
|
-
end
|
194
|
-
|
195
|
-
# this is not the description
|
196
|
-
desc "override comment for t4"
|
197
|
-
file :t4 do
|
198
|
-
end
|
199
|
-
COMMENTS
|
200
|
-
end
|
201
|
-
|
202
|
-
def rakefile_default
|
203
|
-
rakefile <<-DEFAULT
|
204
|
-
if ENV['TESTTOPSCOPE']
|
205
|
-
puts "TOPSCOPE"
|
206
|
-
end
|
207
|
-
|
208
|
-
task :default do
|
209
|
-
puts "DEFAULT"
|
210
|
-
end
|
211
|
-
|
212
|
-
task :other => [:default] do
|
213
|
-
puts "OTHER"
|
214
|
-
end
|
215
|
-
|
216
|
-
task :task_scope do
|
217
|
-
if ENV['TESTTASKSCOPE']
|
218
|
-
puts "TASKSCOPE"
|
219
|
-
end
|
220
|
-
end
|
221
|
-
DEFAULT
|
222
|
-
end
|
223
|
-
|
224
|
-
def rakefile_dryrun
|
225
|
-
rakefile <<-DRYRUN
|
226
|
-
task :default => ["temp_main"]
|
227
|
-
|
228
|
-
file "temp_main" => [:all_apps] do touch "temp_main" end
|
229
|
-
|
230
|
-
task :all_apps => [:one, :two]
|
231
|
-
task :one => ["temp_one"]
|
232
|
-
task :two => ["temp_two"]
|
233
|
-
|
234
|
-
file "temp_one" do |t|
|
235
|
-
touch "temp_one"
|
236
|
-
end
|
237
|
-
file "temp_two" do |t|
|
238
|
-
touch "temp_two"
|
239
|
-
end
|
240
|
-
|
241
|
-
task :clean do
|
242
|
-
["temp_one", "temp_two", "temp_main"].each do |file|
|
243
|
-
rm_f file
|
244
|
-
end
|
245
|
-
end
|
246
|
-
DRYRUN
|
247
|
-
|
248
|
-
FileUtils.touch 'temp_main'
|
249
|
-
FileUtils.touch 'temp_two'
|
250
|
-
end
|
251
|
-
|
252
|
-
def rakefile_extra
|
253
|
-
rakefile 'task :default'
|
254
|
-
|
255
|
-
FileUtils.mkdir_p 'rakelib'
|
256
|
-
|
257
|
-
open File.join('rakelib', 'extra.rake'), 'w' do |io|
|
258
|
-
io << <<-EXTRA_RAKE
|
259
|
-
# Added for testing
|
260
|
-
|
261
|
-
namespace :extra do
|
262
|
-
desc "An Extra Task"
|
263
|
-
task :extra do
|
264
|
-
puts "Read all about it"
|
265
|
-
end
|
266
|
-
end
|
267
|
-
EXTRA_RAKE
|
268
|
-
end
|
269
|
-
end
|
270
|
-
|
271
|
-
def rakefile_file_creation
|
272
|
-
rakefile <<-'FILE_CREATION'
|
273
|
-
N = 2
|
274
|
-
|
275
|
-
task :default => :run
|
276
|
-
|
277
|
-
BUILD_DIR = 'build'
|
278
|
-
task :clean do
|
279
|
-
rm_rf 'build'
|
280
|
-
rm_rf 'src'
|
281
|
-
end
|
282
|
-
|
283
|
-
task :run
|
284
|
-
|
285
|
-
TARGET_DIR = 'build/copies'
|
286
|
-
|
287
|
-
FileList['src/*'].each do |src|
|
288
|
-
directory TARGET_DIR
|
289
|
-
target = File.join TARGET_DIR, File.basename(src)
|
290
|
-
file target => [src, TARGET_DIR] do
|
291
|
-
cp src, target
|
292
|
-
end
|
293
|
-
task :run => target
|
294
|
-
end
|
295
|
-
|
296
|
-
task :prep => :clean do
|
297
|
-
mkdir_p 'src'
|
298
|
-
N.times do |n|
|
299
|
-
touch "src/foo#{n}"
|
300
|
-
end
|
301
|
-
end
|
302
|
-
FILE_CREATION
|
303
|
-
end
|
304
|
-
|
305
|
-
def rakefile_imports
|
306
|
-
rakefile <<-IMPORTS
|
307
|
-
require 'rake/loaders/makefile'
|
308
|
-
|
309
|
-
task :default
|
310
|
-
|
311
|
-
task :other do
|
312
|
-
puts "OTHER"
|
313
|
-
end
|
314
|
-
|
315
|
-
file "dynamic_deps" do |t|
|
316
|
-
open(t.name, "w") do |f| f.puts "puts 'DYNAMIC'" end
|
317
|
-
end
|
318
|
-
|
319
|
-
import "dynamic_deps"
|
320
|
-
import "static_deps"
|
321
|
-
import "static_deps"
|
322
|
-
import "deps.mf"
|
323
|
-
puts "FIRST"
|
324
|
-
IMPORTS
|
325
|
-
|
326
|
-
open 'deps.mf', 'w' do |io|
|
327
|
-
io << <<-DEPS
|
328
|
-
default: other
|
329
|
-
DEPS
|
330
|
-
end
|
331
|
-
|
332
|
-
open "static_deps", "w" do |f|
|
333
|
-
f.puts 'puts "STATIC"'
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
def rakefile_multidesc
|
338
|
-
rakefile <<-MULTIDESC
|
339
|
-
task :b
|
340
|
-
|
341
|
-
desc "A"
|
342
|
-
task :a
|
343
|
-
|
344
|
-
desc "B"
|
345
|
-
task :b
|
346
|
-
|
347
|
-
desc "A2"
|
348
|
-
task :a
|
349
|
-
|
350
|
-
task :c
|
351
|
-
|
352
|
-
desc "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
353
|
-
task :d
|
354
|
-
MULTIDESC
|
355
|
-
end
|
356
|
-
|
357
|
-
def rakefile_namespace
|
358
|
-
rakefile <<-NAMESPACE
|
359
|
-
desc "copy"
|
360
|
-
task :copy do
|
361
|
-
puts "COPY"
|
362
|
-
end
|
363
|
-
|
364
|
-
namespace "nest" do
|
365
|
-
desc "nest copy"
|
366
|
-
task :copy do
|
367
|
-
puts "NEST COPY"
|
368
|
-
end
|
369
|
-
task :xx => :copy
|
370
|
-
end
|
371
|
-
|
372
|
-
anon_ns = namespace do
|
373
|
-
desc "anonymous copy task"
|
374
|
-
task :copy do
|
375
|
-
puts "ANON COPY"
|
376
|
-
end
|
377
|
-
end
|
378
|
-
|
379
|
-
desc "Top level task to run the anonymous version of copy"
|
380
|
-
task :anon => anon_ns[:copy]
|
381
|
-
|
382
|
-
namespace "very" do
|
383
|
-
namespace "nested" do
|
384
|
-
task "run" => "rake:copy"
|
385
|
-
end
|
386
|
-
end
|
387
|
-
|
388
|
-
namespace "a" do
|
389
|
-
desc "Run task in the 'a' namespace"
|
390
|
-
task "run" do
|
391
|
-
puts "IN A"
|
392
|
-
end
|
393
|
-
end
|
394
|
-
|
395
|
-
namespace "b" do
|
396
|
-
desc "Run task in the 'b' namespace"
|
397
|
-
task "run" => "a:run" do
|
398
|
-
puts "IN B"
|
399
|
-
end
|
400
|
-
end
|
401
|
-
|
402
|
-
namespace "file1" do
|
403
|
-
file "xyz.rb" do
|
404
|
-
puts "XYZ1"
|
405
|
-
end
|
406
|
-
end
|
407
|
-
|
408
|
-
namespace "file2" do
|
409
|
-
file "xyz.rb" do
|
410
|
-
puts "XYZ2"
|
411
|
-
end
|
412
|
-
end
|
413
|
-
|
414
|
-
namespace "scopedep" do
|
415
|
-
task :prepare do
|
416
|
-
touch "scopedep.rb"
|
417
|
-
puts "PREPARE"
|
418
|
-
end
|
419
|
-
file "scopedep.rb" => [:prepare] do
|
420
|
-
puts "SCOPEDEP"
|
421
|
-
end
|
422
|
-
end
|
423
|
-
NAMESPACE
|
424
|
-
end
|
425
|
-
|
426
|
-
def rakefile_nosearch
|
427
|
-
FileUtils.touch 'dummy'
|
428
|
-
end
|
429
|
-
|
430
|
-
def rakefile_rakelib
|
431
|
-
FileUtils.mkdir_p 'rakelib'
|
432
|
-
|
433
|
-
Dir.chdir 'rakelib' do
|
434
|
-
open 'test1.rb', 'w' do |io|
|
435
|
-
io << <<-TEST1
|
436
|
-
task :default do
|
437
|
-
puts "TEST1"
|
438
|
-
end
|
439
|
-
TEST1
|
440
|
-
end
|
441
|
-
|
442
|
-
open 'test2.rake', 'w' do |io|
|
443
|
-
io << <<-TEST1
|
444
|
-
task :default do
|
445
|
-
puts "TEST2"
|
446
|
-
end
|
447
|
-
TEST1
|
448
|
-
end
|
449
|
-
end
|
450
|
-
end
|
451
|
-
|
452
|
-
def rakefile_rbext
|
453
|
-
open 'rakefile.rb', 'w' do |io|
|
454
|
-
io << 'task :default do puts "OK" end'
|
455
|
-
end
|
456
|
-
end
|
457
|
-
|
458
|
-
def rakefile_unittest
|
459
|
-
rakefile '# Empty Rakefile for Unit Test'
|
460
|
-
|
461
|
-
readme = File.join 'subdir', 'README'
|
462
|
-
FileUtils.mkdir_p File.dirname readme
|
463
|
-
|
464
|
-
FileUtils.touch readme
|
465
|
-
end
|
466
|
-
|
467
|
-
def rakefile_verbose
|
468
|
-
rakefile <<-VERBOSE
|
469
|
-
task :standalone_verbose_true do
|
470
|
-
verbose true
|
471
|
-
sh "#{RUBY} -e '0'"
|
472
|
-
end
|
473
|
-
|
474
|
-
task :standalone_verbose_false do
|
475
|
-
verbose false
|
476
|
-
sh "#{RUBY} -e '0'"
|
477
|
-
end
|
478
|
-
|
479
|
-
task :inline_verbose_default do
|
480
|
-
sh "#{RUBY} -e '0'"
|
481
|
-
end
|
482
|
-
|
483
|
-
task :inline_verbose_false do
|
484
|
-
sh "#{RUBY} -e '0'", :verbose => false
|
485
|
-
end
|
486
|
-
|
487
|
-
task :inline_verbose_true do
|
488
|
-
sh "#{RUBY} -e '0'", :verbose => true
|
489
|
-
end
|
490
|
-
|
491
|
-
task :block_verbose_true do
|
492
|
-
verbose(true) do
|
493
|
-
sh "#{RUBY} -e '0'"
|
494
|
-
end
|
495
|
-
end
|
496
|
-
|
497
|
-
task :block_verbose_false do
|
498
|
-
verbose(false) do
|
499
|
-
sh "#{RUBY} -e '0'"
|
500
|
-
end
|
501
|
-
end
|
502
|
-
VERBOSE
|
503
|
-
end
|
504
|
-
|
505
|
-
def rakefile_test_signal
|
506
|
-
rakefile <<-TEST_SIGNAL
|
507
|
-
require 'rake/testtask'
|
508
|
-
|
509
|
-
Rake::TestTask.new(:a) do |t|
|
510
|
-
t.test_files = ['a_test.rb']
|
511
|
-
end
|
512
|
-
|
513
|
-
Rake::TestTask.new(:b) do |t|
|
514
|
-
t.test_files = ['b_test.rb']
|
515
|
-
end
|
516
|
-
|
517
|
-
task :test do
|
518
|
-
Rake::Task[:a].invoke
|
519
|
-
Rake::Task[:b].invoke
|
520
|
-
end
|
521
|
-
|
522
|
-
task :default => :test
|
523
|
-
TEST_SIGNAL
|
524
|
-
open 'a_test.rb', 'w' do |io|
|
525
|
-
io << 'puts "ATEST"' << "\n"
|
526
|
-
io << '$stdout.flush' << "\n"
|
527
|
-
io << 'Process.kill("TERM", $$)' << "\n"
|
528
|
-
end
|
529
|
-
open 'b_test.rb', 'w' do |io|
|
530
|
-
io << 'puts "BTEST"' << "\n"
|
531
|
-
io << '$stdout.flush' << "\n"
|
532
|
-
end
|
533
|
-
end
|
534
|
-
|
535
|
-
def rakefile_failing_test_task
|
536
|
-
rakefile <<-TEST_TASK
|
537
|
-
require 'rake/testtask'
|
538
|
-
|
539
|
-
task :default => :test
|
540
|
-
Rake::TestTask.new(:test) do |t|
|
541
|
-
t.test_files = ['a_test.rb']
|
542
|
-
end
|
543
|
-
TEST_TASK
|
544
|
-
open 'a_test.rb', 'w' do |io|
|
545
|
-
io << "require 'minitest/autorun'\n"
|
546
|
-
io << "class ExitTaskTest < MiniTest::Unit::TestCase\n"
|
547
|
-
io << " def test_exit\n"
|
548
|
-
io << " assert false, 'this should fail'\n"
|
549
|
-
io << " end\n"
|
550
|
-
io << "end\n"
|
551
|
-
end
|
552
|
-
end
|
553
|
-
|
554
|
-
def rakefile_stand_alone_filelist
|
555
|
-
open 'stand_alone_filelist.rb', 'w' do |io|
|
556
|
-
io << "require 'rake/file_list'\n"
|
557
|
-
io << "FL = Rake::FileList['*.rb']\n"
|
558
|
-
io << "puts FL\n"
|
559
|
-
end
|
560
|
-
end
|
561
|
-
|
127
|
+
include RakefileDefinitions
|
562
128
|
end
|