rake 0.9.3.beta.1 → 0.9.3.beta.2
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.
- data/CHANGES +2 -0
- data/README.rdoc +9 -8
- data/TODO +1 -0
- data/doc/command_line_usage.rdoc +9 -0
- data/doc/release_notes/rake-0.9.3.rdoc +55 -0
- data/install.rb +1 -1
- data/lib/rake/application.rb +177 -139
- data/lib/rake/clean.rb +1 -1
- data/lib/rake/cloneable.rb +7 -16
- data/lib/rake/contrib/ftptools.rb +2 -1
- data/lib/rake/contrib/sys.rb +6 -6
- data/lib/rake/dsl_definition.rb +2 -2
- data/lib/rake/file_list.rb +2 -2
- data/lib/rake/file_utils_ext.rb +4 -3
- data/lib/rake/multi_task.rb +6 -4
- data/lib/rake/phony.rb +13 -0
- data/lib/rake/rake_module.rb +7 -0
- data/lib/rake/rdoctask.rb +1 -1
- data/lib/rake/runtest.rb +1 -1
- data/lib/rake/task.rb +8 -0
- data/lib/rake/task_arguments.rb +1 -1
- data/lib/rake/testtask.rb +5 -1
- data/lib/rake/thread_pool.rb +133 -0
- data/lib/rake/version.rb +8 -4
- data/test/helper.rb +29 -0
- data/test/test_rake_application.rb +12 -0
- data/test/test_rake_application_options.rb +39 -3
- data/test/test_rake_directory_task.rb +0 -5
- data/test/test_rake_file_task.rb +21 -1
- data/test/test_rake_functional.rb +22 -0
- data/test/test_rake_multi_task.rb +8 -0
- data/test/test_rake_task.rb +18 -1
- data/test/test_rake_thread_pool.rb +146 -0
- metadata +18 -8
data/CHANGES
CHANGED
@@ -10,6 +10,8 @@
|
|
10
10
|
* Commands constant is no longer polluting top level namespace.
|
11
11
|
* Show only the interesting portion of the backtrace by default (James M. Lawrence).
|
12
12
|
* Added --reduce-compat optiont to remove backward compatible DSL hacks (James M. Lawrence).
|
13
|
+
* lib/rake/file_list.rb (Rake::FileList#egrep): there is no need to
|
14
|
+
open files in binary mode. (NAKAMURA Usaku)
|
13
15
|
|
14
16
|
== Version 0.9.2
|
15
17
|
|
data/README.rdoc
CHANGED
@@ -80,13 +80,13 @@ Type "rake --help" for all available options.
|
|
80
80
|
=== More Information
|
81
81
|
|
82
82
|
* For details on Rake's command-line invocation, read
|
83
|
-
doc/command_line_usage.rdoc[
|
83
|
+
doc/command_line_usage.rdoc[https://github.com/jimweirich/rake/blob/master/doc/command_line_usage.rdoc]
|
84
84
|
* For details on writing Rakefiles, see
|
85
|
-
doc/rakefile.rdoc[
|
85
|
+
doc/rakefile.rdoc[https://github.com/jimweirich/rake/blob/master/doc/rakefile.rdoc].
|
86
86
|
* For the original announcement of Rake, see
|
87
|
-
doc/rational.rdoc[
|
87
|
+
doc/rational.rdoc[https://github.com/jimweirich/rake/blob/master/doc/rational.rdoc].
|
88
88
|
* For a glossary of terms, see
|
89
|
-
doc/glossary.rdoc[
|
89
|
+
doc/glossary.rdoc[https://github.com/jimweirich/rake/blob/master/doc/glossary.rdoc].
|
90
90
|
|
91
91
|
== Development
|
92
92
|
|
@@ -128,7 +128,6 @@ Issues and bug reports can also be tracked here:
|
|
128
128
|
* Rake API Documents: http://rake.rubyforge.org
|
129
129
|
* Rake Source Code Repo: http://github.com/jimweirich/rake
|
130
130
|
* Rake Git Repo Clone URL: git://github.com/jimweirich/rake.git
|
131
|
-
* Rake Issue Tracking: http://www.pivotaltracker.com/projects/28469
|
132
131
|
* Rake Bug Reports: https://github.com/jimweirich/rake/issues
|
133
132
|
|
134
133
|
=== Presentations and Articles about Rake
|
@@ -160,6 +159,8 @@ other projects with similar (and not so similar) goals.
|
|
160
159
|
|
161
160
|
[<b>Tilman Sauerbeck <tilman@code-monkey.de></b>] For the recursive rule patch.
|
162
161
|
|
162
|
+
[<b>Eric Hodel</b>] For aid in maintaining rake.
|
163
|
+
|
163
164
|
== License
|
164
165
|
|
165
166
|
Rake is available under an MIT-style license.
|
@@ -185,9 +186,9 @@ jim dot weirich at gmail.com.
|
|
185
186
|
|
186
187
|
Author:: Jim Weirich <jim.weirich@gmail.com>
|
187
188
|
Requires:: Ruby 1.8.6 or later
|
188
|
-
License:: Copyright 2003-
|
189
|
-
Released under an MIT-style license. See the LICENSE
|
190
|
-
included in the distribution.
|
189
|
+
License:: Copyright 2003-2011 by Jim Weirich.
|
190
|
+
Released under an MIT-style license. See the MIT-LICENSE
|
191
|
+
file included in the distribution.
|
191
192
|
|
192
193
|
== Warranty
|
193
194
|
|
data/TODO
CHANGED
data/doc/command_line_usage.rdoc
CHANGED
@@ -37,6 +37,15 @@ Options are:
|
|
37
37
|
[<tt>--help</tt> (-H)]
|
38
38
|
Display some help text and exit.
|
39
39
|
|
40
|
+
[<tt>--jobs</tt> _number_ (-j)]
|
41
|
+
Specifies the maximum number of concurrent tasks. The suggested
|
42
|
+
value is equal to the number of CPUs.
|
43
|
+
|
44
|
+
Sample values:
|
45
|
+
(no -j) : unlimited concurrent tasks (standard rake behavior)
|
46
|
+
-j : 2 concurrent tasks (exact number may change)
|
47
|
+
-j 16 : 16 concurrent tasks
|
48
|
+
|
40
49
|
[<tt>--libdir</tt> _directory_ (-I)]
|
41
50
|
Add _directory_ to the list of directories searched for require.
|
42
51
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
= Rake 0.9.3 Released
|
2
|
+
|
3
|
+
Rake version 0.9.3 is mainly bug fixes.
|
4
|
+
|
5
|
+
== Changes
|
6
|
+
|
7
|
+
* The rake test loader now removes arguments it has processed. Issue #51
|
8
|
+
* Rake::TaskArguments now responds to #values_at
|
9
|
+
* RakeFileUtils.verbose_flag = nil silences output the same as 0.8.7
|
10
|
+
* Rake tests are now directory-independent
|
11
|
+
* Rake tests are no longer require flexmock
|
12
|
+
* Commands constant is no longer polluting top level namespace.
|
13
|
+
* Show only the interesting portion of the backtrace by default (James M. Lawrence).
|
14
|
+
* Added --reduce-compat optiont to remove backward compatible DSL hacks (James M. Lawrence).
|
15
|
+
|
16
|
+
== What is Rake
|
17
|
+
|
18
|
+
Rake is a build tool similar to the make program in many ways. But
|
19
|
+
instead of cryptic make recipes, Rake uses standard Ruby code to
|
20
|
+
declare tasks and dependencies. You have the full power of a modern
|
21
|
+
scripting language built right into your build tool.
|
22
|
+
|
23
|
+
== Availability
|
24
|
+
|
25
|
+
The easiest way to get and install rake is via RubyGems ...
|
26
|
+
|
27
|
+
gem install rake (you may need root/admin privileges)
|
28
|
+
|
29
|
+
Otherwise, you can get it from the more traditional places:
|
30
|
+
|
31
|
+
Home Page:: http://rake.rubyforge.org/
|
32
|
+
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
|
33
|
+
GitHub:: git://github.com/jimweirich/rake.git
|
34
|
+
|
35
|
+
== Thanks
|
36
|
+
|
37
|
+
As usual, it was input from users that drove a alot of these changes. The
|
38
|
+
following people either contributed patches, made suggestions or made
|
39
|
+
otherwise helpful comments. Thanks to ...
|
40
|
+
|
41
|
+
* James M. Lawrence (quix)
|
42
|
+
* Roger Pack
|
43
|
+
* Cezary Baginski
|
44
|
+
* Sean Scot August Moon
|
45
|
+
* R.T. Lechow
|
46
|
+
* Alex Chaffee
|
47
|
+
* James Tucker
|
48
|
+
* Matthias Lüdtke
|
49
|
+
* Santiago Pastorino
|
50
|
+
|
51
|
+
Also, bit thanks to Eric Hodel for assisting with getting this release
|
52
|
+
out the door (where "assisting" includes, but is not by any means
|
53
|
+
limited to, "pushing" me to get it done).
|
54
|
+
|
55
|
+
-- Jim Weirich
|
data/install.rb
CHANGED
data/lib/rake/application.rb
CHANGED
@@ -2,6 +2,7 @@ require 'shellwords'
|
|
2
2
|
require 'optparse'
|
3
3
|
|
4
4
|
require 'rake/task_manager'
|
5
|
+
require 'rake/thread_pool'
|
5
6
|
require 'rake/win32'
|
6
7
|
|
7
8
|
module Rake
|
@@ -64,6 +65,7 @@ module Rake
|
|
64
65
|
init
|
65
66
|
load_rakefile
|
66
67
|
top_level
|
68
|
+
thread_pool.join
|
67
69
|
end
|
68
70
|
end
|
69
71
|
|
@@ -106,6 +108,10 @@ module Rake
|
|
106
108
|
@options ||= OpenStruct.new
|
107
109
|
end
|
108
110
|
|
111
|
+
def thread_pool
|
112
|
+
@thread_pool ||= ThreadPool.new options.thread_pool_size
|
113
|
+
end
|
114
|
+
|
109
115
|
# private ----------------------------------------------------------------
|
110
116
|
|
111
117
|
def invoke_task(task_string)
|
@@ -146,13 +152,13 @@ module Rake
|
|
146
152
|
def display_error_message(ex)
|
147
153
|
$stderr.puts "#{name} aborted!"
|
148
154
|
$stderr.puts ex.message
|
149
|
-
if options.
|
155
|
+
if options.backtrace
|
150
156
|
$stderr.puts ex.backtrace.join("\n")
|
151
157
|
else
|
152
158
|
$stderr.puts Backtrace.collapse(ex.backtrace)
|
153
159
|
end
|
154
160
|
$stderr.puts "Tasks: #{ex.chain}" if has_chain?(ex)
|
155
|
-
$stderr.puts "(See full trace by running task with --trace)" unless options.
|
161
|
+
$stderr.puts "(See full trace by running task with --trace)" unless options.backtrace
|
156
162
|
end
|
157
163
|
|
158
164
|
# Warn about deprecated usage.
|
@@ -178,7 +184,7 @@ module Rake
|
|
178
184
|
def have_rakefile
|
179
185
|
@rakefiles.each do |fn|
|
180
186
|
if File.exist?(fn)
|
181
|
-
others =
|
187
|
+
others = Rake.glob(fn, File::FNM_CASEFOLD)
|
182
188
|
return others.size == 1 ? others.first : fn
|
183
189
|
elsif fn == ''
|
184
190
|
return fn
|
@@ -206,7 +212,7 @@ module Rake
|
|
206
212
|
# Display the tasks and comments.
|
207
213
|
def display_tasks_and_comments
|
208
214
|
displayable_tasks = tasks.select { |t|
|
209
|
-
t.comment && t.name =~ options.show_task_pattern
|
215
|
+
(options.show_all_tasks || t.comment) && t.name =~ options.show_task_pattern
|
210
216
|
}
|
211
217
|
case options.show_tasks
|
212
218
|
when :tasks
|
@@ -220,7 +226,8 @@ module Rake
|
|
220
226
|
when :describe
|
221
227
|
displayable_tasks.each do |t|
|
222
228
|
puts "#{name} #{t.name_with_args}"
|
223
|
-
t.full_comment
|
229
|
+
comment = t.full_comment || ""
|
230
|
+
comment.split("\n").each do |line|
|
224
231
|
puts " #{line}"
|
225
232
|
end
|
226
233
|
puts
|
@@ -269,7 +276,9 @@ module Rake
|
|
269
276
|
end
|
270
277
|
|
271
278
|
def truncate(string, width)
|
272
|
-
if string.
|
279
|
+
if string.nil?
|
280
|
+
""
|
281
|
+
elsif string.length <= width
|
273
282
|
string
|
274
283
|
else
|
275
284
|
( string[0, width-3] || "" ) + "..."
|
@@ -284,142 +293,171 @@ module Rake
|
|
284
293
|
end
|
285
294
|
end
|
286
295
|
|
296
|
+
def sort_options(options)
|
297
|
+
options.sort_by { |opt|
|
298
|
+
opt.select { |o| o =~ /^-/ }.map { |o| o.downcase }.sort.reverse
|
299
|
+
}
|
300
|
+
end
|
301
|
+
private :sort_options
|
302
|
+
|
287
303
|
# A list of all the standard options used in rake, suitable for
|
288
304
|
# passing to OptionParser.
|
289
305
|
def standard_rake_options
|
290
|
-
|
291
|
-
[
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
306
|
+
sort_options(
|
307
|
+
[
|
308
|
+
['--all', '-A', "Show all tasks, even uncommented ones",
|
309
|
+
lambda { |value|
|
310
|
+
options.show_all_tasks = value
|
311
|
+
}
|
312
|
+
],
|
313
|
+
['--backtrace', "Enable full backtrace.",
|
314
|
+
lambda { |value|
|
315
|
+
options.backtrace = value
|
316
|
+
}
|
317
|
+
],
|
318
|
+
['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
|
319
|
+
lambda { |value|
|
320
|
+
require 'rake/classic_namespace'
|
321
|
+
options.classic_namespace = true
|
322
|
+
}
|
323
|
+
],
|
324
|
+
['--comments', "Show commented tasks only",
|
325
|
+
lambda { |value|
|
326
|
+
options.show_all_tasks = !value
|
327
|
+
}
|
328
|
+
],
|
329
|
+
['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
|
330
|
+
lambda { |value|
|
331
|
+
select_tasks_to_show :describe, value, options
|
332
|
+
}
|
333
|
+
],
|
334
|
+
['--dry-run', '-n', "Do a dry run without executing actions.",
|
335
|
+
lambda { |value|
|
336
|
+
Rake.verbose(true)
|
337
|
+
Rake.nowrite(true)
|
338
|
+
options.dryrun = true
|
339
|
+
options.trace = true
|
340
|
+
}
|
341
|
+
],
|
342
|
+
['--execute', '-e CODE', "Execute some Ruby code and exit.",
|
343
|
+
lambda { |value|
|
344
|
+
eval(value)
|
345
|
+
exit
|
346
|
+
}
|
347
|
+
],
|
348
|
+
['--execute-print', '-p CODE', "Execute some Ruby code, print the result, then exit.",
|
349
|
+
lambda { |value|
|
350
|
+
puts eval(value)
|
351
|
+
exit
|
352
|
+
}
|
353
|
+
],
|
354
|
+
['--execute-continue', '-E CODE',
|
355
|
+
"Execute some Ruby code, then continue with normal task processing.",
|
356
|
+
lambda { |value| eval(value) }
|
357
|
+
],
|
358
|
+
['--jobs', '-j [NUMBER]',
|
359
|
+
"Specifies the maximum number of tasks to execute in parallel. (default:2)",
|
360
|
+
lambda { |value| options.thread_pool_size = [(value || 2).to_i,2].max }
|
361
|
+
],
|
362
|
+
['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
|
363
|
+
lambda { |value| $:.push(value) }
|
364
|
+
],
|
365
|
+
['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
|
366
|
+
lambda { |value| options.nosearch = true }
|
367
|
+
],
|
368
|
+
['--prereqs', '-P', "Display the tasks and dependencies, then exit.",
|
369
|
+
lambda { |value| options.show_prereqs = true }
|
370
|
+
],
|
371
|
+
['--quiet', '-q', "Do not log messages to standard output.",
|
372
|
+
lambda { |value| Rake.verbose(false) }
|
373
|
+
],
|
374
|
+
['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
|
375
|
+
lambda { |value|
|
376
|
+
value ||= ''
|
377
|
+
@rakefiles.clear
|
378
|
+
@rakefiles << value
|
379
|
+
}
|
380
|
+
],
|
381
|
+
['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
|
382
|
+
"Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
|
383
|
+
lambda { |value| options.rakelib = value.split(File::PATH_SEPARATOR) }
|
384
|
+
],
|
385
|
+
['--reduce-compat', "Remove DSL in Object; remove Module#const_missing which defines ::Task etc.",
|
386
|
+
# Load-time option.
|
387
|
+
# Handled in bin/rake where Rake::REDUCE_COMPAT is defined (or not).
|
388
|
+
lambda { |_| }
|
389
|
+
],
|
390
|
+
['--require', '-r MODULE', "Require MODULE before executing rakefile.",
|
391
|
+
lambda { |value|
|
362
392
|
begin
|
363
|
-
|
364
|
-
rescue LoadError
|
365
|
-
|
393
|
+
require value
|
394
|
+
rescue LoadError => ex
|
395
|
+
begin
|
396
|
+
rake_require value
|
397
|
+
rescue LoadError
|
398
|
+
raise ex
|
399
|
+
end
|
366
400
|
end
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
401
|
+
}
|
402
|
+
],
|
403
|
+
['--rules', "Trace the rules resolution.",
|
404
|
+
lambda { |value| options.trace_rules = true }
|
405
|
+
],
|
406
|
+
['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
|
407
|
+
lambda { |value|
|
408
|
+
Rake.verbose(false)
|
409
|
+
options.silent = true
|
410
|
+
}
|
411
|
+
],
|
412
|
+
['--system', '-g',
|
413
|
+
"Using system wide (global) rakefiles (usually '~/.rake/*.rake').",
|
414
|
+
lambda { |value| options.load_system = true }
|
415
|
+
],
|
416
|
+
['--no-system', '--nosystem', '-G',
|
417
|
+
"Use standard project Rakefile search paths, ignore system wide rakefiles.",
|
418
|
+
lambda { |value| options.ignore_system = true }
|
419
|
+
],
|
420
|
+
['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
|
421
|
+
lambda { |value|
|
422
|
+
select_tasks_to_show :tasks, value, options
|
423
|
+
}
|
424
|
+
],
|
425
|
+
['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
|
426
|
+
lambda { |value|
|
427
|
+
options.trace = true
|
428
|
+
options.backtrace = true
|
429
|
+
Rake.verbose(true)
|
430
|
+
}
|
431
|
+
],
|
432
|
+
['--verbose', '-v', "Log message to standard output.",
|
433
|
+
lambda { |value| Rake.verbose(true) }
|
434
|
+
],
|
435
|
+
['--version', '-V', "Display the program version.",
|
436
|
+
lambda { |value|
|
437
|
+
puts "rake, version #{RAKEVERSION}"
|
438
|
+
exit
|
439
|
+
}
|
440
|
+
],
|
441
|
+
['--where', '-W [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
|
442
|
+
lambda { |value|
|
443
|
+
select_tasks_to_show :lines, value, options
|
444
|
+
options.show_all_tasks = true
|
445
|
+
}
|
446
|
+
],
|
447
|
+
['--no-deprecation-warnings', '-X', "Disable the deprecation warnings.",
|
448
|
+
lambda { |value|
|
449
|
+
options.ignore_deprecate = true
|
450
|
+
}
|
451
|
+
],
|
452
|
+
])
|
453
|
+
end
|
454
|
+
|
455
|
+
def select_tasks_to_show(show_tasks, value, options)
|
456
|
+
options.show_tasks = show_tasks
|
457
|
+
options.show_task_pattern = Regexp.new(value || '')
|
458
|
+
Rake::TaskManager.record_task_metadata = true
|
459
|
+
end
|
460
|
+
private :select_tasks_to_show
|
423
461
|
|
424
462
|
# Read and handle the command line options.
|
425
463
|
def handle_options
|
@@ -512,7 +550,7 @@ module Rake
|
|
512
550
|
end
|
513
551
|
|
514
552
|
def glob(path, &block)
|
515
|
-
|
553
|
+
Rake.glob(path.gsub("\\", '/')).each(&block)
|
516
554
|
end
|
517
555
|
private :glob
|
518
556
|
|
@@ -586,7 +624,7 @@ module Rake
|
|
586
624
|
@const_warning = true
|
587
625
|
end
|
588
626
|
|
589
|
-
def rakefile_location
|
627
|
+
def rakefile_location(backtrace=caller)
|
590
628
|
backtrace.map { |t| t[/([^:]+):/,1] }
|
591
629
|
|
592
630
|
re = /^#{@rakefile}$/
|