to-do 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +9 -0
- data/Gemfile +6 -7
- data/README.md +4 -4
- data/VERSION +1 -1
- data/lib/to-do/tasks.rb +2 -2
- data/test/helper.rb +16 -11
- data/test/test_to-do.rb +42 -38
- data/to-do.gemspec +6 -2
- metadata +29 -17
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
# Add dependencies to
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
3
|
+
# Add dependencies required to use your gem here.
|
8
4
|
gem "shoulda", ">= 0"
|
9
|
-
gem "
|
5
|
+
gem "sqlite3", ">= 0"
|
6
|
+
gem "sequel", ">= 3.12"
|
10
7
|
gem "bundler", ">= 1.0.0"
|
11
8
|
gem "jeweler", "~> 1.8.4"
|
12
9
|
gem "simplecov", ">= 0"
|
13
10
|
gem "colorize", ">= 0"
|
14
11
|
|
12
|
+
# Add dependencies to develop your gem here.
|
13
|
+
# Include everything needed to run rake, tests, features, etc.
|
15
14
|
group :development do
|
16
15
|
gem "yard", ">= 0"
|
17
|
-
end
|
16
|
+
end
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
#to-do 1.2.
|
1
|
+
#to-do 1.2.6 [![Build Status](https://secure.travis-ci.org/kristenmills/to-do.png?branch=master)](http://travis-ci.org/kristenmills/to-do)
|
2
2
|
|
3
|
-
A simple command line todo application written in Ruby.
|
3
|
+
A simple command line todo application written in Ruby.
|
4
4
|
|
5
|
-
##What's new 1.2.
|
6
|
-
*
|
5
|
+
##What's new in 1.2.6
|
6
|
+
* Rewrote tests
|
7
7
|
* Bug Fixes
|
8
8
|
|
9
9
|
##What's new in 1.2
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.6
|
data/lib/to-do/tasks.rb
CHANGED
@@ -66,7 +66,7 @@ module Todo
|
|
66
66
|
clear_each 1, list_name
|
67
67
|
if clear_all
|
68
68
|
clear_each 0, list_name
|
69
|
-
DATABASE[:Lists].filter(:Name => list_name).update(:Total => 0)
|
69
|
+
#DATABASE[:Lists].filter(:Name => list_name).update(:Total => 0)
|
70
70
|
DATABASE[:Lists].filter(:Name => list_name).delete
|
71
71
|
puts "Cleared all tasks in #{list_name}"
|
72
72
|
else
|
@@ -95,7 +95,7 @@ module Todo
|
|
95
95
|
puts "Task ##{task} is not in the list."
|
96
96
|
end
|
97
97
|
else
|
98
|
-
found_task = names
|
98
|
+
found_task = names.with_sql("SELECT * FROM :table WHERE Name = :task COLLATE NOCASE",:table=>names, :task=>task).first
|
99
99
|
if found_task
|
100
100
|
DATABASE[:Tasks].filter(:Id => found_task[:Id]).update(:Completed => final)
|
101
101
|
else
|
data/test/helper.rb
CHANGED
@@ -10,22 +10,27 @@ end
|
|
10
10
|
require 'test/unit'
|
11
11
|
require 'shoulda'
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
require 'to-do'
|
13
|
+
#$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
#$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require File.join(File.dirname(__FILE__), '..', 'lib','to-do')
|
16
16
|
|
17
17
|
class Test::Unit::TestCase
|
18
|
+
def tasks_in_list database
|
19
|
+
database[:Tasks].join(:Task_list, :Tasks__id => :Task_list__Task_id).join(
|
20
|
+
:Lists, :Lists__id => :Task_list__List_id).select(:Tasks__Task_number, :Tasks__Name,
|
21
|
+
:Tasks__Completed).filter(:Lists__Name => Todo::Config[:working_list_name])
|
22
|
+
end
|
18
23
|
def add_tasks
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
Todo::Tasks.add "Cook dinner"
|
25
|
+
Todo::Tasks.add "Write Paper"
|
26
|
+
Todo::Tasks.add "Do Laundry"
|
27
|
+
Todo::Tasks.add "Clean things"
|
28
|
+
Todo::Tasks.add "Jump up and down"
|
24
29
|
end
|
25
30
|
|
26
31
|
def finish_tasks
|
27
|
-
|
28
|
-
|
29
|
-
|
32
|
+
Todo::Tasks.finish 2, true
|
33
|
+
Todo::Tasks.finish "Clean things", false
|
34
|
+
Todo::Tasks.finish "jUmP up AND down", false
|
30
35
|
end
|
31
36
|
end
|
data/test/test_to-do.rb
CHANGED
@@ -1,71 +1,75 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'helper')
|
2
|
-
require
|
2
|
+
require File.join(File.dirname(__FILE__),"..", "lib", "to-do.rb")
|
3
|
+
require 'fileutils'
|
3
4
|
|
4
5
|
class TestToDo < Test::Unit::TestCase
|
5
6
|
context "Test list" do
|
6
7
|
setup do
|
7
8
|
@list_name = Todo::Config[:working_list_name]
|
8
|
-
|
9
|
+
Todo::Config[:working_list_name] = 'Test list'
|
10
|
+
@database = Sequel.sqlite Todo::Config[:task_database]
|
9
11
|
end
|
10
12
|
|
11
|
-
should "
|
12
|
-
|
13
|
-
assert_equal 0,
|
14
|
-
assert_equal 0, @list.tasks.count
|
15
|
-
assert_equal 0, @list.completed_tasks.count
|
16
|
-
assert_equal "test_list" , Todo::Config[:working_list_name]
|
13
|
+
should "be empty" do
|
14
|
+
tasks = tasks_in_list @database
|
15
|
+
assert_equal 0, tasks.count
|
17
16
|
end
|
18
17
|
|
19
18
|
should "add some tasks" do
|
20
19
|
add_tasks
|
21
|
-
|
22
|
-
|
23
|
-
assert_equal 5,
|
24
|
-
assert_equal 0,
|
20
|
+
tasks = tasks_in_list @database
|
21
|
+
list = @database[:Lists][:Name=>Todo::Config[:working_list_name]]
|
22
|
+
assert_equal 5, list[:Total]
|
23
|
+
assert_equal 0, tasks.filter(:Completed=>1).count
|
25
24
|
end
|
26
25
|
|
27
26
|
should "finish some tasks" do
|
28
27
|
add_tasks
|
29
28
|
finish_tasks
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
Todo::Tasks.finish "This task doesn't exist", false
|
30
|
+
Todo::Tasks.finish 40, true
|
31
|
+
tasks = tasks_in_list @database
|
32
|
+
puts tasks.filter(:Completed=>1)
|
33
|
+
puts tasks.filter(:Completed=>0)
|
34
|
+
list = @database[:Lists][:Name=>Todo::Config[:working_list_name]]
|
35
|
+
assert_equal 5, list[:Total]
|
36
|
+
assert_equal 3, tasks.filter(:Completed=>1).count
|
37
|
+
assert_equal 2, tasks.filter(:Completed=>0).count
|
36
38
|
end
|
37
39
|
|
38
40
|
should "undo some tasks" do
|
39
41
|
add_tasks
|
40
42
|
finish_tasks
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
assert_equal
|
48
|
-
assert_equal 1,
|
43
|
+
Todo::Tasks.undo 2, true
|
44
|
+
Todo::Tasks.undo "Clean Things", false
|
45
|
+
Todo::Tasks.undo "This task doesn't exist", false
|
46
|
+
Todo::Tasks.undo 40, true
|
47
|
+
tasks = tasks_in_list @database
|
48
|
+
list = @database[:Lists][:Name=>Todo::Config[:working_list_name]]
|
49
|
+
assert_equal 5, list[:Total]
|
50
|
+
assert_equal 1, tasks.filter(:Completed=>1).count
|
51
|
+
assert_equal 4, tasks.filter(:Completed=>0).count
|
49
52
|
end
|
50
53
|
|
51
54
|
should "clear list" do
|
52
55
|
add_tasks
|
53
56
|
finish_tasks
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
assert_equal
|
58
|
-
assert_equal 0,
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
assert_equal 0,
|
57
|
+
Todo::Tasks.clear false
|
58
|
+
tasks = tasks_in_list @database
|
59
|
+
list = @database[:Lists][:Name=>Todo::Config[:working_list_name]]
|
60
|
+
assert_equal 5, list[:Total]
|
61
|
+
assert_equal 0, tasks.filter(:Completed=>1).count
|
62
|
+
assert_equal 2, tasks.filter(:Completed=>0).count
|
63
|
+
Todo::Tasks.finish 3, true
|
64
|
+
Todo::Tasks.clear true
|
65
|
+
list = @database[:Lists][:Name=>Todo::Config[:working_list_name]]
|
66
|
+
assert_nil list
|
67
|
+
assert_equal 0, tasks.filter(:Completed=>1).count
|
68
|
+
assert_equal 0, tasks.filter(:Completed=>0).count
|
65
69
|
end
|
66
70
|
|
67
71
|
teardown do
|
68
|
-
Todo::
|
72
|
+
Todo::Tasks.clear true
|
69
73
|
Todo::Config[:working_list_name] = @list_name
|
70
74
|
end
|
71
75
|
end
|
data/to-do.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "to-do"
|
8
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristen Mills"]
|
12
|
-
s.date = "2012-07-
|
12
|
+
s.date = "2012-07-26"
|
13
13
|
s.description = "A simple command line todo application"
|
14
14
|
s.email = "kristen@kristen-mills.com"
|
15
15
|
s.executables = ["todo"]
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
|
+
".travis.yml",
|
22
23
|
"Gemfile",
|
23
24
|
"LICENSE.txt",
|
24
25
|
"README.md",
|
@@ -46,6 +47,7 @@ Gem::Specification.new do |s|
|
|
46
47
|
|
47
48
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
49
|
s.add_runtime_dependency(%q<shoulda>, [">= 0"])
|
50
|
+
s.add_runtime_dependency(%q<sqlite3>, [">= 0"])
|
49
51
|
s.add_runtime_dependency(%q<sequel>, [">= 3.12"])
|
50
52
|
s.add_runtime_dependency(%q<bundler>, [">= 1.0.0"])
|
51
53
|
s.add_runtime_dependency(%q<jeweler>, ["~> 1.8.4"])
|
@@ -54,6 +56,7 @@ Gem::Specification.new do |s|
|
|
54
56
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
55
57
|
else
|
56
58
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
59
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
57
60
|
s.add_dependency(%q<sequel>, [">= 3.12"])
|
58
61
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
59
62
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
@@ -63,6 +66,7 @@ Gem::Specification.new do |s|
|
|
63
66
|
end
|
64
67
|
else
|
65
68
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
69
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
66
70
|
s.add_dependency(%q<sequel>, [">= 3.12"])
|
67
71
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
68
72
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to-do
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &70270233879100 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,21 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70270233879100
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sqlite3
|
27
|
+
requirement: &70270233878580 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70270233878580
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: sequel
|
27
|
-
requirement: &
|
38
|
+
requirement: &70270233877760 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ! '>='
|
@@ -32,10 +43,10 @@ dependencies:
|
|
32
43
|
version: '3.12'
|
33
44
|
type: :runtime
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *70270233877760
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: bundler
|
38
|
-
requirement: &
|
49
|
+
requirement: &70270233877040 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ! '>='
|
@@ -43,10 +54,10 @@ dependencies:
|
|
43
54
|
version: 1.0.0
|
44
55
|
type: :runtime
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70270233877040
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: jeweler
|
49
|
-
requirement: &
|
60
|
+
requirement: &70270233876160 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ~>
|
@@ -54,10 +65,10 @@ dependencies:
|
|
54
65
|
version: 1.8.4
|
55
66
|
type: :runtime
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *70270233876160
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: simplecov
|
60
|
-
requirement: &
|
71
|
+
requirement: &70270233874360 !ruby/object:Gem::Requirement
|
61
72
|
none: false
|
62
73
|
requirements:
|
63
74
|
- - ! '>='
|
@@ -65,10 +76,10 @@ dependencies:
|
|
65
76
|
version: '0'
|
66
77
|
type: :runtime
|
67
78
|
prerelease: false
|
68
|
-
version_requirements: *
|
79
|
+
version_requirements: *70270233874360
|
69
80
|
- !ruby/object:Gem::Dependency
|
70
81
|
name: colorize
|
71
|
-
requirement: &
|
82
|
+
requirement: &70270233872100 !ruby/object:Gem::Requirement
|
72
83
|
none: false
|
73
84
|
requirements:
|
74
85
|
- - ! '>='
|
@@ -76,10 +87,10 @@ dependencies:
|
|
76
87
|
version: '0'
|
77
88
|
type: :runtime
|
78
89
|
prerelease: false
|
79
|
-
version_requirements: *
|
90
|
+
version_requirements: *70270233872100
|
80
91
|
- !ruby/object:Gem::Dependency
|
81
92
|
name: yard
|
82
|
-
requirement: &
|
93
|
+
requirement: &70270233902060 !ruby/object:Gem::Requirement
|
83
94
|
none: false
|
84
95
|
requirements:
|
85
96
|
- - ! '>='
|
@@ -87,7 +98,7 @@ dependencies:
|
|
87
98
|
version: '0'
|
88
99
|
type: :development
|
89
100
|
prerelease: false
|
90
|
-
version_requirements: *
|
101
|
+
version_requirements: *70270233902060
|
91
102
|
description: A simple command line todo application
|
92
103
|
email: kristen@kristen-mills.com
|
93
104
|
executables:
|
@@ -98,6 +109,7 @@ extra_rdoc_files:
|
|
98
109
|
- README.md
|
99
110
|
files:
|
100
111
|
- .document
|
112
|
+
- .travis.yml
|
101
113
|
- Gemfile
|
102
114
|
- LICENSE.txt
|
103
115
|
- README.md
|
@@ -128,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
140
|
version: '0'
|
129
141
|
segments:
|
130
142
|
- 0
|
131
|
-
hash:
|
143
|
+
hash: 209463214064435770
|
132
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
145
|
none: false
|
134
146
|
requirements:
|