rake 10.4.2 → 13.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +5 -5
  2. data/CONTRIBUTING.rdoc +16 -7
  3. data/Gemfile +10 -0
  4. data/History.rdoc +2022 -287
  5. data/README.rdoc +40 -25
  6. data/Rakefile +25 -65
  7. data/bin/bundle +105 -0
  8. data/bin/console +7 -0
  9. data/bin/rake +20 -24
  10. data/bin/rdoc +29 -0
  11. data/bin/rubocop +29 -0
  12. data/bin/setup +6 -0
  13. data/doc/glossary.rdoc +10 -11
  14. data/doc/jamis.rb +1 -0
  15. data/doc/rake.1 +139 -124
  16. data/doc/rakefile.rdoc +2 -33
  17. data/exe/rake +27 -0
  18. data/lib/rake.rb +35 -43
  19. data/lib/rake/application.rb +125 -91
  20. data/lib/rake/backtrace.rb +3 -2
  21. data/lib/rake/clean.rb +8 -6
  22. data/lib/rake/cloneable.rb +1 -0
  23. data/lib/rake/cpu_counter.rb +10 -28
  24. data/lib/rake/default_loader.rb +1 -0
  25. data/lib/rake/dsl_definition.rb +6 -12
  26. data/lib/rake/early_time.rb +1 -0
  27. data/lib/rake/ext/core.rb +1 -0
  28. data/lib/rake/ext/string.rb +24 -21
  29. data/lib/rake/file_creation_task.rb +4 -3
  30. data/lib/rake/file_list.rb +35 -28
  31. data/lib/rake/file_task.rb +12 -4
  32. data/lib/rake/file_utils.rb +38 -32
  33. data/lib/rake/file_utils_ext.rb +8 -18
  34. data/lib/rake/invocation_chain.rb +1 -0
  35. data/lib/rake/invocation_exception_mixin.rb +1 -0
  36. data/lib/rake/late_time.rb +2 -1
  37. data/lib/rake/linked_list.rb +24 -15
  38. data/lib/rake/loaders/makefile.rb +23 -9
  39. data/lib/rake/multi_task.rb +2 -1
  40. data/lib/rake/name_space.rb +1 -1
  41. data/lib/rake/packagetask.rb +40 -17
  42. data/lib/rake/phony.rb +2 -1
  43. data/lib/rake/private_reader.rb +1 -0
  44. data/lib/rake/promise.rb +13 -12
  45. data/lib/rake/pseudo_status.rb +1 -0
  46. data/lib/rake/rake_module.rb +30 -1
  47. data/lib/rake/rake_test_loader.rb +18 -13
  48. data/lib/rake/rule_recursion_overflow_error.rb +2 -2
  49. data/lib/rake/scope.rb +3 -2
  50. data/lib/rake/task.rb +82 -31
  51. data/lib/rake/task_argument_error.rb +1 -0
  52. data/lib/rake/task_arguments.rb +15 -4
  53. data/lib/rake/task_manager.rb +54 -33
  54. data/lib/rake/tasklib.rb +2 -14
  55. data/lib/rake/testtask.rb +40 -63
  56. data/lib/rake/thread_history_display.rb +4 -3
  57. data/lib/rake/thread_pool.rb +16 -17
  58. data/lib/rake/trace_output.rb +2 -1
  59. data/lib/rake/version.rb +4 -1
  60. data/lib/rake/win32.rb +10 -15
  61. data/rake.gemspec +43 -0
  62. metadata +33 -270
  63. data/.autotest +0 -7
  64. data/.gemtest +0 -0
  65. data/.rubocop.yml +0 -27
  66. data/.togglerc +0 -7
  67. data/Manifest.txt +0 -166
  68. data/doc/release_notes/rake-0.4.14.rdoc +0 -23
  69. data/doc/release_notes/rake-0.4.15.rdoc +0 -35
  70. data/doc/release_notes/rake-0.5.0.rdoc +0 -53
  71. data/doc/release_notes/rake-0.5.3.rdoc +0 -78
  72. data/doc/release_notes/rake-0.5.4.rdoc +0 -46
  73. data/doc/release_notes/rake-0.6.0.rdoc +0 -141
  74. data/doc/release_notes/rake-0.7.0.rdoc +0 -119
  75. data/doc/release_notes/rake-0.7.1.rdoc +0 -59
  76. data/doc/release_notes/rake-0.7.2.rdoc +0 -121
  77. data/doc/release_notes/rake-0.7.3.rdoc +0 -47
  78. data/doc/release_notes/rake-0.8.0.rdoc +0 -114
  79. data/doc/release_notes/rake-0.8.2.rdoc +0 -165
  80. data/doc/release_notes/rake-0.8.3.rdoc +0 -112
  81. data/doc/release_notes/rake-0.8.4.rdoc +0 -147
  82. data/doc/release_notes/rake-0.8.5.rdoc +0 -53
  83. data/doc/release_notes/rake-0.8.6.rdoc +0 -37
  84. data/doc/release_notes/rake-0.8.7.rdoc +0 -55
  85. data/doc/release_notes/rake-0.9.0.rdoc +0 -112
  86. data/doc/release_notes/rake-0.9.1.rdoc +0 -52
  87. data/doc/release_notes/rake-0.9.2.2.rdoc +0 -55
  88. data/doc/release_notes/rake-0.9.2.rdoc +0 -49
  89. data/doc/release_notes/rake-0.9.3.rdoc +0 -102
  90. data/doc/release_notes/rake-0.9.4.rdoc +0 -60
  91. data/doc/release_notes/rake-0.9.5.rdoc +0 -55
  92. data/doc/release_notes/rake-0.9.6.rdoc +0 -64
  93. data/doc/release_notes/rake-10.0.0.rdoc +0 -178
  94. data/doc/release_notes/rake-10.0.1.rdoc +0 -58
  95. data/doc/release_notes/rake-10.0.2.rdoc +0 -53
  96. data/doc/release_notes/rake-10.0.3.rdoc +0 -191
  97. data/doc/release_notes/rake-10.1.0.rdoc +0 -61
  98. data/lib/rake/alt_system.rb +0 -110
  99. data/lib/rake/contrib/.document +0 -1
  100. data/lib/rake/contrib/compositepublisher.rb +0 -21
  101. data/lib/rake/contrib/ftptools.rb +0 -137
  102. data/lib/rake/contrib/publisher.rb +0 -81
  103. data/lib/rake/contrib/rubyforgepublisher.rb +0 -18
  104. data/lib/rake/contrib/sshpublisher.rb +0 -61
  105. data/lib/rake/contrib/sys.rb +0 -4
  106. data/lib/rake/ext/module.rb +0 -2
  107. data/lib/rake/ext/pathname.rb +0 -25
  108. data/lib/rake/ext/time.rb +0 -16
  109. data/lib/rake/gempackagetask.rb +0 -4
  110. data/lib/rake/pathmap.rb +0 -3
  111. data/lib/rake/rdoctask.rb +0 -4
  112. data/lib/rake/ruby182_test_unit_fix.rb +0 -29
  113. data/lib/rake/runtest.rb +0 -27
  114. data/rakelib/publish.rake +0 -20
  115. data/rakelib/test_times.rake +0 -25
  116. data/test/file_creation.rb +0 -34
  117. data/test/helper.rb +0 -130
  118. data/test/support/rakefile_definitions.rb +0 -478
  119. data/test/support/ruby_runner.rb +0 -34
  120. data/test/test_private_reader.rb +0 -42
  121. data/test/test_rake.rb +0 -40
  122. data/test/test_rake_application.rb +0 -643
  123. data/test/test_rake_application_options.rb +0 -466
  124. data/test/test_rake_backtrace.rb +0 -119
  125. data/test/test_rake_clean.rb +0 -61
  126. data/test/test_rake_cpu_counter.rb +0 -68
  127. data/test/test_rake_definitions.rb +0 -84
  128. data/test/test_rake_directory_task.rb +0 -76
  129. data/test/test_rake_dsl.rb +0 -40
  130. data/test/test_rake_early_time.rb +0 -31
  131. data/test/test_rake_extension.rb +0 -59
  132. data/test/test_rake_file_creation_task.rb +0 -56
  133. data/test/test_rake_file_list.rb +0 -655
  134. data/test/test_rake_file_list_path_map.rb +0 -8
  135. data/test/test_rake_file_task.rb +0 -197
  136. data/test/test_rake_file_utils.rb +0 -309
  137. data/test/test_rake_ftp_file.rb +0 -74
  138. data/test/test_rake_functional.rb +0 -482
  139. data/test/test_rake_invocation_chain.rb +0 -64
  140. data/test/test_rake_late_time.rb +0 -18
  141. data/test/test_rake_linked_list.rb +0 -84
  142. data/test/test_rake_makefile_loader.rb +0 -46
  143. data/test/test_rake_multi_task.rb +0 -64
  144. data/test/test_rake_name_space.rb +0 -57
  145. data/test/test_rake_package_task.rb +0 -79
  146. data/test/test_rake_path_map.rb +0 -168
  147. data/test/test_rake_path_map_explode.rb +0 -34
  148. data/test/test_rake_path_map_partial.rb +0 -18
  149. data/test/test_rake_pathname_extensions.rb +0 -15
  150. data/test/test_rake_pseudo_status.rb +0 -21
  151. data/test/test_rake_rake_test_loader.rb +0 -20
  152. data/test/test_rake_reduce_compat.rb +0 -26
  153. data/test/test_rake_require.rb +0 -40
  154. data/test/test_rake_rules.rb +0 -388
  155. data/test/test_rake_scope.rb +0 -44
  156. data/test/test_rake_task.rb +0 -393
  157. data/test/test_rake_task_argument_parsing.rb +0 -119
  158. data/test/test_rake_task_arguments.rb +0 -127
  159. data/test/test_rake_task_lib.rb +0 -9
  160. data/test/test_rake_task_manager.rb +0 -178
  161. data/test/test_rake_task_manager_argument_resolution.rb +0 -19
  162. data/test/test_rake_task_with_arguments.rb +0 -172
  163. data/test/test_rake_test_task.rb +0 -146
  164. data/test/test_rake_thread_pool.rb +0 -145
  165. data/test/test_rake_top_level_functions.rb +0 -71
  166. data/test/test_rake_win32.rb +0 -72
  167. data/test/test_thread_history_display.rb +0 -101
  168. 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 'rake'
8
+ require "rake"
8
9
 
9
10
  task :phony
10
11
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Rake
2
3
 
3
4
  # Include PrivateReader to use +private_reader+.
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, :item_id => object_id
31
+ stat :sleeping_on, item_id: object_id
31
32
  @mutex.synchronize do
32
- stat :has_lock_on, :item_id => object_id
33
+ stat :has_lock_on, item_id: object_id
33
34
  chore
34
- stat :releasing_lock_on, :item_id => object_id
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, :item_id => object_id
43
+ stat :attempting_lock_on, item_id: object_id
43
44
  if @mutex.try_lock
44
- stat :has_lock_on, :item_id => object_id
45
+ stat :has_lock_on, item_id: object_id
45
46
  chore
46
- stat :releasing_lock_on, :item_id => object_id
47
+ stat :releasing_lock_on, item_id: object_id
47
48
  @mutex.unlock
48
49
  else
49
- stat :bailed_on, :item_id => object_id
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, :item_id => object_id
59
+ stat :found_completed, item_id: object_id
59
60
  return
60
61
  end
61
- stat :will_execute, :item_id => object_id
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, :item_id => object_id
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
- ! @result.equal?(NOT_SET)
74
+ !@result.equal?(NOT_SET)
74
75
  end
75
76
 
76
77
  # Did the promise throw an error
77
78
  def error?
78
- ! @error.equal?(NOT_SET)
79
+ !@error.equal?(NOT_SET)
79
80
  end
80
81
 
81
82
  # Are we done with the promise
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Rake
2
3
 
3
4
  ##
@@ -1,4 +1,5 @@
1
- require 'rake/application'
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
- require 'rake'
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
- case argument
6
- when /^-/ then
7
- argument
8
- when /\*/ then
9
- FileList[argument].to_a.each do |file|
10
- require File.expand_path file
11
- end
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
- false
14
- else
15
- require File.expand_path argument
15
+ false
16
+ else
17
+ require File.expand_path argument
16
18
 
17
- false
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 { |item| item.to_s }.reverse.join(":")
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 && ! result.empty?
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
- require 'rake/invocation_exception_mixin'
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 actions of a rake task.
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
- def invoke_with_call_chain(task_args, invocation_chain) # :nodoc:
171
- new_chain = InvocationChain.append(self, invocation_chain)
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
- if application.options.trace
174
- application.trace "** Invoke #{name} #{format_trace_flags}"
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
- futures.each { |f| f.value }
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
- @actions.each do |act|
236
- case act.arity
237
- when 1
238
- act.call(self)
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 && ! comment.empty?
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. Decimal points do
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(/\.[ \t]|\.$|\n/).first
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 { |a| a.to_sym }
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 { |pre| pre.timestamp }.max
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