Todo 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/todo +90 -0
- data/etc/ToDo.xml +6 -0
- data/lib/version.rb +3 -0
- metadata +48 -0
data/bin/todo
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "hpricot"
|
4
|
+
|
5
|
+
def LoadConf(file)
|
6
|
+
f = File.read(file)
|
7
|
+
|
8
|
+
doc = Hpricot(f)
|
9
|
+
conf = {}
|
10
|
+
(doc/:syntax).each do |elem|
|
11
|
+
(elem/:language).last.attributes["extentions"].split(",").each do |x|
|
12
|
+
conf[x] = Regexp.new((elem/:regex).last.innerText)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
return conf
|
16
|
+
end
|
17
|
+
require "getopt/long"
|
18
|
+
include Getopt
|
19
|
+
|
20
|
+
opt = Long.getopts(
|
21
|
+
["--mode", "-m", REQUIRED],
|
22
|
+
["--dir", "-d", REQUIRED]
|
23
|
+
)
|
24
|
+
|
25
|
+
if opt["m"]
|
26
|
+
case opt["m"]
|
27
|
+
when /file/i
|
28
|
+
mode = 0
|
29
|
+
when /checklist/i
|
30
|
+
mode = 1
|
31
|
+
else
|
32
|
+
puts "Unknown mode: `#{opt["m"]}'"
|
33
|
+
exit
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
if opt["d"]
|
38
|
+
begin
|
39
|
+
Dir.chdir(opt["d"])
|
40
|
+
rescue
|
41
|
+
puts "Cannot change directories to: `#{File.expand_path(opt["d"])}'"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def file_mode
|
46
|
+
Dir.entries(?.).each do |x|
|
47
|
+
next unless File.file? x
|
48
|
+
txt = File.read x
|
49
|
+
next if COMMENT_STRINGS[File.extname(x)[1..-1]] == nil
|
50
|
+
mtc = txt.scan COMMENT_STRINGS[File.extname(x)[1..-1]]
|
51
|
+
mtc.each do |y|
|
52
|
+
puts "* " + x + ":\t" + y.first
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
def checklist()
|
57
|
+
unless Dir.entries(?.).grep(/^.*\.2do$/)
|
58
|
+
puts "No todo file found in the directory"
|
59
|
+
exit
|
60
|
+
end
|
61
|
+
todos = Dir.entries(?.).grep(/^.*\.2do$/)
|
62
|
+
todos.each do |todo|
|
63
|
+
text = File.read(todo)
|
64
|
+
text.lines.each do |line|
|
65
|
+
x = line.match(/^[\t\s]*\"((?:[^\"\\]|\\.)*)\"[\t\s]*\[(.+)\]/)
|
66
|
+
print "\033[1m*\033[0m " + x[1]
|
67
|
+
print " " * ((60 - x[1].length) + 1)
|
68
|
+
case x[2]
|
69
|
+
when "X"
|
70
|
+
print "[\033[1;32m Done \033[0m]\n"
|
71
|
+
when " "
|
72
|
+
print "[\033[1;31m Incomplete \033[0m]\n"
|
73
|
+
when "-"
|
74
|
+
print "[\033[1;33m In Progress \033[0m]\n"
|
75
|
+
when "|"
|
76
|
+
print "[\033[1;35m Optional \033[0m]\n"
|
77
|
+
else
|
78
|
+
print "[\033[1;31m Unsure \033[0m]\n"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
COMMENT_STRINGS = LoadConf("ToDo.xml")
|
84
|
+
|
85
|
+
unless mode == 1
|
86
|
+
file_mode()
|
87
|
+
exit
|
88
|
+
end
|
89
|
+
|
90
|
+
checklist
|
data/etc/ToDo.xml
ADDED
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Todo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Matthew Carey
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-01 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Todo list checker for projects.
|
15
|
+
email: matthew.b.carey@gmail.com
|
16
|
+
executables:
|
17
|
+
- todo
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/todo
|
22
|
+
- lib/version.rb
|
23
|
+
- etc/ToDo.xml
|
24
|
+
homepage:
|
25
|
+
licenses: []
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 1.8.23
|
45
|
+
signing_key:
|
46
|
+
specification_version: 3
|
47
|
+
summary: Todo list checker for projects.
|
48
|
+
test_files: []
|