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
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Rake
|
3
|
+
module Backtrace # :nodoc: all
|
4
|
+
SYS_KEYS = RbConfig::CONFIG.keys.grep(/(?:[a-z]prefix|libdir)\z/)
|
5
|
+
SYS_PATHS = RbConfig::CONFIG.values_at(*SYS_KEYS).uniq +
|
6
|
+
[ File.join(File.dirname(__FILE__), "..") ]
|
7
|
+
|
8
|
+
SUPPRESSED_PATHS = SYS_PATHS.
|
9
|
+
map { |s| s.tr("\\", "/") }.
|
10
|
+
map { |f| File.expand_path(f) }.
|
11
|
+
reject { |s| s.nil? || s =~ /^ *$/ }
|
12
|
+
SUPPRESSED_PATHS_RE = SUPPRESSED_PATHS.map { |f| Regexp.quote(f) }.join("|")
|
13
|
+
SUPPRESSED_PATHS_RE << "|^org\\/jruby\\/\\w+\\.java" if
|
14
|
+
Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == "jruby"
|
15
|
+
|
16
|
+
SUPPRESS_PATTERN = %r!(\A(#{SUPPRESSED_PATHS_RE})|bin/rake:\d+)!i
|
17
|
+
|
18
|
+
def self.collapse(backtrace)
|
19
|
+
pattern = Rake.application.options.suppress_backtrace_pattern ||
|
20
|
+
SUPPRESS_PATTERN
|
21
|
+
backtrace.reject { |elem| elem =~ pattern }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
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,22 +12,67 @@
|
|
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
|
+
|
19
|
+
module Rake
|
20
|
+
module Cleaner
|
21
|
+
extend FileUtils
|
22
|
+
|
23
|
+
module_function
|
24
|
+
|
25
|
+
def cleanup_files(file_names)
|
26
|
+
file_names.each do |file_name|
|
27
|
+
cleanup(file_name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def cleanup(file_name, **opts)
|
32
|
+
begin
|
33
|
+
opts = { verbose: Rake.application.options.trace }.merge(opts)
|
34
|
+
rm_r file_name, **opts
|
35
|
+
rescue StandardError => ex
|
36
|
+
puts "Failed to remove #{file_name}: #{ex}" unless file_already_gone?(file_name)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def file_already_gone?(file_name)
|
41
|
+
return false if File.exist?(file_name)
|
42
|
+
|
43
|
+
path = file_name
|
44
|
+
prev = nil
|
45
|
+
|
46
|
+
while path = File.dirname(path)
|
47
|
+
return false if cant_be_deleted?(path)
|
48
|
+
break if [prev, "."].include?(path)
|
49
|
+
prev = path
|
50
|
+
end
|
51
|
+
true
|
52
|
+
end
|
53
|
+
private_class_method :file_already_gone?
|
54
|
+
|
55
|
+
def cant_be_deleted?(path_name)
|
56
|
+
File.exist?(path_name) &&
|
57
|
+
(!File.readable?(path_name) || !File.executable?(path_name))
|
58
|
+
end
|
59
|
+
private_class_method :cant_be_deleted?
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
CLEAN = ::Rake::FileList["**/*~", "**/*.bak", "**/core"]
|
18
64
|
CLEAN.clear_exclude.exclude { |fn|
|
19
|
-
fn.pathmap("%f") ==
|
65
|
+
fn.pathmap("%f").downcase == "core" && File.directory?(fn)
|
20
66
|
}
|
21
67
|
|
22
68
|
desc "Remove any temporary products."
|
23
69
|
task :clean do
|
24
|
-
CLEAN
|
70
|
+
Rake::Cleaner.cleanup_files(CLEAN)
|
25
71
|
end
|
26
72
|
|
27
|
-
CLOBBER = Rake::FileList.new
|
73
|
+
CLOBBER = ::Rake::FileList.new
|
28
74
|
|
29
|
-
desc "Remove any generated
|
30
|
-
task :
|
31
|
-
CLOBBER
|
75
|
+
desc "Remove any generated files."
|
76
|
+
task clobber: [:clean] do
|
77
|
+
Rake::Cleaner.cleanup_files(CLOBBER)
|
32
78
|
end
|
data/lib/rake/cloneable.rb
CHANGED
@@ -1,25 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Rake
|
2
|
-
|
3
|
+
##
|
3
4
|
# Mixin for creating easily cloned objects.
|
4
|
-
#
|
5
|
-
module Cloneable
|
6
|
-
# Clone an object by making a new object and setting all the instance
|
7
|
-
# variables to the same values.
|
8
|
-
def dup
|
9
|
-
sibling = self.class.new
|
10
|
-
instance_variables.each do |ivar|
|
11
|
-
value = self.instance_variable_get(ivar)
|
12
|
-
new_value = value.clone rescue value
|
13
|
-
sibling.instance_variable_set(ivar, new_value)
|
14
|
-
end
|
15
|
-
sibling.taint if tainted?
|
16
|
-
sibling
|
17
|
-
end
|
18
5
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
6
|
+
module Cloneable # :nodoc:
|
7
|
+
# The hook that is invoked by 'clone' and 'dup' methods.
|
8
|
+
def initialize_copy(source)
|
9
|
+
super
|
10
|
+
source.instance_variables.each do |var|
|
11
|
+
src_value = source.instance_variable_get(var)
|
12
|
+
value = src_value.clone rescue src_value
|
13
|
+
instance_variable_set(var, value)
|
14
|
+
end
|
23
15
|
end
|
24
16
|
end
|
25
17
|
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Rake
|
3
|
+
|
4
|
+
# Based on a script at:
|
5
|
+
# http://stackoverflow.com/questions/891537/ruby-detect-number-of-cpus-installed
|
6
|
+
class CpuCounter # :nodoc: all
|
7
|
+
def self.count
|
8
|
+
new.count_with_default
|
9
|
+
end
|
10
|
+
|
11
|
+
def count_with_default(default=4)
|
12
|
+
count || default
|
13
|
+
rescue StandardError
|
14
|
+
default
|
15
|
+
end
|
16
|
+
|
17
|
+
begin
|
18
|
+
require "etc"
|
19
|
+
rescue LoadError
|
20
|
+
else
|
21
|
+
if Etc.respond_to?(:nprocessors)
|
22
|
+
def count
|
23
|
+
return Etc.nprocessors
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
unless Rake::CpuCounter.method_defined?(:count)
|
31
|
+
Rake::CpuCounter.class_eval <<-'end;', __FILE__, __LINE__+1
|
32
|
+
require 'rbconfig'
|
33
|
+
|
34
|
+
def count
|
35
|
+
if RUBY_PLATFORM == 'java'
|
36
|
+
count_via_java_runtime
|
37
|
+
else
|
38
|
+
case RbConfig::CONFIG['host_os']
|
39
|
+
when /linux/
|
40
|
+
count_via_cpuinfo
|
41
|
+
when /darwin|bsd/
|
42
|
+
count_via_sysctl
|
43
|
+
when /mswin|mingw/
|
44
|
+
count_via_win32
|
45
|
+
else
|
46
|
+
# Try everything
|
47
|
+
count_via_win32 ||
|
48
|
+
count_via_sysctl ||
|
49
|
+
count_via_cpuinfo
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def count_via_java_runtime
|
55
|
+
Java::Java.lang.Runtime.getRuntime.availableProcessors
|
56
|
+
rescue StandardError
|
57
|
+
nil
|
58
|
+
end
|
59
|
+
|
60
|
+
def count_via_win32
|
61
|
+
require 'win32ole'
|
62
|
+
wmi = WIN32OLE.connect("winmgmts://")
|
63
|
+
cpu = wmi.ExecQuery("select NumberOfCores from Win32_Processor") # TODO count hyper-threaded in this
|
64
|
+
cpu.to_enum.first.NumberOfCores
|
65
|
+
rescue StandardError, LoadError
|
66
|
+
nil
|
67
|
+
end
|
68
|
+
|
69
|
+
def count_via_cpuinfo
|
70
|
+
open('/proc/cpuinfo') { |f| f.readlines }.grep(/processor/).size
|
71
|
+
rescue StandardError
|
72
|
+
nil
|
73
|
+
end
|
74
|
+
|
75
|
+
def count_via_sysctl
|
76
|
+
run 'sysctl', '-n', 'hw.ncpu'
|
77
|
+
end
|
78
|
+
|
79
|
+
def run(command, *args)
|
80
|
+
cmd = resolve_command(command)
|
81
|
+
if cmd
|
82
|
+
IO.popen [cmd, *args] do |io|
|
83
|
+
io.read.to_i
|
84
|
+
end
|
85
|
+
else
|
86
|
+
nil
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def resolve_command(command)
|
91
|
+
look_for_command("/usr/sbin", command) ||
|
92
|
+
look_for_command("/sbin", command) ||
|
93
|
+
in_path_command(command)
|
94
|
+
end
|
95
|
+
|
96
|
+
def look_for_command(dir, command)
|
97
|
+
path = File.join(dir, command)
|
98
|
+
File.exist?(path) ? path : nil
|
99
|
+
end
|
100
|
+
|
101
|
+
def in_path_command(command)
|
102
|
+
IO.popen ['which', command] do |io|
|
103
|
+
io.eof? ? nil : command
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end;
|
107
|
+
end
|
data/lib/rake/default_loader.rb
CHANGED
data/lib/rake/dsl_definition.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Rake DSL functions.
|
2
|
-
require
|
3
|
+
require "rake/file_utils_ext"
|
3
4
|
|
4
5
|
module Rake
|
5
6
|
|
6
7
|
##
|
7
8
|
# DSL is a module that provides #task, #desc, #namespace, etc. Use this
|
8
9
|
# when you'd like to use rake outside the top level scope.
|
10
|
+
#
|
11
|
+
# For a Rakefile you run from the command line this module is automatically
|
12
|
+
# included.
|
9
13
|
|
10
14
|
module DSL
|
11
15
|
|
@@ -21,18 +25,41 @@ module Rake
|
|
21
25
|
|
22
26
|
private
|
23
27
|
|
24
|
-
#
|
28
|
+
# :call-seq:
|
29
|
+
# task(task_name)
|
30
|
+
# task(task_name: dependencies)
|
31
|
+
# task(task_name, arguments => dependencies)
|
25
32
|
#
|
26
|
-
#
|
27
|
-
#
|
33
|
+
# Declare a basic task. The +task_name+ is always the first argument. If
|
34
|
+
# the task name contains a ":" it is defined in that namespace.
|
35
|
+
#
|
36
|
+
# The +dependencies+ may be a single task name or an Array of task names.
|
37
|
+
# The +argument+ (a single name) or +arguments+ (an Array of names) define
|
38
|
+
# the arguments provided to the task.
|
39
|
+
#
|
40
|
+
# The task, argument and dependency names may be either symbols or
|
41
|
+
# strings.
|
42
|
+
#
|
43
|
+
# A task with a single dependency:
|
44
|
+
#
|
45
|
+
# task clobber: %w[clean] do
|
28
46
|
# rm_rf "html"
|
29
47
|
# end
|
30
48
|
#
|
31
|
-
|
49
|
+
# A task with an argument and a dependency:
|
50
|
+
#
|
51
|
+
# task :package, [:version] => :test do |t, args|
|
52
|
+
# # ...
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# To invoke this task from the command line:
|
56
|
+
#
|
57
|
+
# $ rake package[1.2.3]
|
58
|
+
#
|
59
|
+
def task(*args, &block) # :doc:
|
32
60
|
Rake::Task.define_task(*args, &block)
|
33
61
|
end
|
34
62
|
|
35
|
-
|
36
63
|
# Declare a file task.
|
37
64
|
#
|
38
65
|
# Example:
|
@@ -46,14 +73,14 @@ module Rake
|
|
46
73
|
# end
|
47
74
|
# end
|
48
75
|
#
|
49
|
-
def file(*args, &block)
|
76
|
+
def file(*args, &block) # :doc:
|
50
77
|
Rake::FileTask.define_task(*args, &block)
|
51
78
|
end
|
52
79
|
|
53
80
|
# Declare a file creation task.
|
54
81
|
# (Mainly used for the directory command).
|
55
|
-
def file_create(args, &block)
|
56
|
-
Rake::FileCreationTask.define_task(args, &block)
|
82
|
+
def file_create(*args, &block)
|
83
|
+
Rake::FileCreationTask.define_task(*args, &block)
|
57
84
|
end
|
58
85
|
|
59
86
|
# Declare a set of files tasks to create the given directories on
|
@@ -62,12 +89,16 @@ module Rake
|
|
62
89
|
# Example:
|
63
90
|
# directory "testdata/doc"
|
64
91
|
#
|
65
|
-
def directory(
|
92
|
+
def directory(*args, &block) # :doc:
|
93
|
+
result = file_create(*args, &block)
|
94
|
+
dir, _ = *Rake.application.resolve_args(args)
|
95
|
+
dir = Rake.from_pathname(dir)
|
66
96
|
Rake.each_dir_parent(dir) do |d|
|
67
97
|
file_create d do |t|
|
68
|
-
mkdir_p t.name
|
98
|
+
mkdir_p t.name unless File.exist?(t.name)
|
69
99
|
end
|
70
100
|
end
|
101
|
+
result
|
71
102
|
end
|
72
103
|
|
73
104
|
# Declare a task that performs its prerequisites in
|
@@ -76,24 +107,32 @@ module Rake
|
|
76
107
|
# about it)
|
77
108
|
#
|
78
109
|
# Example:
|
79
|
-
# multitask :
|
110
|
+
# multitask deploy: %w[deploy_gem deploy_rdoc]
|
80
111
|
#
|
81
|
-
def multitask(args, &block)
|
82
|
-
Rake::MultiTask.define_task(args, &block)
|
112
|
+
def multitask(*args, &block) # :doc:
|
113
|
+
Rake::MultiTask.define_task(*args, &block)
|
83
114
|
end
|
84
115
|
|
85
116
|
# Create a new rake namespace and use it for evaluating the given
|
86
117
|
# block. Returns a NameSpace object that can be used to lookup
|
87
118
|
# tasks defined in the namespace.
|
88
119
|
#
|
89
|
-
#
|
120
|
+
# Example:
|
90
121
|
#
|
91
122
|
# ns = namespace "nested" do
|
123
|
+
# # the "nested:run" task
|
92
124
|
# task :run
|
93
125
|
# end
|
94
126
|
# task_run = ns[:run] # find :run in the given namespace.
|
95
127
|
#
|
96
|
-
|
128
|
+
# Tasks can also be defined in a namespace by using a ":" in the task
|
129
|
+
# name:
|
130
|
+
#
|
131
|
+
# task "nested:test" do
|
132
|
+
# # ...
|
133
|
+
# end
|
134
|
+
#
|
135
|
+
def namespace(name=nil, &block) # :doc:
|
97
136
|
name = name.to_s if name.kind_of?(Symbol)
|
98
137
|
name = name.to_str if name.respond_to?(:to_str)
|
99
138
|
unless name.kind_of?(String) || name.nil?
|
@@ -106,22 +145,24 @@ module Rake
|
|
106
145
|
#
|
107
146
|
# Example:
|
108
147
|
# rule '.o' => '.c' do |t|
|
109
|
-
# sh
|
148
|
+
# sh 'cc', '-o', t.name, t.source
|
110
149
|
# end
|
111
150
|
#
|
112
|
-
def rule(*args, &block)
|
151
|
+
def rule(*args, &block) # :doc:
|
113
152
|
Rake::Task.create_rule(*args, &block)
|
114
153
|
end
|
115
154
|
|
116
|
-
#
|
155
|
+
# Describes the next rake task. Duplicate descriptions are discarded.
|
156
|
+
# Descriptions are shown with <code>rake -T</code> (up to the first
|
157
|
+
# sentence) and <code>rake -D</code> (the entire description).
|
117
158
|
#
|
118
159
|
# Example:
|
119
160
|
# desc "Run the Unit Tests"
|
120
|
-
# task :
|
121
|
-
#
|
161
|
+
# task test: [:build]
|
162
|
+
# # ... run tests
|
122
163
|
# end
|
123
164
|
#
|
124
|
-
def desc(description)
|
165
|
+
def desc(description) # :doc:
|
125
166
|
Rake.application.last_description = description
|
126
167
|
end
|
127
168
|
|
@@ -139,38 +180,16 @@ module Rake
|
|
139
180
|
# Example:
|
140
181
|
# import ".depend", "my_rules"
|
141
182
|
#
|
142
|
-
def import(*fns)
|
183
|
+
def import(*fns) # :doc:
|
143
184
|
fns.each do |fn|
|
144
185
|
Rake.application.add_import(fn)
|
145
186
|
end
|
146
187
|
end
|
147
|
-
|
148
|
-
end
|
149
|
-
|
150
|
-
DeprecatedCommands = Object.new.extend(DSL)
|
151
|
-
|
152
|
-
module DeprecatedObjectDSL # :nodoc:
|
153
|
-
DSL.private_instance_methods(false).each do |name|
|
154
|
-
line = __LINE__+1
|
155
|
-
class_eval %{
|
156
|
-
def #{name}(*args, &block)
|
157
|
-
unless Rake.application.options.ignore_deprecate
|
158
|
-
unless @rake_dsl_warning
|
159
|
-
$stderr.puts "WARNING: Global access to Rake DSL methods is deprecated. Please include"
|
160
|
-
$stderr.puts " ... Rake::DSL into classes and modules which use the Rake DSL methods."
|
161
|
-
@rake_dsl_warning = true
|
162
|
-
end
|
163
|
-
$stderr.puts "WARNING: DSL method \#{self.class}##{name} called at \#{caller.first}"
|
164
|
-
end
|
165
|
-
Rake::DeprecatedCommands.send(:#{name}, *args, &block)
|
166
|
-
end
|
167
|
-
private :#{name}
|
168
|
-
}, __FILE__, line
|
169
|
-
end
|
170
188
|
end
|
171
|
-
|
172
189
|
extend FileUtilsExt
|
173
190
|
end
|
174
191
|
|
192
|
+
# Extend the main object with the DSL commands. This allows top-level
|
193
|
+
# calls to task, etc. to work from a Rakefile without polluting the
|
194
|
+
# object inheritance tree.
|
175
195
|
self.extend Rake::DSL
|
176
|
-
include Rake::DeprecatedObjectDSL
|
data/lib/rake/early_time.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Rake
|
2
3
|
|
3
4
|
# EarlyTime is a fake timestamp that occurs _before_ any other time value.
|
@@ -5,11 +6,14 @@ module Rake
|
|
5
6
|
include Comparable
|
6
7
|
include Singleton
|
7
8
|
|
9
|
+
##
|
10
|
+
# The EarlyTime always comes before +other+!
|
11
|
+
|
8
12
|
def <=>(other)
|
9
13
|
-1
|
10
14
|
end
|
11
15
|
|
12
|
-
def to_s
|
16
|
+
def to_s # :nodoc:
|
13
17
|
"<EARLY TIME>"
|
14
18
|
end
|
15
19
|
end
|
data/lib/rake/ext/core.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
# Core extension library
|
3
|
-
#
|
1
|
+
# frozen_string_literal: true
|
4
2
|
class Module
|
5
|
-
# Check for an existing method in the current class before extending.
|
3
|
+
# Check for an existing method in the current class before extending. If
|
6
4
|
# the method already exists, then a warning is printed and the extension is
|
7
5
|
# not added. Otherwise the block is yielded and any definitions in the
|
8
6
|
# block will take effect.
|
@@ -17,9 +15,10 @@ class Module
|
|
17
15
|
# end
|
18
16
|
# end
|
19
17
|
#
|
20
|
-
def rake_extension(method)
|
18
|
+
def rake_extension(method) # :nodoc:
|
21
19
|
if method_defined?(method)
|
22
|
-
$stderr.puts "WARNING: Possible conflict with Rake extension:
|
20
|
+
$stderr.puts "WARNING: Possible conflict with Rake extension: " +
|
21
|
+
"#{self}##{method} already exists"
|
23
22
|
else
|
24
23
|
yield
|
25
24
|
end
|