rubytodo 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rubytodo +1 -3
- data/lib/rubytodo.rb +11 -5
- data/lib/rubytodo/version.rb +1 -1
- metadata +1 -1
data/bin/rubytodo
CHANGED
data/lib/rubytodo.rb
CHANGED
@@ -2,10 +2,15 @@ require 'object'
|
|
2
2
|
require 'ruby_parser'
|
3
3
|
|
4
4
|
class RubyTodo
|
5
|
-
def self.list
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
def self.list target
|
6
|
+
files = if File.file? target
|
7
|
+
[target]
|
8
|
+
elsif File.directory? target
|
9
|
+
puts "Scanning todos in #{target} ..."
|
10
|
+
files = Dir.glob File.join(target, "**", "*")
|
11
|
+
else
|
12
|
+
abort "#{target} does not exist."
|
13
|
+
end
|
9
14
|
files.reject { |f| f !~ /\.rb\Z/ }.each do |f|
|
10
15
|
todos = scan_todos f
|
11
16
|
puts f unless todos.nil? || todos.empty?
|
@@ -14,7 +19,8 @@ class RubyTodo
|
|
14
19
|
end
|
15
20
|
|
16
21
|
def self.scan_todos file_path
|
17
|
-
|
22
|
+
parser = RubyParser.new
|
23
|
+
ptree = parser.parse File.open(file_path, 'r').read
|
18
24
|
extract_todos ptree
|
19
25
|
end
|
20
26
|
|
data/lib/rubytodo/version.rb
CHANGED