tdo 0.0.2 → 0.0.3
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/VERSION +1 -1
- data/lib/tdo.rb +1 -2
- data/tdo.gemspec +4 -3
- data/test/helper.rb +22 -0
- data/test/test_tdo.rb +40 -2
- data/test/todo.txt +7 -0
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/tdo.rb
CHANGED
@@ -93,8 +93,7 @@ module Tdo
|
|
93
93
|
#
|
94
94
|
# @param [Hash] tasks hash to write
|
95
95
|
def self.write_hash( hash )
|
96
|
-
|
97
|
-
f.puts to_s( hash )
|
96
|
+
File.open(TODO_FILE, "w") {|f| f.write( to_s(hash) )}
|
98
97
|
end
|
99
98
|
|
100
99
|
# Converts the string read from the file to a hash so it can easily be used
|
data/tdo.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{tdo}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joshua Hawxwell"]
|
12
|
-
s.date = %q{2010-06-
|
12
|
+
s.date = %q{2010-06-13}
|
13
13
|
s.default_executable = %q{tdo}
|
14
14
|
s.description = %q{Tdo is a simple ruby app to add, edit and read your todo list. It stores the list at ~/.todo.txt}
|
15
15
|
s.email = %q{m@hawx.me}
|
@@ -29,7 +29,8 @@ Gem::Specification.new do |s|
|
|
29
29
|
"lib/tdo.rb",
|
30
30
|
"tdo.gemspec",
|
31
31
|
"test/helper.rb",
|
32
|
-
"test/test_tdo.rb"
|
32
|
+
"test/test_tdo.rb",
|
33
|
+
"test/todo.txt"
|
33
34
|
]
|
34
35
|
s.homepage = %q{http://github.com/hawx/tdo}
|
35
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
data/test/helper.rb
CHANGED
@@ -7,4 +7,26 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
7
7
|
require 'tdo'
|
8
8
|
|
9
9
|
class Test::Unit::TestCase
|
10
|
+
def file_text
|
11
|
+
r = <<EOS
|
12
|
+
- A task
|
13
|
+
|
14
|
+
@group
|
15
|
+
- Another task
|
16
|
+
- A done task #done
|
17
|
+
|
18
|
+
@home
|
19
|
+
- Another group
|
20
|
+
EOS
|
21
|
+
end
|
22
|
+
|
23
|
+
def clear_todo
|
24
|
+
f = File.new(Tdo::TODO_FILE, "w")
|
25
|
+
f.puts file_text
|
26
|
+
f.close
|
27
|
+
end
|
10
28
|
end
|
29
|
+
|
30
|
+
module Tdo
|
31
|
+
TODO_FILE = File.join( File.dirname(__FILE__), "todo.txt" )
|
32
|
+
end
|
data/test/test_tdo.rb
CHANGED
@@ -1,7 +1,45 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestTdo < Test::Unit::TestCase
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
should "read tasks" do
|
6
|
+
clear_todo
|
7
|
+
assert_equal Tdo.read_tasks, file_text
|
6
8
|
end
|
9
|
+
|
10
|
+
should "read tasks from specific group" do
|
11
|
+
clear_todo
|
12
|
+
assert_equal Tdo.read_tasks('@home'), "- Another group\n"
|
13
|
+
end
|
14
|
+
|
15
|
+
should "add new task" do
|
16
|
+
clear_todo
|
17
|
+
b = Tdo.read_tasks
|
18
|
+
Tdo.add_task( "Pick up milk" )
|
19
|
+
|
20
|
+
assert_equal Tdo.read_tasks.size, b.size + " - Pick up milk".size
|
21
|
+
end
|
22
|
+
|
23
|
+
should "add new task to group" do
|
24
|
+
clear_todo
|
25
|
+
Tdo.add_task( 'Pick up milk', '@test' )
|
26
|
+
|
27
|
+
assert_equal Tdo.read_tasks('@test').size, " - Pick up milk".size
|
28
|
+
end
|
29
|
+
|
30
|
+
should "mark task as done" do
|
31
|
+
clear_todo
|
32
|
+
b = Tdo.read_tasks( '@ungrouped' ).strip
|
33
|
+
Tdo.mark_done( 'A task' )
|
34
|
+
|
35
|
+
assert_equal Tdo.read_tasks( '@ungrouped' ), b + " #done\n"
|
36
|
+
end
|
37
|
+
|
38
|
+
should "remove all tasks marked done" do
|
39
|
+
clear_todo
|
40
|
+
Tdo.clear_done
|
41
|
+
|
42
|
+
assert_equal Tdo.read_tasks('@group'), "- Another task\n"
|
43
|
+
end
|
44
|
+
|
7
45
|
end
|
data/test/todo.txt
ADDED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Joshua Hawxwell
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-13 00:00:00 +01:00
|
18
18
|
default_executable: tdo
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- tdo.gemspec
|
51
51
|
- test/helper.rb
|
52
52
|
- test/test_tdo.rb
|
53
|
+
- test/todo.txt
|
53
54
|
has_rdoc: true
|
54
55
|
homepage: http://github.com/hawx/tdo
|
55
56
|
licenses: []
|