taskish 0.2.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +3 -0
- data/README.rdoc +4 -1
- data/lib/taskish.rb +6 -5
- data/lib/taskish/app.rb +14 -14
- data/lib/taskish/version.rb +1 -1
- data/test/app_test.rb +7 -2
- data/test/version_test.rb +1 -1
- metadata +3 -4
data/HISTORY
CHANGED
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Taskish - Pending
|
2
2
|
|
3
|
-
A text-based to-do list manager inspired by
|
3
|
+
A text-based to-do list manager inspired by {TaskPaper}[http://www.hogbaysoftware.com/products/taskpaper].
|
4
4
|
|
5
5
|
== USAGE
|
6
6
|
|
@@ -15,6 +15,9 @@ A text-based to-do list manager inspired by <TaskPaper|URL:http://www.hogbaysoft
|
|
15
15
|
# Find tasks due within the next week
|
16
16
|
taskish.due(:week)
|
17
17
|
|
18
|
+
# Find completed tasks.
|
19
|
+
taskish.done
|
20
|
+
|
18
21
|
end
|
19
22
|
|
20
23
|
== HOME PAGE
|
data/lib/taskish.rb
CHANGED
@@ -3,7 +3,7 @@ require 'taskish/version'
|
|
3
3
|
|
4
4
|
# = Taskish - Pending
|
5
5
|
#
|
6
|
-
# A text-based to-do list manager inspired by
|
6
|
+
# A text-based to-do list manager inspired by {TaskPaper}[http://www.hogbaysoftware.com/products/taskpaper].
|
7
7
|
#
|
8
8
|
# == USAGE
|
9
9
|
#
|
@@ -18,6 +18,9 @@ require 'taskish/version'
|
|
18
18
|
# # Find tasks due within the next week
|
19
19
|
# taskish.due(:week)
|
20
20
|
#
|
21
|
+
# # Find completed tasks.
|
22
|
+
# taskish.done
|
23
|
+
#
|
21
24
|
# end
|
22
25
|
#
|
23
26
|
# == HOME PAGE
|
@@ -66,14 +69,12 @@ class Taskish
|
|
66
69
|
idx += 1
|
67
70
|
l.chomp!
|
68
71
|
if l =~ /^(\S.+):$/
|
69
|
-
#warn "PROJECT => #{ $1 }"
|
70
72
|
if key? $1
|
71
|
-
warn "line ##{idx} - project '#{ $1 }'
|
72
|
-
project = nil
|
73
|
+
# warn "line ##{idx} - duplicate project '#{ $1 }'"
|
73
74
|
else
|
74
75
|
@data[ $1 ] = []
|
75
|
-
project = $1
|
76
76
|
end
|
77
|
+
project = $1
|
77
78
|
elsif l =~ /^\s+\-\s+(.*)$/
|
78
79
|
#warn "TASK => #{ $1 }"
|
79
80
|
if project
|
data/lib/taskish/app.rb
CHANGED
@@ -11,7 +11,7 @@ class Taskish # :nodoc:
|
|
11
11
|
#
|
12
12
|
# Command Line:
|
13
13
|
#
|
14
|
-
# % taskish [
|
14
|
+
# % taskish <command> <task file> [<task file N>]
|
15
15
|
#
|
16
16
|
# == SEE ALSO
|
17
17
|
#
|
@@ -19,11 +19,11 @@ class Taskish # :nodoc:
|
|
19
19
|
#
|
20
20
|
class App
|
21
21
|
|
22
|
-
attr_reader :command, :
|
22
|
+
attr_reader :command, :files
|
23
23
|
|
24
24
|
def initialize
|
25
25
|
@command = nil
|
26
|
-
@
|
26
|
+
@files = nil
|
27
27
|
yield self if block_given?
|
28
28
|
end
|
29
29
|
|
@@ -36,7 +36,7 @@ class Taskish # :nodoc:
|
|
36
36
|
def args(args)
|
37
37
|
raise(ArgumentError, 'invalid argument(s)') if ( args.nil? || !args.kind_of?(Array) )
|
38
38
|
@command = args.shift
|
39
|
-
@
|
39
|
+
@files = args
|
40
40
|
self
|
41
41
|
end
|
42
42
|
|
@@ -53,21 +53,21 @@ class Taskish # :nodoc:
|
|
53
53
|
puts "Taskish v#{ Taskish::VERSION }"
|
54
54
|
return true
|
55
55
|
else
|
56
|
-
return app.abort('no file specified') unless app.
|
56
|
+
return app.abort('no file specified') unless app.files
|
57
57
|
Taskish.new do |taskish|
|
58
|
+
app.files.each { |f| taskish.readlines(f) }
|
58
59
|
case app.command
|
59
60
|
when 'done'
|
60
|
-
taskish.readlines(app.file)
|
61
|
+
# taskish.readlines(app.file)
|
61
62
|
puts "DONE\n~~~~~"
|
62
63
|
taskish.done.each { |task| puts task }
|
63
|
-
when 'today'
|
64
|
-
taskish.readlines(app.file)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
taskish.due(:week).each { |task| puts task }
|
64
|
+
when 'today', 'week'
|
65
|
+
# taskish.readlines(app.file)
|
66
|
+
tasks = taskish.due( app.command.to_sym )
|
67
|
+
if tasks.size > 0
|
68
|
+
puts "#{ app.command.upcase }\n#{ '~' * app.command.length }"
|
69
|
+
tasks.each { |task| puts task }
|
70
|
+
end
|
71
71
|
else
|
72
72
|
return app.abort("unknown command: #{app.command}")
|
73
73
|
end
|
data/lib/taskish/version.rb
CHANGED
data/test/app_test.rb
CHANGED
@@ -28,12 +28,17 @@ class AppTest < Test::Unit::TestCase
|
|
28
28
|
context 'with arguments' do
|
29
29
|
should 'have nil args before parsing args' do
|
30
30
|
assert_nil @app.command
|
31
|
-
assert_nil @app.
|
31
|
+
assert_nil @app.files
|
32
32
|
end
|
33
33
|
should 'have set args after parsing args' do
|
34
34
|
@app.args( [ 'command', 'file' ] )
|
35
35
|
assert_equal 'command', @app.command
|
36
|
-
assert_equal 'file',
|
36
|
+
assert_equal [ 'file' ], @app.files
|
37
|
+
end
|
38
|
+
should 'have set args after parsing args' do
|
39
|
+
@app.args( [ 'command', 'file1', 'file2' ] )
|
40
|
+
assert_equal 'command', @app.command
|
41
|
+
assert_equal [ 'file1', 'file2' ], @app.files
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
data/test/version_test.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
|
9
|
-
version: 0.2.2
|
7
|
+
- 3
|
8
|
+
version: "0.3"
|
10
9
|
platform: ruby
|
11
10
|
authors:
|
12
11
|
- blair christensen.
|
@@ -14,7 +13,7 @@ autorequire:
|
|
14
13
|
bindir: bin
|
15
14
|
cert_chain: []
|
16
15
|
|
17
|
-
date: 2011-06-
|
16
|
+
date: 2011-06-29 00:00:00 -05:00
|
18
17
|
default_executable:
|
19
18
|
dependencies:
|
20
19
|
- !ruby/object:Gem::Dependency
|