diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-15 03:07:37 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-15 03:07:37 +0000 |
commit | 6361928083d01906ab9d8782b6533b4ed7c834a0 (patch) | |
tree | 172488be8a74c9313d35b9cd7d53999cd55f561d /lib/rake/task.rb | |
parent | 031e1570b934d6b3a1e17ae8eb78a44dac8186d3 (diff) | |
download | ruby-6361928083d01906ab9d8782b6533b4ed7c834a0.tar.gz |
* lib/rake.rb, lib/rake/*.rb: Upgrade to rake-10.3.2
[fix GH-668]
* test/rake/*.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rake/task.rb')
-rw-r--r-- | lib/rake/task.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/rake/task.rb b/lib/rake/task.rb index 5e4dd64d4e..9bcf725523 100644 --- a/lib/rake/task.rb +++ b/lib/rake/task.rb @@ -2,7 +2,7 @@ require 'rake/invocation_exception_mixin' module Rake - # ######################################################################### + ## # A Task is the basic unit of work in a Rakefile. Tasks have associated # actions (possibly more than one) and a list of prerequisites. When # invoked, a task will first ensure that all of its prerequisites have an @@ -34,14 +34,18 @@ module Rake name end - def inspect + def inspect # :nodoc: "<#{self.class} #{name} => [#{prerequisites.join(', ')}]>" end # List of sources for task. attr_writer :sources def sources - @sources ||= [] + if defined?(@sources) + @sources + else + prerequisites + end end # List of prerequisite tasks @@ -49,7 +53,7 @@ module Rake prerequisites.map { |pre| lookup_prerequisite(pre) } end - def lookup_prerequisite(prerequisite_name) + def lookup_prerequisite(prerequisite_name) # :nodoc: application[prerequisite_name, @scope] end private :lookup_prerequisite @@ -63,7 +67,7 @@ module Rake seen.values end - def collect_prerequisites(seen) + def collect_prerequisites(seen) # :nodoc: prerequisite_tasks.each do |pre| next if seen[pre.name] seen[pre.name] = pre @@ -74,7 +78,7 @@ module Rake # First source from a rule (nil if no sources) def source - @sources.first if defined?(@sources) + sources.first end # Create a task named +task_name+ with no actions or prerequisites. Use @@ -180,7 +184,7 @@ module Rake end protected :invoke_with_call_chain - def add_chain_to(exception, new_chain) + def add_chain_to(exception, new_chain) # :nodoc: exception.extend(InvocationExceptionMixin) unless exception.respond_to?(:chain) exception.chain = new_chain if exception.chain.nil? @@ -257,11 +261,12 @@ module Rake add_comment(comment) if comment && ! comment.empty? end - def comment=(comment) + def comment=(comment) # :nodoc: add_comment(comment) end - def add_comment(comment) + def add_comment(comment) # :nodoc: + return if comment.nil? @comments << comment unless @comments.include?(comment) end private :add_comment |