Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switch to hash for recording already seen tasks in all_prerequisite_t…

…asks.
  • Loading branch information...
commit a3e9a02ae67cf1e55b29afc63fec2615198c08d5 1 parent b282318
Jim Weirich authored
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/rake/task.rb
11 lib/rake/task.rb
View
@@ -65,14 +65,17 @@ def lookup_prerequisite(prerequisite_name)
# prerequisites.
# Includes self when cyclic dependencies are found.
def all_prerequisite_tasks
- fetch_prerequisites
+ seen = {}
+ collect_prerequisites(seen)
+ seen.values
end
- def fetch_prerequisites(list=[])
+ def collect_prerequisites(seen)
prerequisite_tasks.each do |pre|
- list << pre and pre.fetch_prerequisites(list) unless list.include?(pre)
+ next if seen[pre.name]
+ seen[pre.name] = pre
+ pre.collect_prerequisites(seen)
end
- list
end
protected :fetch_prerequisites
Please sign in to comment.
Something went wrong with that request. Please try again.