Sha256: aad31050df9922bdb5ed8a0547d3569818b0288887f8f3227dab418e855b37bb

Contents?: true

Size: 897 Bytes

Versions: 8

Compression:

Stored size: 897 Bytes

Contents

desc "show a todolist from all the TODO tags in the source"
task :todo do
  yellow = "\e[33m%s\e[0m"

  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 yellow % "#{file}#L#{lineno}"
        end

        l = line.strip.gsub(/^#\s*/, '')
        print '  ' unless l =~ /^-/
        puts l
        lastline = lineno
      end
    end # File.readlines
  end
end # task :todo

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ramaze-2023.01.06 tasks/todo.rake
ramaze-2012.12.08 tasks/todo.rake
ramaze-2012.12.08b tasks/todo.rake
ramaze-2012.04.14 tasks/todo.rake
ramaze-2012.03.07 tasks/todo.rake
ramaze-2011.12.28 tasks/todo.rake
ramaze-2011.10.23 tasks/todo.rake
ramaze-2011.07.25 tasks/todo.rake