summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Davis <ryand@zenspider.com>2009-06-17 14:52:41 -0800
committerRyan Davis <ryand@zenspider.com>2009-06-17 14:52:41 -0800
commitc43d09fad2c3eba94a942a3d25a7ce5b48c504fc (patch)
tree18e36c77204945c03f560e6ab736ee2b09a54a20
parentd0595d66ce51a649d85bc97843a555b18d3d5500 (diff)
downloadhoe-c43d09fad2c3eba94a942a3d25a7ce5b48c504fc.tar.gz
+ Alter task descriptions to say what plugin they come from. jbarnette
[git-p4: depot-paths = "//src/hoe/dev/": change = 5062]
-rw-r--r--lib/hoe.rb21
1 files changed, 21 insertions, 0 deletions
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