to-do 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/README.md +5 -5
- data/VERSION +1 -1
- data/bin/todo +5 -3
- data/lib/to-do/cli.rb +20 -24
- data/lib/to-do/dbmigrations/001_create_tables.rb +50 -0
- data/lib/to-do/old/list.rb +160 -0
- data/lib/to-do/tasks.rb +30 -32
- data/lib/to-do.rb +26 -28
- data/to-do.gemspec +7 -5
- metadata +21 -19
data/Gemfile
CHANGED
@@ -6,7 +6,7 @@ source "http://rubygems.org"
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
8
|
gem "shoulda", ">= 0"
|
9
|
-
gem "
|
9
|
+
gem "sequel", ">=3.12"
|
10
10
|
gem "bundler", ">= 1.0.0"
|
11
11
|
gem "jeweler", "~> 1.8.4"
|
12
12
|
gem "simplecov", ">= 0"
|
data/README.md
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
-
#to-do 1.2.
|
1
|
+
#to-do 1.2.5
|
2
2
|
|
3
3
|
A simple command line todo application written in Ruby.
|
4
4
|
|
5
|
-
##What's new 1.2.
|
6
|
-
*
|
7
|
-
* Layout uptdates
|
5
|
+
##What's new 1.2.5
|
6
|
+
* Cleaned up the code by using the gem Sequel for the sqlite things
|
8
7
|
* Bug Fixes
|
9
8
|
|
10
9
|
##What's new in 1.2
|
11
10
|
* Remove a list
|
12
11
|
* Better usage messages
|
13
12
|
* Better documentation using YARD
|
13
|
+
* Better layout
|
14
|
+
* SQlite backend
|
14
15
|
|
15
16
|
##Install
|
16
17
|
gem install to-do
|
@@ -101,7 +102,6 @@ A simple command line todo application written in Ruby.
|
|
101
102
|
* Tags
|
102
103
|
* Due Dates
|
103
104
|
* Tab Completion
|
104
|
-
* SQLite Backend
|
105
105
|
* Sorting
|
106
106
|
* Priorites
|
107
107
|
* Reorganizing
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.5
|
data/bin/todo
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
if File.symlink? __FILE__
|
4
|
-
|
3
|
+
current_directory = if File.symlink? __FILE__
|
4
|
+
File.dirname File.readlink __FILE__
|
5
5
|
else
|
6
|
-
|
6
|
+
File.dirname __FILE__
|
7
7
|
end
|
8
8
|
|
9
|
+
require File.join(File.expand_path('..',current_directory),'lib','to-do')
|
10
|
+
|
9
11
|
Todo::CLI.parse
|
data/lib/to-do/cli.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'optparse'
|
2
2
|
require 'yaml'
|
3
3
|
require 'colorize'
|
4
|
-
require 'sqlite3'
|
5
4
|
|
6
5
|
module Todo
|
7
6
|
# CLI is the module that contains the methods to display the list as well as
|
@@ -10,7 +9,7 @@ module Todo
|
|
10
9
|
extend self
|
11
10
|
|
12
11
|
# The database
|
13
|
-
DATABASE =
|
12
|
+
DATABASE = Sequel.sqlite Todo::Config[:task_database]
|
14
13
|
|
15
14
|
# The option flags
|
16
15
|
OPTIONS = {
|
@@ -32,17 +31,15 @@ module Todo
|
|
32
31
|
# Completed: 2/4
|
33
32
|
# 3. Task 3
|
34
33
|
# 4. Task 4
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
completed_count = 0
|
45
|
-
Config[:width].times do
|
34
|
+
def display
|
35
|
+
tasks = DATABASE[:Tasks].join(:Task_list, :Tasks__id => :Task_list__Task_id).join(
|
36
|
+
:Lists, :Lists__id => :Task_list__List_id).select(:Tasks__Task_number, :Tasks__Name,
|
37
|
+
:Tasks__Completed).filter(:Lists__Name => Config[:working_list_name])
|
38
|
+
tasks = tasks.order(:Task_number)
|
39
|
+
list = DATABASE[:Lists][:Name=>Config[:working_list_name]]
|
40
|
+
count = list.nil? ? 0 : list[:Total]
|
41
|
+
completed_count = tasks.filter(:Completed=>1).count
|
42
|
+
Config[:width].times do
|
46
43
|
print "*".colorize(:light_red)
|
47
44
|
end
|
48
45
|
puts
|
@@ -50,20 +47,16 @@ module Todo
|
|
50
47
|
split_name.each do |line|
|
51
48
|
puts line.center(Config[:width]).colorize(:light_cyan)
|
52
49
|
end
|
53
|
-
|
54
|
-
Config[:width].times do
|
50
|
+
Config[:width].times do
|
55
51
|
print "*".colorize(:light_red)
|
56
52
|
end
|
57
53
|
puts
|
58
54
|
puts
|
59
55
|
puts "Todo:".colorize(:light_green)
|
60
56
|
tasks.each do |task|
|
61
|
-
if task[
|
62
|
-
|
63
|
-
|
64
|
-
end
|
65
|
-
printf "%4d. ".to_s.colorize(:light_yellow), task[0]
|
66
|
-
split_v = split task[1], Config[:width] - 6
|
57
|
+
next if task[:Completed] == 1
|
58
|
+
printf "%4d. ".to_s.colorize(:light_yellow), task[:Task_number]
|
59
|
+
split_v = split task[:Name], Config[:width] - 6
|
67
60
|
puts split_v[0]
|
68
61
|
split_v.shift
|
69
62
|
split_v.each do |line|
|
@@ -73,9 +66,9 @@ module Todo
|
|
73
66
|
print "\nCompleted:".colorize(:light_green)
|
74
67
|
printf "%#{Config[:width]+4}s\n", "#{completed_count}/#{count}".colorize(:light_cyan)
|
75
68
|
tasks.each do |task|
|
76
|
-
next if task[
|
77
|
-
printf "%4d. ".to_s.colorize(:light_yellow), task[
|
78
|
-
split_v = split task[
|
69
|
+
next if task[:Completed] == 0
|
70
|
+
printf "%4d. ".to_s.colorize(:light_yellow), task[:Task_number]
|
71
|
+
split_v = split task[:Name], Config[:width]-6
|
79
72
|
puts split_v[0]
|
80
73
|
split_v.shift
|
81
74
|
split_v.each do |line|
|
@@ -183,6 +176,8 @@ module Todo
|
|
183
176
|
when "remove", "r"
|
184
177
|
if ARGV.count > 1
|
185
178
|
Tasks.clear true, ARGV[1..-1].map{|word| word.capitalize}.join(' ')
|
179
|
+
else
|
180
|
+
puts "Usage todo remove <list name>"
|
186
181
|
end
|
187
182
|
else
|
188
183
|
puts "Invalid command. See todo -h for help."
|
@@ -245,3 +240,4 @@ module Todo
|
|
245
240
|
|
246
241
|
end
|
247
242
|
end
|
243
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'sequel'
|
2
|
+
|
3
|
+
Sequel.migration do
|
4
|
+
up do
|
5
|
+
if !table_exists? :Tasks
|
6
|
+
create_table :Tasks do
|
7
|
+
primary_key :Id
|
8
|
+
Integer :Task_number
|
9
|
+
String :Text
|
10
|
+
Integer :Completed
|
11
|
+
end
|
12
|
+
end
|
13
|
+
if !table_exists? :Lists
|
14
|
+
create_table :Lists do
|
15
|
+
primary_key :Id
|
16
|
+
String :Name
|
17
|
+
Integer :Total
|
18
|
+
end
|
19
|
+
end
|
20
|
+
if !table_exists? :Task_list
|
21
|
+
create_table :Task_list do
|
22
|
+
Integer :Task_id
|
23
|
+
Intager :List_id
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
down do
|
28
|
+
if table_exists? :Tasks
|
29
|
+
create_table :Tasks do
|
30
|
+
primary_key :Id
|
31
|
+
Integer :Task_number
|
32
|
+
String :Text
|
33
|
+
Integer :Completed
|
34
|
+
end
|
35
|
+
end
|
36
|
+
if table_exists? :Lists
|
37
|
+
create_table :Lists do
|
38
|
+
primary_key :Id
|
39
|
+
String :Name
|
40
|
+
Integer :Total
|
41
|
+
end
|
42
|
+
end
|
43
|
+
if table_exists? :Task_list
|
44
|
+
create_table :Task_list do
|
45
|
+
Integer :Task_id
|
46
|
+
Intager :List_id
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,160 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'fileutils'
|
3
|
+
module Todo
|
4
|
+
|
5
|
+
# The Class that represents a list of tasks
|
6
|
+
class List
|
7
|
+
attr_accessor :tasks, :completed_tasks, :count, :completed_count, :name
|
8
|
+
|
9
|
+
# Creates a new list and sets it to be the working list
|
10
|
+
#
|
11
|
+
# @param [String] name the name of the list
|
12
|
+
def initialize name
|
13
|
+
@tasks = Hash.new
|
14
|
+
@completed_tasks = Hash.new
|
15
|
+
@count = 0
|
16
|
+
@completed_count = 0
|
17
|
+
@name = name
|
18
|
+
if !File.exists? Config[:lists_directory]
|
19
|
+
Dir.mkdir(Config[:lists_directory])
|
20
|
+
end
|
21
|
+
update
|
22
|
+
Config[:working_list_name] = name.downcase.gsub(/ /, '_')
|
23
|
+
Config[:working_list_exists] = true
|
24
|
+
Config.write
|
25
|
+
puts "Created List #{name}."
|
26
|
+
end
|
27
|
+
|
28
|
+
# Updates the yaml file
|
29
|
+
def update
|
30
|
+
path = File.join(Config[:lists_directory], @name.downcase.gsub(/ /, '_') +'.yml')
|
31
|
+
File.open(path, 'w') do |fh|
|
32
|
+
fh.puts(self.to_yaml)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Adds the tast to the list
|
37
|
+
#
|
38
|
+
# @param [String] task the task to add to the list
|
39
|
+
def add task
|
40
|
+
@count+=1
|
41
|
+
@tasks[@count] = task
|
42
|
+
puts "Added task #{task}."
|
43
|
+
update
|
44
|
+
end
|
45
|
+
|
46
|
+
# finish the task. task is either a case insensitive task on the list or
|
47
|
+
# the task number. Prints out either the task is not in the list or that i
|
48
|
+
# succesfully finished the task
|
49
|
+
#
|
50
|
+
# @param task either a task number or task name to finish
|
51
|
+
# @param [Bool] is_num if the task param represents the task number, true.
|
52
|
+
# false if it is the task name
|
53
|
+
def finish task, is_num
|
54
|
+
if is_num
|
55
|
+
if !@tasks[task.to_i].nil?
|
56
|
+
@completed_tasks[task.to_i] = @tasks[task.to_i]
|
57
|
+
@tasks.delete(task.to_i)
|
58
|
+
@completed_count+=1
|
59
|
+
@completed_tasks = Hash[@completed_tasks.sort]
|
60
|
+
puts "Finished #{@completed_tasks[task.to_i]}."
|
61
|
+
else
|
62
|
+
puts "Task \##{task} not in list."
|
63
|
+
end
|
64
|
+
else
|
65
|
+
hash = Hash.new
|
66
|
+
@tasks.each do |k,v|
|
67
|
+
hash[k] = v.downcase
|
68
|
+
end
|
69
|
+
if hash.value?(task.downcase)
|
70
|
+
num = hash.key(task.downcase)
|
71
|
+
@completed_tasks[num] = @tasks[num]
|
72
|
+
@tasks.delete(num)
|
73
|
+
@completed_count+=1
|
74
|
+
@completed_tasks = Hash[@completed_tasks.sort]
|
75
|
+
puts "Finished #{@completed_tasks[num]}."
|
76
|
+
else
|
77
|
+
puts "Task #{task} is not in list."
|
78
|
+
end
|
79
|
+
end
|
80
|
+
update
|
81
|
+
end
|
82
|
+
|
83
|
+
# undos finishing a task. task is either a case insensitive task on the list or
|
84
|
+
# the task number. Prints out either the task is not in the list or that i
|
85
|
+
# succesfully undoed finished the task
|
86
|
+
#
|
87
|
+
# @param task either a task number or task name to finish
|
88
|
+
# @param [Bool] is_num if the task param represents the task number, true.
|
89
|
+
# false if it is the task name
|
90
|
+
def undo task, is_num
|
91
|
+
if is_num
|
92
|
+
if !@completed_tasks[task.to_i].nil?
|
93
|
+
@tasks[task.to_i] = @completed_tasks[task.to_i]
|
94
|
+
@completed_tasks.delete(task.to_i)
|
95
|
+
@completed_count-=1
|
96
|
+
@tasks = Hash[@tasks.sort]
|
97
|
+
puts "Undo completeing #{@tasks[task.to_i]}."
|
98
|
+
else
|
99
|
+
puts "Task \##{task} not in list."
|
100
|
+
end
|
101
|
+
else
|
102
|
+
hash = Hash.new
|
103
|
+
@completed_tasks.each do |k,v|
|
104
|
+
hash[k] = v.downcase
|
105
|
+
end
|
106
|
+
if hash.value?(task.downcase)
|
107
|
+
num = hash.key(task.downcase)
|
108
|
+
@tasks[num] = @completed_tasks[num]
|
109
|
+
@completed_tasks.delete(num)
|
110
|
+
@completed_count-=1
|
111
|
+
@tasks = Hash[@tasks.sort]
|
112
|
+
puts "Undo completeing #{@tasks[num]}."
|
113
|
+
else
|
114
|
+
puts "Task #{task} is not in list."
|
115
|
+
end
|
116
|
+
end
|
117
|
+
update
|
118
|
+
end
|
119
|
+
|
120
|
+
# clears just the completed tasks
|
121
|
+
def clear_completed
|
122
|
+
@completed_tasks = Hash.new
|
123
|
+
update
|
124
|
+
end
|
125
|
+
|
126
|
+
# clears the task in the list
|
127
|
+
#
|
128
|
+
# @param [Bool] clear_all if true, clears all completed and uncompleted tasks
|
129
|
+
# and resets the count. if false, just clears the completed tasks
|
130
|
+
def clear clear_all
|
131
|
+
clear_completed
|
132
|
+
if clear_all
|
133
|
+
@tasks = Hash.new
|
134
|
+
@completed_count = 0
|
135
|
+
@count = 0
|
136
|
+
puts "Cleared list."
|
137
|
+
else
|
138
|
+
puts "Cleared completed tasks."
|
139
|
+
end
|
140
|
+
update
|
141
|
+
end
|
142
|
+
|
143
|
+
# Class method that removes a list from the your lists.
|
144
|
+
#
|
145
|
+
# @param [string] name name of the list that you are trying to remove
|
146
|
+
def self.remove name
|
147
|
+
underscore_name = name.downcase.gsub(/ /, '_')
|
148
|
+
begin
|
149
|
+
FileUtils.rm File.join(Config[:lists_directory], underscore_name +'.yml')
|
150
|
+
puts "Removed list #{name}"
|
151
|
+
rescue
|
152
|
+
puts "List doesn't exist"
|
153
|
+
end
|
154
|
+
if underscore_name == Config[:working_list_name]
|
155
|
+
Config[:working_list_exists] = false
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
data/lib/to-do/tasks.rb
CHANGED
@@ -1,27 +1,25 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'config')
|
2
|
-
require 'fileutils'
|
3
|
-
require 'sqlite3'
|
4
1
|
module Todo
|
5
2
|
|
6
3
|
# The module that contains methods for manipulating the database
|
7
4
|
module Tasks
|
8
5
|
extend self
|
9
|
-
DATABASE =
|
6
|
+
DATABASE = Sequel.sqlite Todo::Config[:task_database]
|
10
7
|
|
11
8
|
# Adds the tast to the list
|
12
9
|
#
|
13
10
|
# @param [String] task the task to add to the list
|
14
11
|
def add task
|
15
|
-
list = DATABASE.
|
12
|
+
list = DATABASE[:Lists].select(:Total, :Id)[:Name=>Todo::Config[:working_list_name]]
|
16
13
|
if !list
|
17
|
-
|
14
|
+
DATABASE[:Lists] << {:Name => Config[:working_list_name], :Total => 0}
|
15
|
+
list = DATABASE[:Lists].select(:Total, :Id)[:Name=>Todo::Config[:working_list_name]]
|
18
16
|
end
|
19
|
-
count = list
|
20
|
-
DATABASE
|
21
|
-
list_id = list[
|
22
|
-
task_id = DATABASE
|
23
|
-
DATABASE
|
24
|
-
DATABASE
|
17
|
+
count = list[:Total]+1
|
18
|
+
DATABASE[:Tasks] << {:Task_number => count, :Name => task, :Completed => 0}
|
19
|
+
list_id = list[:Id]
|
20
|
+
task_id = DATABASE[:Tasks][:Name=>task][:Id]
|
21
|
+
DATABASE[:Task_list] << {:Task_id => task_id, :List_id => list_id}
|
22
|
+
DATABASE[:Lists].filter(:Id => list_id).update(:Total => count)
|
25
23
|
end
|
26
24
|
|
27
25
|
# finish the task. task is either a case insensitive task on the list or
|
@@ -51,12 +49,12 @@ module Todo
|
|
51
49
|
# @param completed [Integer] 1 if clearing completed tasks, 0 if clearing
|
52
50
|
# Uncompleted tasks
|
53
51
|
def clear_each completed ,list_name
|
54
|
-
tasks = DATABASE.
|
55
|
-
|
56
|
-
|
52
|
+
tasks = DATABASE[:Tasks].join(:Task_list, :Tasks__id => :Task_list__Task_id).join(
|
53
|
+
:Lists, :Lists__id => :Task_list__List_id).select(:Tasks__Id).filter(
|
54
|
+
:Lists__Name => Config[:working_list_name]).filter(:Tasks__Completed => completed)
|
57
55
|
tasks.each do |task|
|
58
|
-
DATABASE.
|
59
|
-
DATABASE.
|
56
|
+
DATABASE[:Task_list].filter(:Task_id => task[:Id]).delete
|
57
|
+
DATABASE[:Tasks].filter(:Id => task[:Id]).delete
|
60
58
|
end
|
61
59
|
end
|
62
60
|
|
@@ -68,8 +66,8 @@ module Todo
|
|
68
66
|
clear_each 1, list_name
|
69
67
|
if clear_all
|
70
68
|
clear_each 0, list_name
|
71
|
-
DATABASE.
|
72
|
-
DATABASE.
|
69
|
+
DATABASE[:Lists].filter(:Name => list_name).update(:Total => 0)
|
70
|
+
DATABASE[:Lists].filter(:Name => list_name).delete
|
73
71
|
puts "Cleared all tasks in #{list_name}"
|
74
72
|
else
|
75
73
|
puts "Cleared completed tasks in #{Config[:working_list_name]}"
|
@@ -84,26 +82,26 @@ module Todo
|
|
84
82
|
# @param initial [Integer] 0 if you are finishing a task, 1 if you are undoing a task
|
85
83
|
# @param final [Integer] 1 if you are finishing a task, 0 if you ara undoing a task
|
86
84
|
def finish_undo task , is_num, initial, final
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
list_id = DATABASE[:Lists][:Name => Config[:working_list_name]][:Id]
|
86
|
+
names =DATABASE[:Tasks].join(:Task_list, :Tasks__Id => :Task_list__Task_Id).join(
|
87
|
+
:Lists, :Lists__Id => :Task_list__List_id).select(:Tasks__Id, :Tasks__Task_number,
|
88
|
+
:Tasks__Name).filter(:Lists__Name => Config[:working_list_name]).filter(
|
89
|
+
:Tasks__Completed => initial)
|
92
90
|
if is_num
|
93
|
-
|
94
|
-
|
95
|
-
DATABASE
|
91
|
+
found_task = names[:Task_number => task]
|
92
|
+
if found_task
|
93
|
+
DATABASE[:Tasks].filter(:Id => found_task[:Id]).update(:Completed => final)
|
96
94
|
else
|
97
95
|
puts "Task ##{task} is not in the list."
|
98
96
|
end
|
99
97
|
else
|
100
|
-
|
101
|
-
|
102
|
-
DATABASE
|
98
|
+
found_task = names[:Tasks__Name.downcase => task.downcase]
|
99
|
+
if found_task
|
100
|
+
DATABASE[:Tasks].filter(:Id => found_task[:Id]).update(:Completed => final)
|
103
101
|
else
|
104
|
-
puts "Task #{task} is not in the list."
|
102
|
+
puts "Task '#{task}' is not in the list."
|
105
103
|
end
|
106
104
|
end
|
107
105
|
end
|
108
106
|
end
|
109
|
-
end
|
107
|
+
end
|
data/lib/to-do.rb
CHANGED
@@ -1,42 +1,40 @@
|
|
1
|
-
require '
|
1
|
+
require 'sequel'
|
2
|
+
require 'sequel/extensions/migration'
|
2
3
|
require File.join(File.dirname(__FILE__), 'to-do', 'config')
|
4
|
+
require File.join(File.dirname(__FILE__), 'to-do', 'old', 'list')
|
3
5
|
if !File.exists?(File.join(ENV['HOME'], '.to-do'))
|
4
6
|
Dir.mkdir(File.join(ENV['HOME'], '.to-do'))
|
5
7
|
Todo::Config.write
|
6
8
|
end
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
database.execute "CREATE TABLE Tasks(Id INTEGER PRIMARY KEY, Task_number INTEGER, Name TEXT, Completed INTEGER)"
|
13
|
-
database.execute "CREATE TABLE Lists(Id INTEGER PRIMARY KEY, Name TEXT, Total INTEGER)"
|
14
|
-
database.execute "CREATE TABLE Task_list(Task_id INTEGER, List_id INTEGER)"
|
10
|
+
database = Sequel.sqlite Todo::Config[:task_database]
|
11
|
+
|
12
|
+
# Migrate the database to the latest version
|
13
|
+
Sequel::Migrator.apply(database, File.join(File.dirname(__FILE__),'to-do', 'dbmigrations'))
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Dir.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
database.execute "INSERT INTO Task_list VALUES(" + task_id.to_s + ", " + list_id.to_s + ")"
|
35
|
-
end
|
15
|
+
# If a lists file exists from back when we were using YAML populate the database with that information
|
16
|
+
if File.exists?(File.join(ENV['HOME'], '.to-do', 'lists')) && database[:Lists].empty?
|
17
|
+
Dir.chdir(File.join(ENV['HOME'], '.to-do', 'lists')) do
|
18
|
+
lists = Dir.entries "."
|
19
|
+
lists.each do |file|
|
20
|
+
next if file == "." or file == ".."
|
21
|
+
list_object = YAML.load_file(file)
|
22
|
+
database[:Lists].insert(:Name => list_object.name, :Total => list_object.count)
|
23
|
+
list_id = database[:Lists].count
|
24
|
+
list_object.tasks.each do |num, task|
|
25
|
+
database[:Tasks].insert(:Task_number => num.to_s, :Name => task, :Completed => 0)
|
26
|
+
task_id = database[:Tasks].count
|
27
|
+
database[:Task_list].insert(:Task_id => task_id, :List_id => list_id)
|
28
|
+
end
|
29
|
+
list_object.completed_tasks.each do |num, task|
|
30
|
+
database[:Tasks].insert(:Task_number => num.to_s, :Name => task, :Completed => 1)
|
31
|
+
task_id = database[:Tasks].count
|
32
|
+
database[:Task_list].insert(:Task_id => task_id, :List_id => list_id)
|
36
33
|
end
|
37
34
|
end
|
38
35
|
end
|
39
36
|
end
|
37
|
+
|
40
38
|
require File.join(File.dirname(__FILE__), 'to-do', 'tasks')
|
41
39
|
require File.join(File.dirname(__FILE__), 'to-do', 'cli')
|
42
40
|
|
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.5"
|
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-23"
|
13
13
|
s.description = "A simple command line todo application"
|
14
14
|
s.email = "kristen@kristen-mills.com"
|
15
15
|
s.executables = ["todo"]
|
@@ -28,6 +28,8 @@ Gem::Specification.new do |s|
|
|
28
28
|
"lib/to-do.rb",
|
29
29
|
"lib/to-do/cli.rb",
|
30
30
|
"lib/to-do/config.rb",
|
31
|
+
"lib/to-do/dbmigrations/001_create_tables.rb",
|
32
|
+
"lib/to-do/old/list.rb",
|
31
33
|
"lib/to-do/tasks.rb",
|
32
34
|
"test/helper.rb",
|
33
35
|
"test/test_to-do.rb",
|
@@ -44,7 +46,7 @@ Gem::Specification.new do |s|
|
|
44
46
|
|
45
47
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
48
|
s.add_runtime_dependency(%q<shoulda>, [">= 0"])
|
47
|
-
s.add_runtime_dependency(%q<
|
49
|
+
s.add_runtime_dependency(%q<sequel>, [">= 3.12"])
|
48
50
|
s.add_runtime_dependency(%q<bundler>, [">= 1.0.0"])
|
49
51
|
s.add_runtime_dependency(%q<jeweler>, ["~> 1.8.4"])
|
50
52
|
s.add_runtime_dependency(%q<simplecov>, [">= 0"])
|
@@ -52,7 +54,7 @@ Gem::Specification.new do |s|
|
|
52
54
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
53
55
|
else
|
54
56
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
55
|
-
s.add_dependency(%q<
|
57
|
+
s.add_dependency(%q<sequel>, [">= 3.12"])
|
56
58
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
57
59
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
58
60
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
@@ -61,7 +63,7 @@ Gem::Specification.new do |s|
|
|
61
63
|
end
|
62
64
|
else
|
63
65
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
64
|
-
s.add_dependency(%q<
|
66
|
+
s.add_dependency(%q<sequel>, [">= 3.12"])
|
65
67
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
66
68
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
67
69
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
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.5
|
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-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &70189841281860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,21 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70189841281860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: sequel
|
27
|
+
requirement: &70189841280700 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '3.12'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70189841280700
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &70189841279760 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70189841279760
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70189841181960 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.8.4
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70189841181960
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &70189841179620 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70189841179620
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: colorize
|
71
|
-
requirement: &
|
71
|
+
requirement: &70189841178880 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70189841178880
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: yard
|
82
|
-
requirement: &
|
82
|
+
requirement: &70189841177640 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70189841177640
|
91
91
|
description: A simple command line todo application
|
92
92
|
email: kristen@kristen-mills.com
|
93
93
|
executables:
|
@@ -107,6 +107,8 @@ files:
|
|
107
107
|
- lib/to-do.rb
|
108
108
|
- lib/to-do/cli.rb
|
109
109
|
- lib/to-do/config.rb
|
110
|
+
- lib/to-do/dbmigrations/001_create_tables.rb
|
111
|
+
- lib/to-do/old/list.rb
|
110
112
|
- lib/to-do/tasks.rb
|
111
113
|
- test/helper.rb
|
112
114
|
- test/test_to-do.rb
|
@@ -126,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
128
|
version: '0'
|
127
129
|
segments:
|
128
130
|
- 0
|
129
|
-
hash:
|
131
|
+
hash: 181670245826667648
|
130
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
133
|
none: false
|
132
134
|
requirements:
|