From c43d09fad2c3eba94a942a3d25a7ce5b48c504fc Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Wed, 17 Jun 2009 14:52:41 -0800 Subject: + Alter task descriptions to say what plugin they come from. jbarnette [git-p4: depot-paths = "//src/hoe/dev/": change = 5062] --- lib/hoe.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/hoe.rb b/lib/hoe.rb index 211368c..e5bbb73 100644 --- a/lib/hoe.rb +++ b/lib/hoe.rb @@ -452,13 +452,24 @@ class Hoe def load_plugin_tasks bad = [] + + $plugin_max = self.class.plugins.map { |s| s.to_s.size }.max + self.class.plugins.each do |plugin| warn plugin if $DEBUG + + old_tasks = Rake::Task.tasks.dup + begin send "define_#{plugin}_tasks" rescue NoMethodError => e warn "warning: couldn't activate the #{plugin} plugin, skipping" bad << plugin + next + end + + (Rake::Task.tasks - old_tasks).each do |task| + task.plugin = plugin # "%-#{max}s" % plugin end end @@plugins -= bad @@ -549,3 +560,13 @@ class File File.read(path).sub(/\A\xEF\xBB\xBF/, '') end end + +module Rake + class Task + attr_accessor :plugin + alias :old_comment :comment + def comment + "%-#{$plugin_max}s # %s" % [plugin, old_comment] if old_comment + end + end +end -- cgit v1.2.1