class Never

TODO: tests TODO: support for local .todoignore TODO: support for –help –version with Thor, move never status TODO: caching TODO: only search comments TODO: group todos per file TODO: support for global .todoignore

Public Class Methods

execute() click to toggle source
# File lib/never.rb, line 11
def self.execute

        items = []

        Dir.glob('**/*') do | filename |
                next if filename == '.' or filename == '..' or !!(/^tmp/ =~ filename)
                if File.file?(filename)
                        File.open(filename, 'r') do |file|
                          file.each_with_index do |line, index|
                            line = line.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
                            matches = line.match(/(TODO:*)(.+)/)
                            unless (matches.nil?)
                                    items.push "- #{matches[2].strip.capitalize} (#{filename}:#{index})"
                            end
                          end
                        end
                end
        end

        items.join("\n")

end