rake 10.4.2 → 13.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CONTRIBUTING.rdoc +16 -7
- data/Gemfile +10 -0
- data/History.rdoc +2022 -287
- data/README.rdoc +40 -25
- data/Rakefile +25 -65
- data/bin/bundle +105 -0
- data/bin/console +7 -0
- data/bin/rake +20 -24
- data/bin/rdoc +29 -0
- data/bin/rubocop +29 -0
- data/bin/setup +6 -0
- data/doc/glossary.rdoc +10 -11
- data/doc/jamis.rb +1 -0
- data/doc/rake.1 +139 -124
- data/doc/rakefile.rdoc +2 -33
- data/exe/rake +27 -0
- data/lib/rake.rb +35 -43
- data/lib/rake/application.rb +125 -91
- data/lib/rake/backtrace.rb +3 -2
- data/lib/rake/clean.rb +8 -6
- 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 +6 -12
- data/lib/rake/early_time.rb +1 -0
- data/lib/rake/ext/core.rb +1 -0
- data/lib/rake/ext/string.rb +24 -21
- data/lib/rake/file_creation_task.rb +4 -3
- data/lib/rake/file_list.rb +35 -28
- 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 +23 -9
- 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 +18 -13
- 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 +54 -33
- data/lib/rake/tasklib.rb +2 -14
- data/lib/rake/testtask.rb +40 -63
- 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/rake.gemspec +43 -0
- metadata +33 -270
- data/.autotest +0 -7
- data/.gemtest +0 -0
- data/.rubocop.yml +0 -27
- data/.togglerc +0 -7
- data/Manifest.txt +0 -166
- 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 -16
- 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 -130
- 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 -466
- 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 -655
- 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 -309
- 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/phony.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Defines a :phony task that you can use as a dependency. This allows
|
2
3
|
# file-based tasks to use non-file-based tasks as prerequisites
|
3
4
|
# without forcing them to rebuild.
|
4
5
|
#
|
5
6
|
# See FileTask#out_of_date? and Task#timestamp for more info.
|
6
7
|
|
7
|
-
require
|
8
|
+
require "rake"
|
8
9
|
|
9
10
|
task :phony
|
10
11
|
|
data/lib/rake/private_reader.rb
CHANGED
data/lib/rake/promise.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Rake
|
2
3
|
|
3
4
|
# A Promise object represents a promise to do work (a chore) in the
|
@@ -27,11 +28,11 @@ module Rake
|
|
27
28
|
# synchronously. We will wait.
|
28
29
|
def value
|
29
30
|
unless complete?
|
30
|
-
stat :sleeping_on, :
|
31
|
+
stat :sleeping_on, item_id: object_id
|
31
32
|
@mutex.synchronize do
|
32
|
-
stat :has_lock_on, :
|
33
|
+
stat :has_lock_on, item_id: object_id
|
33
34
|
chore
|
34
|
-
stat :releasing_lock_on, :
|
35
|
+
stat :releasing_lock_on, item_id: object_id
|
35
36
|
end
|
36
37
|
end
|
37
38
|
error? ? raise(@error) : @result
|
@@ -39,14 +40,14 @@ module Rake
|
|
39
40
|
|
40
41
|
# If no one else is working this promise, go ahead and do the chore.
|
41
42
|
def work
|
42
|
-
stat :attempting_lock_on, :
|
43
|
+
stat :attempting_lock_on, item_id: object_id
|
43
44
|
if @mutex.try_lock
|
44
|
-
stat :has_lock_on, :
|
45
|
+
stat :has_lock_on, item_id: object_id
|
45
46
|
chore
|
46
|
-
stat :releasing_lock_on, :
|
47
|
+
stat :releasing_lock_on, item_id: object_id
|
47
48
|
@mutex.unlock
|
48
49
|
else
|
49
|
-
stat :bailed_on, :
|
50
|
+
stat :bailed_on, item_id: object_id
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
@@ -55,27 +56,27 @@ module Rake
|
|
55
56
|
# Perform the chore promised
|
56
57
|
def chore
|
57
58
|
if complete?
|
58
|
-
stat :found_completed, :
|
59
|
+
stat :found_completed, item_id: object_id
|
59
60
|
return
|
60
61
|
end
|
61
|
-
stat :will_execute, :
|
62
|
+
stat :will_execute, item_id: object_id
|
62
63
|
begin
|
63
64
|
@result = @block.call(*@args)
|
64
65
|
rescue Exception => e
|
65
66
|
@error = e
|
66
67
|
end
|
67
|
-
stat :did_execute, :
|
68
|
+
stat :did_execute, item_id: object_id
|
68
69
|
discard
|
69
70
|
end
|
70
71
|
|
71
72
|
# Do we have a result for the promise
|
72
73
|
def result?
|
73
|
-
|
74
|
+
!@result.equal?(NOT_SET)
|
74
75
|
end
|
75
76
|
|
76
77
|
# Did the promise throw an error
|
77
78
|
def error?
|
78
|
-
|
79
|
+
!@error.equal?(NOT_SET)
|
79
80
|
end
|
80
81
|
|
81
82
|
# Are we done with the promise
|
data/lib/rake/pseudo_status.rb
CHANGED
data/lib/rake/rake_module.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "rake/application"
|
2
3
|
|
3
4
|
module Rake
|
4
5
|
|
@@ -33,6 +34,34 @@ module Rake
|
|
33
34
|
application.options.rakelib ||= []
|
34
35
|
application.options.rakelib.concat(files)
|
35
36
|
end
|
37
|
+
|
38
|
+
# Make +block_application+ the default rake application inside a block so
|
39
|
+
# you can load rakefiles into a different application.
|
40
|
+
#
|
41
|
+
# This is useful when you want to run rake tasks inside a library without
|
42
|
+
# running rake in a sub-shell.
|
43
|
+
#
|
44
|
+
# Example:
|
45
|
+
#
|
46
|
+
# Dir.chdir 'other/directory'
|
47
|
+
#
|
48
|
+
# other_rake = Rake.with_application do |rake|
|
49
|
+
# rake.load_rakefile
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# puts other_rake.tasks
|
53
|
+
|
54
|
+
def with_application(block_application = Rake::Application.new)
|
55
|
+
orig_application = Rake.application
|
56
|
+
|
57
|
+
Rake.application = block_application
|
58
|
+
|
59
|
+
yield block_application
|
60
|
+
|
61
|
+
block_application
|
62
|
+
ensure
|
63
|
+
Rake.application = orig_application
|
64
|
+
end
|
36
65
|
end
|
37
66
|
|
38
67
|
end
|
@@ -1,22 +1,27 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "rake"
|
2
3
|
|
3
4
|
# Load the test files from the command line.
|
4
5
|
argv = ARGV.select do |argument|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
begin
|
7
|
+
case argument
|
8
|
+
when /^-/ then
|
9
|
+
argument
|
10
|
+
when /\*/ then
|
11
|
+
FileList[argument].to_a.each do |file|
|
12
|
+
require File.expand_path file
|
13
|
+
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
false
|
16
|
+
else
|
17
|
+
require File.expand_path argument
|
16
18
|
|
17
|
-
|
19
|
+
false
|
20
|
+
end
|
21
|
+
rescue LoadError => e
|
22
|
+
raise unless e.path
|
23
|
+
abort "\nFile does not exist: #{e.path}\n\n"
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
21
27
|
ARGV.replace argv
|
22
|
-
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
module Rake
|
3
3
|
|
4
4
|
# Error indicating a recursion overflow error in task selection.
|
@@ -13,7 +13,7 @@ module Rake
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def message
|
16
|
-
super + ": [" + @targets.reverse.join(
|
16
|
+
super + ": [" + @targets.reverse.join(" => ") + "]"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
data/lib/rake/scope.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Rake
|
2
3
|
class Scope < LinkedList # :nodoc: all
|
3
4
|
|
4
5
|
# Path for the scope.
|
5
6
|
def path
|
6
|
-
map
|
7
|
+
map(&:to_s).reverse.join(":")
|
7
8
|
end
|
8
9
|
|
9
10
|
# Path for the scope + the named path.
|
@@ -15,7 +16,7 @@ module Rake
|
|
15
16
|
# this trim beyond the toplevel scope.
|
16
17
|
def trim(n)
|
17
18
|
result = self
|
18
|
-
while n > 0 && !
|
19
|
+
while n > 0 && !result.empty?
|
19
20
|
result = result.tail
|
20
21
|
n -= 1
|
21
22
|
end
|
data/lib/rake/task.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "rake/invocation_exception_mixin"
|
2
3
|
|
3
4
|
module Rake
|
4
5
|
|
@@ -14,6 +15,10 @@ module Rake
|
|
14
15
|
class Task
|
15
16
|
# List of prerequisites for a task.
|
16
17
|
attr_reader :prerequisites
|
18
|
+
alias prereqs prerequisites
|
19
|
+
|
20
|
+
# List of order only prerequisites for a task.
|
21
|
+
attr_reader :order_only_prerequisites
|
17
22
|
|
18
23
|
# List of actions attached to a task.
|
19
24
|
attr_reader :actions
|
@@ -29,6 +34,10 @@ module Rake
|
|
29
34
|
# location option set).
|
30
35
|
attr_reader :locations
|
31
36
|
|
37
|
+
# Has this task already been invoked? Already invoked tasks
|
38
|
+
# will be skipped unless you reenable them.
|
39
|
+
attr_reader :already_invoked
|
40
|
+
|
32
41
|
# Return task name
|
33
42
|
def to_s
|
34
43
|
name
|
@@ -50,11 +59,15 @@ module Rake
|
|
50
59
|
|
51
60
|
# List of prerequisite tasks
|
52
61
|
def prerequisite_tasks
|
53
|
-
prerequisites.map { |pre| lookup_prerequisite(pre) }
|
62
|
+
(prerequisites + order_only_prerequisites).map { |pre| lookup_prerequisite(pre) }
|
54
63
|
end
|
55
64
|
|
56
65
|
def lookup_prerequisite(prerequisite_name) # :nodoc:
|
57
|
-
application[prerequisite_name, @scope]
|
66
|
+
scoped_prerequisite_task = application[prerequisite_name, @scope]
|
67
|
+
if scoped_prerequisite_task == self
|
68
|
+
unscoped_prerequisite_task = application[prerequisite_name]
|
69
|
+
end
|
70
|
+
unscoped_prerequisite_task || scoped_prerequisite_task
|
58
71
|
end
|
59
72
|
private :lookup_prerequisite
|
60
73
|
|
@@ -94,6 +107,8 @@ module Rake
|
|
94
107
|
@scope = app.current_scope
|
95
108
|
@arg_names = nil
|
96
109
|
@locations = []
|
110
|
+
@invocation_exception = nil
|
111
|
+
@order_only_prerequisites = []
|
97
112
|
end
|
98
113
|
|
99
114
|
# Enhance a task with prerequisites or actions. Returns self.
|
@@ -131,13 +146,15 @@ module Rake
|
|
131
146
|
# is invoked again.
|
132
147
|
def reenable
|
133
148
|
@already_invoked = false
|
149
|
+
@invocation_exception = nil
|
134
150
|
end
|
135
151
|
|
136
|
-
# Clear the existing prerequisites and
|
152
|
+
# Clear the existing prerequisites, actions, comments, and arguments of a rake task.
|
137
153
|
def clear
|
138
154
|
clear_prerequisites
|
139
155
|
clear_actions
|
140
156
|
clear_comments
|
157
|
+
clear_args
|
141
158
|
self
|
142
159
|
end
|
143
160
|
|
@@ -159,6 +176,12 @@ module Rake
|
|
159
176
|
self
|
160
177
|
end
|
161
178
|
|
179
|
+
# Clear the existing arguments on a rake task.
|
180
|
+
def clear_args
|
181
|
+
@arg_names = nil
|
182
|
+
self
|
183
|
+
end
|
184
|
+
|
162
185
|
# Invoke the task if it is needed. Prerequisites are invoked first.
|
163
186
|
def invoke(*args)
|
164
187
|
task_args = TaskArguments.new(arg_names, args)
|
@@ -167,20 +190,39 @@ module Rake
|
|
167
190
|
|
168
191
|
# Same as invoke, but explicitly pass a call chain to detect
|
169
192
|
# circular dependencies.
|
170
|
-
|
171
|
-
|
193
|
+
#
|
194
|
+
# If multiple tasks depend on this
|
195
|
+
# one in parallel, they will all fail if the first execution of
|
196
|
+
# this task fails.
|
197
|
+
def invoke_with_call_chain(task_args, invocation_chain)
|
198
|
+
new_chain = Rake::InvocationChain.append(self, invocation_chain)
|
172
199
|
@lock.synchronize do
|
173
|
-
|
174
|
-
application.trace
|
200
|
+
begin
|
201
|
+
if application.options.trace
|
202
|
+
application.trace "** Invoke #{name} #{format_trace_flags}"
|
203
|
+
end
|
204
|
+
|
205
|
+
if @already_invoked
|
206
|
+
if @invocation_exception
|
207
|
+
if application.options.trace
|
208
|
+
application.trace "** Previous invocation of #{name} failed #{format_trace_flags}"
|
209
|
+
end
|
210
|
+
raise @invocation_exception
|
211
|
+
else
|
212
|
+
return
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
@already_invoked = true
|
217
|
+
|
218
|
+
invoke_prerequisites(task_args, new_chain)
|
219
|
+
execute(task_args) if needed?
|
220
|
+
rescue Exception => ex
|
221
|
+
add_chain_to(ex, new_chain)
|
222
|
+
@invocation_exception = ex
|
223
|
+
raise ex
|
175
224
|
end
|
176
|
-
return if @already_invoked
|
177
|
-
@already_invoked = true
|
178
|
-
invoke_prerequisites(task_args, new_chain)
|
179
|
-
execute(task_args) if needed?
|
180
225
|
end
|
181
|
-
rescue Exception => ex
|
182
|
-
add_chain_to(ex, new_chain)
|
183
|
-
raise ex
|
184
226
|
end
|
185
227
|
protected :invoke_with_call_chain
|
186
228
|
|
@@ -211,7 +253,8 @@ module Rake
|
|
211
253
|
r.invoke_with_call_chain(prereq_args, invocation_chain)
|
212
254
|
end
|
213
255
|
end
|
214
|
-
|
256
|
+
# Iterate in reverse to improve performance related to thread waiting and switching
|
257
|
+
futures.reverse_each(&:value)
|
215
258
|
end
|
216
259
|
|
217
260
|
# Format the trace flags for display.
|
@@ -232,13 +275,10 @@ module Rake
|
|
232
275
|
end
|
233
276
|
application.trace "** Execute #{name}" if application.options.trace
|
234
277
|
application.enhance_with_matching_rule(name) if @actions.empty?
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
else
|
240
|
-
act.call(self, args)
|
241
|
-
end
|
278
|
+
if opts = Hash.try_convert(args) and !opts.empty?
|
279
|
+
@actions.each { |act| act.call(self, args, **opts)}
|
280
|
+
else
|
281
|
+
@actions.each { |act| act.call(self, args)}
|
242
282
|
end
|
243
283
|
end
|
244
284
|
|
@@ -258,7 +298,7 @@ module Rake
|
|
258
298
|
def add_description(description)
|
259
299
|
return unless description
|
260
300
|
comment = description.strip
|
261
|
-
add_comment(comment) if comment && !
|
301
|
+
add_comment(comment) if comment && !comment.empty?
|
262
302
|
end
|
263
303
|
|
264
304
|
def comment=(comment) # :nodoc:
|
@@ -296,23 +336,23 @@ module Rake
|
|
296
336
|
private :transform_comments
|
297
337
|
|
298
338
|
# Get the first sentence in a string. The sentence is terminated
|
299
|
-
# by the first period or the end of the line.
|
300
|
-
# not count as periods.
|
339
|
+
# by the first period, exclamation mark, or the end of the line.
|
340
|
+
# Decimal points do not count as periods.
|
301
341
|
def first_sentence(string)
|
302
|
-
string.split(
|
342
|
+
string.split(/(?<=\w)(\.|!)[ \t]|(\.$|!)|\n/).first
|
303
343
|
end
|
304
344
|
private :first_sentence
|
305
345
|
|
306
346
|
# Set the names of the arguments for this task. +args+ should be
|
307
347
|
# an array of symbols, one for each argument name.
|
308
348
|
def set_arg_names(args)
|
309
|
-
@arg_names = args.map
|
349
|
+
@arg_names = args.map(&:to_sym)
|
310
350
|
end
|
311
351
|
|
312
352
|
# Return a string describing the internal state of a task. Useful for
|
313
353
|
# debugging.
|
314
354
|
def investigation
|
315
|
-
result = "------------------------------\n"
|
355
|
+
result = "------------------------------\n".dup
|
316
356
|
result << "Investigating #{name}\n"
|
317
357
|
result << "class: #{self.class}\n"
|
318
358
|
result << "task needed: #{needed?}\n"
|
@@ -323,12 +363,24 @@ module Rake
|
|
323
363
|
prereqs.each do |p|
|
324
364
|
result << "--#{p.name} (#{p.timestamp})\n"
|
325
365
|
end
|
326
|
-
latest_prereq = prerequisite_tasks.map
|
366
|
+
latest_prereq = prerequisite_tasks.map(&:timestamp).max
|
327
367
|
result << "latest-prerequisite time: #{latest_prereq}\n"
|
328
368
|
result << "................................\n\n"
|
329
369
|
return result
|
330
370
|
end
|
331
371
|
|
372
|
+
# Format dependencies parameter to pass to task.
|
373
|
+
def self.format_deps(deps)
|
374
|
+
deps = [deps] unless deps.respond_to?(:to_ary)
|
375
|
+
deps.map { |d| Rake.from_pathname(d).to_s }
|
376
|
+
end
|
377
|
+
|
378
|
+
# Add order only dependencies.
|
379
|
+
def |(deps)
|
380
|
+
@order_only_prerequisites |= Task.format_deps(deps) - @prerequisites
|
381
|
+
self
|
382
|
+
end
|
383
|
+
|
332
384
|
# ----------------------------------------------------------------
|
333
385
|
# Rake Module Methods
|
334
386
|
#
|
@@ -374,7 +426,6 @@ module Rake
|
|
374
426
|
# this kind of task. Generic tasks will accept the scope as
|
375
427
|
# part of the name.
|
376
428
|
def scope_name(scope, task_name)
|
377
|
-
# (scope + [task_name]).join(':')
|
378
429
|
scope.path_with_task_name(task_name)
|
379
430
|
end
|
380
431
|
|