rake 10.5.0 → 13.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/History.rdoc +2032 -288
- data/README.rdoc +40 -24
- data/doc/jamis.rb +1 -0
- data/doc/rake.1 +139 -124
- data/doc/rakefile.rdoc +2 -4
- data/{bin → exe}/rake +1 -7
- data/lib/rake/application.rb +131 -90
- data/lib/rake/backtrace.rb +3 -2
- data/lib/rake/clean.rb +7 -5
- data/lib/rake/cloneable.rb +1 -0
- data/lib/rake/cpu_counter.rb +10 -28
- data/lib/rake/default_loader.rb +1 -0
- data/lib/rake/dsl_definition.rb +5 -11
- data/lib/rake/early_time.rb +1 -0
- data/lib/rake/ext/core.rb +1 -0
- data/lib/rake/ext/string.rb +22 -21
- data/lib/rake/file_creation_task.rb +4 -3
- data/lib/rake/file_list.rb +34 -27
- data/lib/rake/file_task.rb +12 -4
- data/lib/rake/file_utils.rb +38 -32
- data/lib/rake/file_utils_ext.rb +8 -18
- data/lib/rake/invocation_chain.rb +1 -0
- data/lib/rake/invocation_exception_mixin.rb +1 -0
- data/lib/rake/late_time.rb +2 -1
- data/lib/rake/linked_list.rb +24 -15
- data/lib/rake/loaders/makefile.rb +5 -4
- data/lib/rake/multi_task.rb +2 -1
- data/lib/rake/name_space.rb +1 -1
- data/lib/rake/packagetask.rb +40 -17
- data/lib/rake/phony.rb +2 -1
- data/lib/rake/private_reader.rb +1 -0
- data/lib/rake/promise.rb +13 -12
- data/lib/rake/pseudo_status.rb +1 -0
- data/lib/rake/rake_module.rb +30 -1
- data/lib/rake/rake_test_loader.rb +9 -4
- data/lib/rake/rule_recursion_overflow_error.rb +2 -2
- data/lib/rake/scope.rb +3 -2
- data/lib/rake/task.rb +82 -31
- data/lib/rake/task_argument_error.rb +1 -0
- data/lib/rake/task_arguments.rb +15 -4
- data/lib/rake/task_manager.rb +56 -32
- data/lib/rake/tasklib.rb +2 -14
- data/lib/rake/testtask.rb +37 -61
- data/lib/rake/thread_history_display.rb +4 -3
- data/lib/rake/thread_pool.rb +16 -17
- data/lib/rake/trace_output.rb +2 -1
- data/lib/rake/version.rb +4 -1
- data/lib/rake/win32.rb +10 -15
- data/lib/rake.rb +35 -43
- data/rake.gemspec +100 -0
- metadata +27 -223
- data/.autotest +0 -7
- data/.rubocop.yml +0 -27
- data/.togglerc +0 -7
- data/CONTRIBUTING.rdoc +0 -38
- data/Manifest.txt +0 -166
- data/Rakefile +0 -81
- 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 -37
- 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.2.rdoc +0 -55
- data/doc/release_notes/rake-0.9.2.rdoc +0 -49
- data/doc/release_notes/rake-0.9.3.rdoc +0 -102
- data/doc/release_notes/rake-0.9.4.rdoc +0 -60
- data/doc/release_notes/rake-0.9.5.rdoc +0 -55
- data/doc/release_notes/rake-0.9.6.rdoc +0 -64
- data/doc/release_notes/rake-10.0.0.rdoc +0 -178
- data/doc/release_notes/rake-10.0.1.rdoc +0 -58
- data/doc/release_notes/rake-10.0.2.rdoc +0 -53
- data/doc/release_notes/rake-10.0.3.rdoc +0 -191
- data/doc/release_notes/rake-10.1.0.rdoc +0 -61
- data/lib/rake/alt_system.rb +0 -110
- data/lib/rake/contrib/.document +0 -1
- data/lib/rake/contrib/compositepublisher.rb +0 -21
- data/lib/rake/contrib/ftptools.rb +0 -137
- data/lib/rake/contrib/publisher.rb +0 -81
- data/lib/rake/contrib/rubyforgepublisher.rb +0 -18
- data/lib/rake/contrib/sshpublisher.rb +0 -61
- data/lib/rake/contrib/sys.rb +0 -4
- data/lib/rake/ext/module.rb +0 -2
- data/lib/rake/ext/pathname.rb +0 -25
- data/lib/rake/ext/time.rb +0 -18
- data/lib/rake/gempackagetask.rb +0 -4
- data/lib/rake/pathmap.rb +0 -3
- data/lib/rake/rdoctask.rb +0 -4
- data/lib/rake/ruby182_test_unit_fix.rb +0 -29
- data/lib/rake/runtest.rb +0 -27
- data/rakelib/publish.rake +0 -20
- data/rakelib/test_times.rake +0 -25
- data/test/file_creation.rb +0 -34
- data/test/helper.rb +0 -129
- data/test/support/rakefile_definitions.rb +0 -478
- data/test/support/ruby_runner.rb +0 -34
- data/test/test_private_reader.rb +0 -42
- data/test/test_rake.rb +0 -40
- data/test/test_rake_application.rb +0 -643
- data/test/test_rake_application_options.rb +0 -468
- data/test/test_rake_backtrace.rb +0 -119
- data/test/test_rake_clean.rb +0 -61
- data/test/test_rake_cpu_counter.rb +0 -68
- data/test/test_rake_definitions.rb +0 -84
- data/test/test_rake_directory_task.rb +0 -76
- data/test/test_rake_dsl.rb +0 -40
- 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 -670
- data/test/test_rake_file_list_path_map.rb +0 -8
- data/test/test_rake_file_task.rb +0 -197
- data/test/test_rake_file_utils.rb +0 -314
- data/test/test_rake_ftp_file.rb +0 -74
- data/test/test_rake_functional.rb +0 -482
- data/test/test_rake_invocation_chain.rb +0 -64
- data/test/test_rake_late_time.rb +0 -18
- data/test/test_rake_linked_list.rb +0 -84
- data/test/test_rake_makefile_loader.rb +0 -46
- data/test/test_rake_multi_task.rb +0 -64
- data/test/test_rake_name_space.rb +0 -57
- data/test/test_rake_package_task.rb +0 -79
- data/test/test_rake_path_map.rb +0 -168
- data/test/test_rake_path_map_explode.rb +0 -34
- data/test/test_rake_path_map_partial.rb +0 -18
- data/test/test_rake_pathname_extensions.rb +0 -15
- data/test/test_rake_pseudo_status.rb +0 -21
- data/test/test_rake_rake_test_loader.rb +0 -20
- data/test/test_rake_reduce_compat.rb +0 -26
- data/test/test_rake_require.rb +0 -40
- data/test/test_rake_rules.rb +0 -388
- data/test/test_rake_scope.rb +0 -44
- data/test/test_rake_task.rb +0 -393
- data/test/test_rake_task_argument_parsing.rb +0 -119
- data/test/test_rake_task_arguments.rb +0 -127
- data/test/test_rake_task_lib.rb +0 -9
- data/test/test_rake_task_manager.rb +0 -178
- data/test/test_rake_task_manager_argument_resolution.rb +0 -19
- data/test/test_rake_task_with_arguments.rb +0 -172
- data/test/test_rake_test_task.rb +0 -146
- data/test/test_rake_thread_pool.rb +0 -145
- data/test/test_rake_top_level_functions.rb +0 -71
- data/test/test_rake_win32.rb +0 -72
- data/test/test_thread_history_display.rb +0 -101
- data/test/test_trace_output.rb +0 -52
data/lib/rake/application.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
|
2
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "optparse"
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
4
|
+
require "rake/task_manager"
|
5
|
+
require "rake/file_list"
|
6
|
+
require "rake/thread_pool"
|
7
|
+
require "rake/thread_history_display"
|
8
|
+
require "rake/trace_output"
|
9
|
+
require "rake/win32"
|
10
10
|
|
11
11
|
module Rake
|
12
12
|
|
@@ -35,17 +35,20 @@ module Rake
|
|
35
35
|
# List of the top level task names (task names from the command line).
|
36
36
|
attr_reader :top_level_tasks
|
37
37
|
|
38
|
+
# Override the detected TTY output state (mostly for testing)
|
39
|
+
attr_writer :tty_output
|
40
|
+
|
38
41
|
DEFAULT_RAKEFILES = [
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
"rakefile",
|
43
|
+
"Rakefile",
|
44
|
+
"rakefile.rb",
|
45
|
+
"Rakefile.rb"
|
43
46
|
].freeze
|
44
47
|
|
45
48
|
# Initialize a Rake::Application object.
|
46
49
|
def initialize
|
47
50
|
super
|
48
|
-
@name =
|
51
|
+
@name = "rake"
|
49
52
|
@rakefiles = DEFAULT_RAKEFILES.dup
|
50
53
|
@rakefile = nil
|
51
54
|
@pending_imports = []
|
@@ -54,11 +57,13 @@ module Rake
|
|
54
57
|
@default_loader = Rake::DefaultLoader.new
|
55
58
|
@original_dir = Dir.pwd
|
56
59
|
@top_level_tasks = []
|
57
|
-
add_loader(
|
58
|
-
add_loader(
|
59
|
-
add_loader(
|
60
|
+
add_loader("rb", DefaultLoader.new)
|
61
|
+
add_loader("rf", DefaultLoader.new)
|
62
|
+
add_loader("rake", DefaultLoader.new)
|
60
63
|
@tty_output = STDOUT.tty?
|
61
|
-
@terminal_columns = ENV[
|
64
|
+
@terminal_columns = ENV["RAKE_COLUMNS"].to_i
|
65
|
+
|
66
|
+
set_default_options
|
62
67
|
end
|
63
68
|
|
64
69
|
# Run the Rake application. The run method performs the following
|
@@ -71,19 +76,24 @@ module Rake
|
|
71
76
|
# If you wish to build a custom rake command, you should call
|
72
77
|
# +init+ on your application. Then define any tasks. Finally,
|
73
78
|
# call +top_level+ to run your top level tasks.
|
74
|
-
def run
|
79
|
+
def run(argv = ARGV)
|
75
80
|
standard_exception_handling do
|
76
|
-
init
|
81
|
+
init "rake", argv
|
77
82
|
load_rakefile
|
78
83
|
top_level
|
79
84
|
end
|
80
85
|
end
|
81
86
|
|
82
87
|
# Initialize the command line parameters and app name.
|
83
|
-
def init(app_name=
|
88
|
+
def init(app_name="rake", argv = ARGV)
|
84
89
|
standard_exception_handling do
|
85
90
|
@name = app_name
|
86
|
-
|
91
|
+
begin
|
92
|
+
args = handle_options argv
|
93
|
+
rescue ArgumentError
|
94
|
+
# Backward compatibility for capistrano
|
95
|
+
args = handle_options
|
96
|
+
end
|
87
97
|
collect_command_line_tasks(args)
|
88
98
|
end
|
89
99
|
end
|
@@ -162,7 +172,7 @@ module Rake
|
|
162
172
|
args = []
|
163
173
|
|
164
174
|
begin
|
165
|
-
|
175
|
+
/\s*((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
|
166
176
|
|
167
177
|
remaining_args = $2
|
168
178
|
args << $1.gsub(/\\(.)/, '\1')
|
@@ -202,13 +212,22 @@ module Rake
|
|
202
212
|
end
|
203
213
|
|
204
214
|
def display_exception_details(ex) # :nodoc:
|
205
|
-
|
206
|
-
return if seen.include? ex
|
207
|
-
seen << ex
|
215
|
+
display_exception_details_seen << ex
|
208
216
|
|
209
217
|
display_exception_message_details(ex)
|
210
218
|
display_exception_backtrace(ex)
|
211
|
-
|
219
|
+
display_cause_details(ex.cause) if has_cause?(ex)
|
220
|
+
end
|
221
|
+
|
222
|
+
def display_cause_details(ex) # :nodoc:
|
223
|
+
return if display_exception_details_seen.include? ex
|
224
|
+
|
225
|
+
trace "\nCaused by:"
|
226
|
+
display_exception_details(ex)
|
227
|
+
end
|
228
|
+
|
229
|
+
def display_exception_details_seen # :nodoc:
|
230
|
+
Thread.current[:rake_display_exception_details_seen] ||= []
|
212
231
|
end
|
213
232
|
|
214
233
|
def has_cause?(ex) # :nodoc:
|
@@ -257,7 +276,7 @@ module Rake
|
|
257
276
|
if File.exist?(fn)
|
258
277
|
others = FileList.glob(fn, File::FNM_CASEFOLD)
|
259
278
|
return others.size == 1 ? others.first : fn
|
260
|
-
elsif fn ==
|
279
|
+
elsif fn == ""
|
261
280
|
return fn
|
262
281
|
end
|
263
282
|
end
|
@@ -269,11 +288,6 @@ module Rake
|
|
269
288
|
@tty_output
|
270
289
|
end
|
271
290
|
|
272
|
-
# Override the detected TTY output state (mostly for testing)
|
273
|
-
def tty_output=(tty_output_state) # :nodoc:
|
274
|
-
@tty_output = tty_output_state
|
275
|
-
end
|
276
|
-
|
277
291
|
# We will truncate output if we are outputting to a TTY or if we've been
|
278
292
|
# given an explicit column width to honor
|
279
293
|
def truncate_output? # :nodoc:
|
@@ -345,7 +359,7 @@ module Rake
|
|
345
359
|
end
|
346
360
|
|
347
361
|
def unix? # :nodoc:
|
348
|
-
RbConfig::CONFIG[
|
362
|
+
RbConfig::CONFIG["host_os"] =~
|
349
363
|
/(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
|
350
364
|
end
|
351
365
|
|
@@ -378,7 +392,7 @@ module Rake
|
|
378
392
|
|
379
393
|
def sort_options(options) # :nodoc:
|
380
394
|
options.sort_by { |opt|
|
381
|
-
opt.select { |o| o =~ /^-/ }.map
|
395
|
+
opt.select { |o| o.is_a?(String) && o =~ /^-/ }.map(&:downcase).sort.reverse
|
382
396
|
}
|
383
397
|
end
|
384
398
|
private :sort_options
|
@@ -388,38 +402,45 @@ module Rake
|
|
388
402
|
def standard_rake_options # :nodoc:
|
389
403
|
sort_options(
|
390
404
|
[
|
391
|
-
[
|
405
|
+
["--all", "-A",
|
392
406
|
"Show all tasks, even uncommented ones (in combination with -T or -D)",
|
393
407
|
lambda { |value|
|
394
408
|
options.show_all_tasks = value
|
395
409
|
}
|
396
410
|
],
|
397
|
-
[
|
411
|
+
["--backtrace=[OUT]",
|
398
412
|
"Enable full backtrace. OUT can be stderr (default) or stdout.",
|
399
413
|
lambda { |value|
|
400
414
|
options.backtrace = true
|
401
|
-
select_trace_output(options,
|
415
|
+
select_trace_output(options, "backtrace", value)
|
402
416
|
}
|
403
417
|
],
|
404
|
-
[
|
418
|
+
["--build-all", "-B",
|
405
419
|
"Build all prerequisites, including those which are up-to-date.",
|
406
420
|
lambda { |value|
|
407
421
|
options.build_all = true
|
408
422
|
}
|
409
423
|
],
|
410
|
-
[
|
424
|
+
["--comments",
|
411
425
|
"Show commented tasks only",
|
412
426
|
lambda { |value|
|
413
427
|
options.show_all_tasks = !value
|
414
428
|
}
|
415
429
|
],
|
416
|
-
[
|
430
|
+
["--describe", "-D [PATTERN]",
|
417
431
|
"Describe the tasks (matching optional PATTERN), then exit.",
|
418
432
|
lambda { |value|
|
419
433
|
select_tasks_to_show(options, :describe, value)
|
420
434
|
}
|
421
435
|
],
|
422
|
-
[
|
436
|
+
["--directory", "-C [DIRECTORY]",
|
437
|
+
"Change to DIRECTORY before doing anything.",
|
438
|
+
lambda { |value|
|
439
|
+
Dir.chdir value
|
440
|
+
@original_dir = Dir.pwd
|
441
|
+
}
|
442
|
+
],
|
443
|
+
["--dry-run", "-n",
|
423
444
|
"Do a dry run without executing actions.",
|
424
445
|
lambda { |value|
|
425
446
|
Rake.verbose(true)
|
@@ -428,31 +449,31 @@ module Rake
|
|
428
449
|
options.trace = true
|
429
450
|
}
|
430
451
|
],
|
431
|
-
[
|
452
|
+
["--execute", "-e CODE",
|
432
453
|
"Execute some Ruby code and exit.",
|
433
454
|
lambda { |value|
|
434
455
|
eval(value)
|
435
456
|
exit
|
436
457
|
}
|
437
458
|
],
|
438
|
-
[
|
459
|
+
["--execute-print", "-p CODE",
|
439
460
|
"Execute some Ruby code, print the result, then exit.",
|
440
461
|
lambda { |value|
|
441
462
|
puts eval(value)
|
442
463
|
exit
|
443
464
|
}
|
444
465
|
],
|
445
|
-
[
|
466
|
+
["--execute-continue", "-E CODE",
|
446
467
|
"Execute some Ruby code, " +
|
447
468
|
"then continue with normal task processing.",
|
448
469
|
lambda { |value| eval(value) }
|
449
470
|
],
|
450
|
-
[
|
471
|
+
["--jobs", "-j [NUMBER]",
|
451
472
|
"Specifies the maximum number of tasks to execute in parallel. " +
|
452
473
|
"(default is number of CPU cores + 4)",
|
453
474
|
lambda { |value|
|
454
|
-
if value.nil? || value ==
|
455
|
-
value =
|
475
|
+
if value.nil? || value == ""
|
476
|
+
value = Float::INFINITY
|
456
477
|
elsif value =~ /^\d+$/
|
457
478
|
value = value.to_i
|
458
479
|
else
|
@@ -462,7 +483,7 @@ module Rake
|
|
462
483
|
options.thread_pool_size = value - 1
|
463
484
|
}
|
464
485
|
],
|
465
|
-
[
|
486
|
+
["--job-stats [LEVEL]",
|
466
487
|
"Display job statistics. " +
|
467
488
|
"LEVEL=history displays a complete job list",
|
468
489
|
lambda { |value|
|
@@ -473,42 +494,42 @@ module Rake
|
|
473
494
|
end
|
474
495
|
}
|
475
496
|
],
|
476
|
-
[
|
497
|
+
["--libdir", "-I LIBDIR",
|
477
498
|
"Include LIBDIR in the search path for required modules.",
|
478
499
|
lambda { |value| $:.push(value) }
|
479
500
|
],
|
480
|
-
[
|
501
|
+
["--multitask", "-m",
|
481
502
|
"Treat all tasks as multitasks.",
|
482
503
|
lambda { |value| options.always_multitask = true }
|
483
504
|
],
|
484
|
-
[
|
485
|
-
|
505
|
+
["--no-search", "--nosearch",
|
506
|
+
"-N", "Do not search parent directories for the Rakefile.",
|
486
507
|
lambda { |value| options.nosearch = true }
|
487
508
|
],
|
488
|
-
[
|
509
|
+
["--prereqs", "-P",
|
489
510
|
"Display the tasks and dependencies, then exit.",
|
490
511
|
lambda { |value| options.show_prereqs = true }
|
491
512
|
],
|
492
|
-
[
|
513
|
+
["--quiet", "-q",
|
493
514
|
"Do not log messages to standard output.",
|
494
515
|
lambda { |value| Rake.verbose(false) }
|
495
516
|
],
|
496
|
-
[
|
517
|
+
["--rakefile", "-f [FILENAME]",
|
497
518
|
"Use FILENAME as the rakefile to search for.",
|
498
519
|
lambda { |value|
|
499
|
-
value ||=
|
520
|
+
value ||= ""
|
500
521
|
@rakefiles.clear
|
501
522
|
@rakefiles << value
|
502
523
|
}
|
503
524
|
],
|
504
|
-
[
|
525
|
+
["--rakelibdir", "--rakelib", "-R RAKELIBDIR",
|
505
526
|
"Auto-import any .rake files in RAKELIBDIR. " +
|
506
527
|
"(default is 'rakelib')",
|
507
528
|
lambda { |value|
|
508
529
|
options.rakelib = value.split(File::PATH_SEPARATOR)
|
509
530
|
}
|
510
531
|
],
|
511
|
-
[
|
532
|
+
["--require", "-r MODULE",
|
512
533
|
"Require MODULE before executing rakefile.",
|
513
534
|
lambda { |value|
|
514
535
|
begin
|
@@ -522,11 +543,11 @@ module Rake
|
|
522
543
|
end
|
523
544
|
}
|
524
545
|
],
|
525
|
-
[
|
546
|
+
["--rules",
|
526
547
|
"Trace the rules resolution.",
|
527
548
|
lambda { |value| options.trace_rules = true }
|
528
549
|
],
|
529
|
-
[
|
550
|
+
["--silent", "-s",
|
530
551
|
"Like --quiet, but also suppresses the " +
|
531
552
|
"'in directory' announcement.",
|
532
553
|
lambda { |value|
|
@@ -534,59 +555,60 @@ module Rake
|
|
534
555
|
options.silent = true
|
535
556
|
}
|
536
557
|
],
|
537
|
-
[
|
558
|
+
["--suppress-backtrace PATTERN",
|
538
559
|
"Suppress backtrace lines matching regexp PATTERN. " +
|
539
560
|
"Ignored if --trace is on.",
|
540
561
|
lambda { |value|
|
541
562
|
options.suppress_backtrace_pattern = Regexp.new(value)
|
542
563
|
}
|
543
564
|
],
|
544
|
-
[
|
565
|
+
["--system", "-g",
|
545
566
|
"Using system wide (global) rakefiles " +
|
546
567
|
"(usually '~/.rake/*.rake').",
|
547
568
|
lambda { |value| options.load_system = true }
|
548
569
|
],
|
549
|
-
[
|
570
|
+
["--no-system", "--nosystem", "-G",
|
550
571
|
"Use standard project Rakefile search paths, " +
|
551
572
|
"ignore system wide rakefiles.",
|
552
573
|
lambda { |value| options.ignore_system = true }
|
553
574
|
],
|
554
|
-
[
|
575
|
+
["--tasks", "-T [PATTERN]",
|
555
576
|
"Display the tasks (matching optional PATTERN) " +
|
556
|
-
"with descriptions, then exit."
|
577
|
+
"with descriptions, then exit. " +
|
578
|
+
"-AT combination displays all of tasks contained no description.",
|
557
579
|
lambda { |value|
|
558
580
|
select_tasks_to_show(options, :tasks, value)
|
559
581
|
}
|
560
582
|
],
|
561
|
-
[
|
583
|
+
["--trace=[OUT]", "-t",
|
562
584
|
"Turn on invoke/execute tracing, enable full backtrace. " +
|
563
585
|
"OUT can be stderr (default) or stdout.",
|
564
586
|
lambda { |value|
|
565
587
|
options.trace = true
|
566
588
|
options.backtrace = true
|
567
|
-
select_trace_output(options,
|
589
|
+
select_trace_output(options, "trace", value)
|
568
590
|
Rake.verbose(true)
|
569
591
|
}
|
570
592
|
],
|
571
|
-
[
|
593
|
+
["--verbose", "-v",
|
572
594
|
"Log message to standard output.",
|
573
595
|
lambda { |value| Rake.verbose(true) }
|
574
596
|
],
|
575
|
-
[
|
597
|
+
["--version", "-V",
|
576
598
|
"Display the program version.",
|
577
599
|
lambda { |value|
|
578
|
-
puts "rake, version #{
|
600
|
+
puts "rake, version #{Rake::VERSION}"
|
579
601
|
exit
|
580
602
|
}
|
581
603
|
],
|
582
|
-
[
|
604
|
+
["--where", "-W [PATTERN]",
|
583
605
|
"Describe the tasks (matching optional PATTERN), then exit.",
|
584
606
|
lambda { |value|
|
585
607
|
select_tasks_to_show(options, :lines, value)
|
586
608
|
options.show_all_tasks = true
|
587
609
|
}
|
588
610
|
],
|
589
|
-
[
|
611
|
+
["--no-deprecation-warnings", "-X",
|
590
612
|
"Disable the deprecation warnings.",
|
591
613
|
lambda { |value|
|
592
614
|
options.ignore_deprecate = true
|
@@ -597,7 +619,7 @@ module Rake
|
|
597
619
|
|
598
620
|
def select_tasks_to_show(options, show_tasks, value) # :nodoc:
|
599
621
|
options.show_tasks = show_tasks
|
600
|
-
options.show_task_pattern = Regexp.new(value ||
|
622
|
+
options.show_task_pattern = Regexp.new(value || "")
|
601
623
|
Rake::TaskManager.record_task_metadata = true
|
602
624
|
end
|
603
625
|
private :select_tasks_to_show
|
@@ -605,9 +627,9 @@ module Rake
|
|
605
627
|
def select_trace_output(options, trace_option, value) # :nodoc:
|
606
628
|
value = value.strip unless value.nil?
|
607
629
|
case value
|
608
|
-
when
|
630
|
+
when "stdout"
|
609
631
|
options.trace_output = $stdout
|
610
|
-
when
|
632
|
+
when "stderr", nil
|
611
633
|
options.trace_output = $stderr
|
612
634
|
else
|
613
635
|
fail CommandLineOptionError,
|
@@ -619,9 +641,8 @@ module Rake
|
|
619
641
|
# Read and handle the command line options. Returns the command line
|
620
642
|
# arguments that we didn't understand, which should (in theory) be just
|
621
643
|
# task names and env vars.
|
622
|
-
def handle_options # :nodoc:
|
623
|
-
|
624
|
-
options.trace_output = $stderr
|
644
|
+
def handle_options(argv) # :nodoc:
|
645
|
+
set_default_options
|
625
646
|
|
626
647
|
OptionParser.new do |opts|
|
627
648
|
opts.banner = "#{Rake.application.name} [-f rakefile] {options} targets..."
|
@@ -634,8 +655,8 @@ module Rake
|
|
634
655
|
end
|
635
656
|
|
636
657
|
standard_rake_options.each { |args| opts.on(*args) }
|
637
|
-
opts.environment(
|
638
|
-
end.parse(
|
658
|
+
opts.environment("RAKEOPT")
|
659
|
+
end.parse(argv)
|
639
660
|
end
|
640
661
|
|
641
662
|
# Similar to the regular Ruby +require+ command, but will check
|
@@ -673,7 +694,7 @@ module Rake
|
|
673
694
|
|
674
695
|
def raw_load_rakefile # :nodoc:
|
675
696
|
rakefile, location = find_rakefile_location
|
676
|
-
if (!
|
697
|
+
if (!options.ignore_system) &&
|
677
698
|
(options.load_system || rakefile.nil?) &&
|
678
699
|
system_dir && File.directory?(system_dir)
|
679
700
|
print_rakefile_directory(location)
|
@@ -687,7 +708,7 @@ module Rake
|
|
687
708
|
Dir.chdir(location)
|
688
709
|
print_rakefile_directory(location)
|
689
710
|
Rake.load_rakefile(File.expand_path(@rakefile)) if
|
690
|
-
@rakefile && @rakefile !=
|
711
|
+
@rakefile && @rakefile != ""
|
691
712
|
options.rakelib.each do |rlib|
|
692
713
|
glob("#{rlib}/*.rake") do |name|
|
693
714
|
add_import name
|
@@ -698,7 +719,7 @@ module Rake
|
|
698
719
|
end
|
699
720
|
|
700
721
|
def glob(path, &block) # :nodoc:
|
701
|
-
FileList.glob(path.
|
722
|
+
FileList.glob(path.tr("\\", "/")).each(&block)
|
702
723
|
end
|
703
724
|
private :glob
|
704
725
|
|
@@ -706,8 +727,8 @@ module Rake
|
|
706
727
|
def system_dir # :nodoc:
|
707
728
|
@system_dir ||=
|
708
729
|
begin
|
709
|
-
if ENV[
|
710
|
-
ENV[
|
730
|
+
if ENV["RAKE_SYSTEM"]
|
731
|
+
ENV["RAKE_SYSTEM"]
|
711
732
|
else
|
712
733
|
standard_system_dir
|
713
734
|
end
|
@@ -721,7 +742,7 @@ module Rake
|
|
721
742
|
end
|
722
743
|
else
|
723
744
|
def standard_system_dir #:nodoc:
|
724
|
-
File.join(File.expand_path(
|
745
|
+
File.join(File.expand_path("~"), ".rake")
|
725
746
|
end
|
726
747
|
end
|
727
748
|
private :standard_system_dir
|
@@ -780,11 +801,31 @@ module Rake
|
|
780
801
|
re = /^#{@rakefile}$/
|
781
802
|
re = /#{re.source}/i if windows?
|
782
803
|
|
783
|
-
backtrace.find { |str| str =~ re } ||
|
804
|
+
backtrace.find { |str| str =~ re } || ""
|
805
|
+
end
|
806
|
+
|
807
|
+
def set_default_options # :nodoc:
|
808
|
+
options.always_multitask = false
|
809
|
+
options.backtrace = false
|
810
|
+
options.build_all = false
|
811
|
+
options.dryrun = false
|
812
|
+
options.ignore_deprecate = false
|
813
|
+
options.ignore_system = false
|
814
|
+
options.job_stats = false
|
815
|
+
options.load_system = false
|
816
|
+
options.nosearch = false
|
817
|
+
options.rakelib = %w[rakelib]
|
818
|
+
options.show_all_tasks = false
|
819
|
+
options.show_prereqs = false
|
820
|
+
options.show_task_pattern = nil
|
821
|
+
options.show_tasks = nil
|
822
|
+
options.silent = false
|
823
|
+
options.suppress_backtrace_pattern = nil
|
824
|
+
options.thread_pool_size = Rake.suggested_thread_count
|
825
|
+
options.trace = false
|
826
|
+
options.trace_output = $stderr
|
827
|
+
options.trace_rules = false
|
784
828
|
end
|
785
829
|
|
786
|
-
private
|
787
|
-
FIXNUM_MAX = (2**(0.size * 8 - 2) - 1) # :nodoc:
|
788
|
-
|
789
830
|
end
|
790
831
|
end
|
data/lib/rake/backtrace.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Rake
|
2
3
|
module Backtrace # :nodoc: all
|
3
4
|
SYS_KEYS = RbConfig::CONFIG.keys.grep(/(?:[a-z]prefix|libdir)\z/)
|
@@ -5,12 +6,12 @@ module Rake
|
|
5
6
|
[ File.join(File.dirname(__FILE__), "..") ]
|
6
7
|
|
7
8
|
SUPPRESSED_PATHS = SYS_PATHS.
|
8
|
-
map { |s| s.
|
9
|
+
map { |s| s.tr("\\", "/") }.
|
9
10
|
map { |f| File.expand_path(f) }.
|
10
11
|
reject { |s| s.nil? || s =~ /^ *$/ }
|
11
12
|
SUPPRESSED_PATHS_RE = SUPPRESSED_PATHS.map { |f| Regexp.quote(f) }.join("|")
|
12
13
|
SUPPRESSED_PATHS_RE << "|^org\\/jruby\\/\\w+\\.java" if
|
13
|
-
Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE ==
|
14
|
+
Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == "jruby"
|
14
15
|
|
15
16
|
SUPPRESS_PATTERN = %r!(\A(#{SUPPRESSED_PATHS_RE})|bin/rake:\d+)!i
|
16
17
|
|
data/lib/rake/clean.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# The 'rake/clean' file defines two file lists (CLEAN and CLOBBER) and
|
2
3
|
# two rake tasks (:clean and :clobber).
|
3
4
|
#
|
@@ -11,7 +12,7 @@
|
|
11
12
|
# The intent of this task is to return a project to its
|
12
13
|
# pristine, just unpacked state.
|
13
14
|
|
14
|
-
require
|
15
|
+
require "rake"
|
15
16
|
|
16
17
|
# :stopdoc:
|
17
18
|
|
@@ -27,9 +28,10 @@ module Rake
|
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
|
-
def cleanup(file_name, opts
|
31
|
+
def cleanup(file_name, **opts)
|
31
32
|
begin
|
32
|
-
|
33
|
+
opts = { verbose: Rake.application.options.trace }.merge(opts)
|
34
|
+
rm_r file_name, **opts
|
33
35
|
rescue StandardError => ex
|
34
36
|
puts "Failed to remove #{file_name}: #{ex}" unless file_already_gone?(file_name)
|
35
37
|
end
|
@@ -60,7 +62,7 @@ end
|
|
60
62
|
|
61
63
|
CLEAN = ::Rake::FileList["**/*~", "**/*.bak", "**/core"]
|
62
64
|
CLEAN.clear_exclude.exclude { |fn|
|
63
|
-
fn.pathmap("%f").downcase ==
|
65
|
+
fn.pathmap("%f").downcase == "core" && File.directory?(fn)
|
64
66
|
}
|
65
67
|
|
66
68
|
desc "Remove any temporary products."
|
@@ -71,6 +73,6 @@ end
|
|
71
73
|
CLOBBER = ::Rake::FileList.new
|
72
74
|
|
73
75
|
desc "Remove any generated files."
|
74
|
-
task :
|
76
|
+
task clobber: [:clean] do
|
75
77
|
Rake::Cleaner.cleanup_files(CLOBBER)
|
76
78
|
end
|
data/lib/rake/cloneable.rb
CHANGED