lib/glyptodont/todo_researcher.rb in glyptodont-0.2.0 vs lib/glyptodont/todo_researcher.rb in glyptodont-0.3.0
- old
+ new
@@ -4,38 +4,30 @@
require "rugged"
module Glyptodont
# Finds all the TODOs in a directory managed by Git, who last touched them and when.
class TodoResearcher
- def initialize(directory, ignore)
+ def initialize(directory, ignore, keywords)
@directory = directory
@ignore = ignore
+ @keywords = Array(keywords)
@annotator = {}
end
def research
annotate(exclude_ignored(extract_details(git.grep(keyword_rexexp))))
end
private
- attr_reader :directory, :ignore
+ attr_reader :directory, :ignore, :keywords
def git
Git.open(directory)
end
def keyword_rexexp
"\\b\\(#{keywords.join('\|')}\\)\\b"
- end
-
- def keywords
- %w[
- FIXME
- HACK
- TODO
- XXX
- ]
end
def extract_details(todos)
todos.flat_map do |sha, matches|
file = sha.split(":", 2).last