Sha256: 6a4cf43cd980620e6a769ee0e6eafee60aab6bbc112d2afd5d2881fa926fa728

Contents?: true

Size: 850 Bytes

Versions: 10

Compression:

Stored size: 850 Bytes

Contents

desc "show a todolist from all the TODO tags in the source"
task :todo do
  files = Dir[File.join(BASEDIR, '{lib,spec}', '**/*.rb')]

  files.each 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/ 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

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.04.08 tasks/todo.rake
manveru-ramaze-2009.04.01 tasks/todo.rake
manveru-ramaze-2009.04.08 tasks/todo.rake
manveru-ramaze-2009.04.18 tasks/todo.rake
manveru-ramaze-2009.04.22 tasks/todo.rake
manveru-ramaze-2009.04 tasks/todo.rake
manveru-ramaze-2009.05.08 tasks/todo.rake
manveru-ramaze-2009.05 tasks/todo.rake
ramaze-2009.05 tasks/todo.rake
ramaze-2009.04 tasks/todo.rake