Signed-off-by: James Turnbull <[email protected]>
---
 tasks/rake/todo.rake |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 tasks/rake/todo.rake

diff --git a/tasks/rake/todo.rake b/tasks/rake/todo.rake
new file mode 100644
index 0000000..f190e5d
--- /dev/null
+++ b/tasks/rake/todo.rake
@@ -0,0 +1,30 @@
+desc "show a todolist from all the TODO tags in the source"
+task :todo do
+  Dir.glob('{lib,spec}/**/*.rb') do |file|
+    lastline = todo = comment = long_comment = false
+ 
+    File.readlines(file).each_with_index do |line, lineno|
+      lineno += 1
+      comment = line =~ /^\s*?#.*?$/
+      long_comment = line =~ /^=begin/
+      long_comment = line =~ /^=end/
+      todo = true if line =~ /TODO|FIXME|THINK/ and (long_comment or comment)
+      todo = false if line.gsub('#', '').strip.empty?
+      todo = false unless comment or long_comment
+      if todo
+        unless lastline and lastline + 1 == lineno
+          puts
+          puts "vim #{file} +#{lineno}"
+        end
+ 
+        l = line.strip.gsub(/^#\s*/, '')
+        print ' ' unless l =~ /^-/
+        puts l
+        lastline = lineno
+      end
+    end
+  end
+end
+ 
+
+
-- 
1.6.0.6


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to