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 CHANGED
@@ -3,6 +3,4 @@
3
3
  require 'rubygems'
4
4
  require 'rubytodo'
5
5
 
6
- root = ARGV[0] || "."
7
-
8
- RubyTodo.list :root => root
6
+ RubyTodo.list ARGV[0] || "."
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 options
6
- root = options[:root]
7
- puts "Scanning todos in #{root} ..."
8
- files = Dir.glob File.join(root, "**", "*")
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
- ptree = RubyParser.new.parse File.open(file_path, 'r').read
22
+ parser = RubyParser.new
23
+ ptree = parser.parse File.open(file_path, 'r').read
18
24
  extract_todos ptree
19
25
  end
20
26
 
@@ -1,3 +1,3 @@
1
1
  module RubyTodo
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubytodo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: