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
@@ -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,21 +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:
|
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"]
|
17
64
|
CLEAN.clear_exclude.exclude { |fn|
|
18
|
-
fn.pathmap("%f") ==
|
65
|
+
fn.pathmap("%f").downcase == "core" && File.directory?(fn)
|
19
66
|
}
|
20
67
|
|
21
68
|
desc "Remove any temporary products."
|
22
69
|
task :clean do
|
23
|
-
CLEAN
|
70
|
+
Rake::Cleaner.cleanup_files(CLEAN)
|
24
71
|
end
|
25
72
|
|
26
|
-
CLOBBER = Rake::FileList.new
|
73
|
+
CLOBBER = ::Rake::FileList.new
|
27
74
|
|
28
|
-
desc "Remove any generated
|
29
|
-
task :
|
30
|
-
CLOBBER
|
75
|
+
desc "Remove any generated files."
|
76
|
+
task clobber: [:clean] do
|
77
|
+
Rake::Cleaner.cleanup_files(CLOBBER)
|
31
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,12 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Rake DSL functions.
|
2
|
-
require
|
3
|
+
require "rake/file_utils_ext"
|
3
4
|
|
4
5
|
module Rake
|
6
|
+
|
7
|
+
##
|
8
|
+
# DSL is a module that provides #task, #desc, #namespace, etc. Use this
|
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.
|
13
|
+
|
5
14
|
module DSL
|
6
15
|
|
16
|
+
#--
|
7
17
|
# Include the FileUtils file manipulation functions in the top
|
8
18
|
# level module, but mark them private so that they don't
|
9
19
|
# unintentionally define methods on other objects.
|
20
|
+
#++
|
10
21
|
|
11
22
|
include FileUtilsExt
|
12
23
|
private(*FileUtils.instance_methods(false))
|
@@ -14,18 +25,41 @@ module Rake
|
|
14
25
|
|
15
26
|
private
|
16
27
|
|
17
|
-
#
|
28
|
+
# :call-seq:
|
29
|
+
# task(task_name)
|
30
|
+
# task(task_name: dependencies)
|
31
|
+
# task(task_name, arguments => dependencies)
|
18
32
|
#
|
19
|
-
#
|
20
|
-
#
|
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
|
21
46
|
# rm_rf "html"
|
22
47
|
# end
|
23
48
|
#
|
24
|
-
|
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:
|
25
60
|
Rake::Task.define_task(*args, &block)
|
26
61
|
end
|
27
62
|
|
28
|
-
|
29
63
|
# Declare a file task.
|
30
64
|
#
|
31
65
|
# Example:
|
@@ -39,14 +73,14 @@ module Rake
|
|
39
73
|
# end
|
40
74
|
# end
|
41
75
|
#
|
42
|
-
def file(*args, &block)
|
76
|
+
def file(*args, &block) # :doc:
|
43
77
|
Rake::FileTask.define_task(*args, &block)
|
44
78
|
end
|
45
79
|
|
46
80
|
# Declare a file creation task.
|
47
81
|
# (Mainly used for the directory command).
|
48
|
-
def file_create(args, &block)
|
49
|
-
Rake::FileCreationTask.define_task(args, &block)
|
82
|
+
def file_create(*args, &block)
|
83
|
+
Rake::FileCreationTask.define_task(*args, &block)
|
50
84
|
end
|
51
85
|
|
52
86
|
# Declare a set of files tasks to create the given directories on
|
@@ -55,12 +89,16 @@ module Rake
|
|
55
89
|
# Example:
|
56
90
|
# directory "testdata/doc"
|
57
91
|
#
|
58
|
-
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)
|
59
96
|
Rake.each_dir_parent(dir) do |d|
|
60
97
|
file_create d do |t|
|
61
|
-
mkdir_p t.name
|
98
|
+
mkdir_p t.name unless File.exist?(t.name)
|
62
99
|
end
|
63
100
|
end
|
101
|
+
result
|
64
102
|
end
|
65
103
|
|
66
104
|
# Declare a task that performs its prerequisites in
|
@@ -69,24 +107,32 @@ module Rake
|
|
69
107
|
# about it)
|
70
108
|
#
|
71
109
|
# Example:
|
72
|
-
# multitask :
|
110
|
+
# multitask deploy: %w[deploy_gem deploy_rdoc]
|
73
111
|
#
|
74
|
-
def multitask(args, &block)
|
75
|
-
Rake::MultiTask.define_task(args, &block)
|
112
|
+
def multitask(*args, &block) # :doc:
|
113
|
+
Rake::MultiTask.define_task(*args, &block)
|
76
114
|
end
|
77
115
|
|
78
116
|
# Create a new rake namespace and use it for evaluating the given
|
79
117
|
# block. Returns a NameSpace object that can be used to lookup
|
80
118
|
# tasks defined in the namespace.
|
81
119
|
#
|
82
|
-
#
|
120
|
+
# Example:
|
83
121
|
#
|
84
122
|
# ns = namespace "nested" do
|
123
|
+
# # the "nested:run" task
|
85
124
|
# task :run
|
86
125
|
# end
|
87
126
|
# task_run = ns[:run] # find :run in the given namespace.
|
88
127
|
#
|
89
|
-
|
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:
|
90
136
|
name = name.to_s if name.kind_of?(Symbol)
|
91
137
|
name = name.to_str if name.respond_to?(:to_str)
|
92
138
|
unless name.kind_of?(String) || name.nil?
|
@@ -99,22 +145,24 @@ module Rake
|
|
99
145
|
#
|
100
146
|
# Example:
|
101
147
|
# rule '.o' => '.c' do |t|
|
102
|
-
# sh
|
148
|
+
# sh 'cc', '-o', t.name, t.source
|
103
149
|
# end
|
104
150
|
#
|
105
|
-
def rule(*args, &block)
|
151
|
+
def rule(*args, &block) # :doc:
|
106
152
|
Rake::Task.create_rule(*args, &block)
|
107
153
|
end
|
108
154
|
|
109
|
-
#
|
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).
|
110
158
|
#
|
111
159
|
# Example:
|
112
160
|
# desc "Run the Unit Tests"
|
113
|
-
# task :
|
114
|
-
#
|
161
|
+
# task test: [:build]
|
162
|
+
# # ... run tests
|
115
163
|
# end
|
116
164
|
#
|
117
|
-
def desc(description)
|
165
|
+
def desc(description) # :doc:
|
118
166
|
Rake.application.last_description = description
|
119
167
|
end
|
120
168
|
|
@@ -132,36 +180,16 @@ module Rake
|
|
132
180
|
# Example:
|
133
181
|
# import ".depend", "my_rules"
|
134
182
|
#
|
135
|
-
def import(*fns)
|
183
|
+
def import(*fns) # :doc:
|
136
184
|
fns.each do |fn|
|
137
185
|
Rake.application.add_import(fn)
|
138
186
|
end
|
139
187
|
end
|
140
188
|
end
|
141
|
-
|
142
|
-
module DeprecatedObjectDSL
|
143
|
-
Commands = Object.new.extend DSL
|
144
|
-
DSL.private_instance_methods(false).each do |name|
|
145
|
-
line = __LINE__+1
|
146
|
-
class_eval %{
|
147
|
-
def #{name}(*args, &block)
|
148
|
-
unless Rake.application.options.ignore_deprecate
|
149
|
-
unless @rake_dsl_warning
|
150
|
-
$stderr.puts "WARNING: Global access to Rake DSL methods is deprecated. Please include"
|
151
|
-
$stderr.puts " ... Rake::DSL into classes and modules which use the Rake DSL methods."
|
152
|
-
@rake_dsl_warning = true
|
153
|
-
end
|
154
|
-
$stderr.puts "WARNING: DSL method \#{self.class}##{name} called at \#{caller.first}"
|
155
|
-
end
|
156
|
-
Rake::DeprecatedObjectDSL::Commands.send(:#{name}, *args, &block)
|
157
|
-
end
|
158
|
-
private :#{name}
|
159
|
-
}, __FILE__, line
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
189
|
extend FileUtilsExt
|
164
190
|
end
|
165
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.
|
166
195
|
self.extend Rake::DSL
|
167
|
-
include Rake::DeprecatedObjectDSL
|