Class: Never

Inherits:
Object
  • Object
show all
Defined in:
lib/never.rb

Overview

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

Class Method Summary collapse

Class Method Details

.executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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