todo 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/{License.txt → LICENSE.txt} +2 -0
- data/{README.txt → README.rdoc} +13 -16
- data/Rakefile +1 -4
- data/bin/todo +1 -2
- data/lib/todo.rb +1 -2
- data/lib/todo/cli.rb +43 -46
- data/lib/todo/version.rb +4 -6
- data/spec/{todo_list_specs.rb → todo_list_spec.rb} +23 -23
- data/spec/{todo_store_specs.rb → todo_store_spec.rb} +3 -5
- data/todo.gemspec +27 -0
- metadata +68 -56
- data/Manifest.txt +0 -28
- data/config/hoe.rb +0 -71
- data/config/requirements.rb +0 -15
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -82
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/website/index.html +0 -11
- data/website/index.txt +0 -83
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.html.erb +0 -48
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
data.tar.gz: 59080b13500a1e05d58a5505d101d870732b1bd8
|
4
|
+
metadata.gz: aed1b7b5805537d015c1402c8d297d237ca32542
|
5
|
+
SHA512:
|
6
|
+
data.tar.gz: a93f3040b469d5cc553c5bef1983285052d5faafe568265df8085f382d160d72aaa108f916137dd4d5e23027c3269516a7c476e7487a14438a5fec3081f22efa
|
7
|
+
metadata.gz: 586f3e600d86f9da380b5981add91118957cb9dedccf3c367df97958bd1d1bba4f4205a6d291073a516630ce8be1f1a83ce863671b0b5c7ff2646b5b76fae959
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/{License.txt → LICENSE.txt}
RENAMED
data/{README.txt → README.rdoc}
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
= Simple command-line todo list manager
|
2
2
|
|
3
|
-
Really want to get things done? Don't want to juggle with web based todo lists?
|
4
|
-
Get your things done with command-line. No hassle, no distraction - Try out todo ruby gem.
|
3
|
+
Really want to get things done? Don't want to juggle with web based todo lists?
|
4
|
+
Get your things done with command-line. No hassle, no distraction - Try out todo ruby gem.
|
5
5
|
|
6
6
|
|
7
7
|
== FEATURES:
|
@@ -18,40 +18,37 @@ First make sure you install the dependency gems.
|
|
18
18
|
|
19
19
|
then;
|
20
20
|
sudo gem install todo
|
21
|
-
|
21
|
+
|
22
22
|
You can also install from github:
|
23
23
|
gem sources -a http://gems.github.com
|
24
24
|
sudo gem install laktek-todo
|
25
|
-
|
25
|
+
|
26
26
|
== Example:
|
27
27
|
|
28
28
|
Here is a small sample on how to use todo gem
|
29
|
-
|
29
|
+
|
30
30
|
#visit your project folder
|
31
31
|
cd projects/newapp
|
32
|
-
|
32
|
+
|
33
33
|
#create a new todo list for the project
|
34
34
|
todo create
|
35
|
-
|
35
|
+
|
36
36
|
#add a new task
|
37
37
|
todo add "write the specs"
|
38
38
|
- add tags : important, due:24/08/2008
|
39
|
-
|
39
|
+
|
40
40
|
#listing all tasks
|
41
41
|
todo list --all
|
42
|
-
|
42
|
+
|
43
43
|
#listing tasks tagged 'important'
|
44
44
|
todo list --tag important
|
45
|
-
|
45
|
+
|
46
46
|
#removing a task by name
|
47
47
|
todo remove "write the specs"
|
48
|
-
|
48
|
+
|
49
49
|
#removing a task by index
|
50
50
|
todo remove -i 1
|
51
|
-
|
52
|
-
== Issues/Improvements
|
53
|
-
|
54
|
-
Todo is still its infant days and have very minimum functionality. If you come across any issues or like to suggest any improvements, please feel free to contact me : lakshan [at] web2media [dot] net
|
55
|
-
|
56
51
|
|
52
|
+
== Issues/Improvements
|
57
53
|
|
54
|
+
Todo is still its infant days and have very minimum functionality. If you come across any issues or like to suggest any improvements, please feel free to contact me : lakshan [at] web2media [dot] net
|
data/Rakefile
CHANGED
data/bin/todo
CHANGED
data/lib/todo.rb
CHANGED
data/lib/todo/cli.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'main'
|
3
3
|
require 'highline/import'
|
4
|
-
require '
|
4
|
+
require 'fileutils'
|
5
5
|
|
6
|
-
def
|
6
|
+
def read_list(environment)
|
7
7
|
file = environment.nil? ? Todo::Store.read('.todo/list.yml') : Todo::Store.read(environment)
|
8
|
+
if file
|
9
|
+
yield(file)
|
10
|
+
else
|
11
|
+
say "Todo list file is invalid or do not exist."
|
12
|
+
end
|
8
13
|
end
|
9
14
|
|
10
|
-
def
|
15
|
+
def write_list(list, environment)
|
11
16
|
file = environment.nil? ? Todo::Store.write(list, '.todo/list.yml') : Todo::Store.write(list, environment)
|
12
17
|
end
|
13
18
|
|
@@ -16,13 +21,13 @@ Main {
|
|
16
21
|
puts "todo [command] --help for usage instructions."
|
17
22
|
puts "The available commands are: \n add, remove, list, modify."
|
18
23
|
end
|
19
|
-
|
24
|
+
|
20
25
|
mode 'create' do
|
21
26
|
description 'Creates a new todo list for this directory'
|
22
|
-
|
27
|
+
|
23
28
|
def run
|
24
29
|
unless File.exist?(".todo/list.yml")
|
25
|
-
|
30
|
+
FileUtils.makedirs(".todo")
|
26
31
|
newfile = File.new(".todo/list.yml", "w+")
|
27
32
|
say "Created a new todo list inside this directory" if newfile
|
28
33
|
newfile.close
|
@@ -31,107 +36,99 @@ Main {
|
|
31
36
|
end
|
32
37
|
end
|
33
38
|
end
|
34
|
-
|
39
|
+
|
35
40
|
mode 'add' do
|
36
41
|
description 'Adds a new todo item'
|
37
42
|
argument('item'){
|
38
|
-
description 'todo item to add'
|
43
|
+
description 'todo item to add'
|
39
44
|
}
|
40
|
-
|
45
|
+
|
41
46
|
environment('FILE'){
|
42
47
|
synopsis 'export FILE=path'
|
43
48
|
}
|
44
|
-
|
49
|
+
|
45
50
|
option('notags', 'n'){
|
46
51
|
cast :bool
|
47
|
-
default false
|
52
|
+
default false
|
48
53
|
}
|
49
|
-
|
54
|
+
|
50
55
|
def run
|
51
56
|
unless params['notags'].value
|
52
|
-
tags = ask("Enter tags for this item (
|
57
|
+
tags = ask("Enter tags for this item (separate with commas) ", lambda {|str|
|
53
58
|
str.split(/,\s*/) })
|
54
59
|
end
|
55
|
-
|
56
|
-
|
57
|
-
if list=read_file(params['FILE'].value)
|
58
|
-
#add the task
|
60
|
+
|
61
|
+
read_list(params['FILE'].value) do |list|
|
59
62
|
list.add(params['item'].value, tags)
|
60
|
-
|
61
|
-
say "Successfully added your task." if write_file(list, params['FILE'].value)
|
62
|
-
else
|
63
|
-
say "Todo list file is invalid or do not exist."
|
63
|
+
say "Successfully added your task." if write_list(list, params['FILE'].value)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
mode 'remove' do
|
69
69
|
description 'Removes an item from todo list'
|
70
|
-
|
70
|
+
|
71
71
|
environment('FILE'){
|
72
72
|
synopsis 'export FILE=path'
|
73
73
|
}
|
74
|
-
|
74
|
+
|
75
75
|
argument('item'){
|
76
|
-
argument_optional
|
76
|
+
argument_optional
|
77
77
|
description 'Name of the todo item to remove'
|
78
78
|
}
|
79
|
-
|
79
|
+
|
80
80
|
option('index', 'i'){
|
81
81
|
cast :int
|
82
82
|
argument :required
|
83
83
|
description 'Index of the todo item to remove (starting from 1). Use instead of item name'
|
84
84
|
}
|
85
|
-
|
85
|
+
|
86
86
|
def run
|
87
|
-
|
87
|
+
read_list(params['FILE'].value) do |list|
|
88
88
|
if list.remove(params['item'].value || params['index'].value)
|
89
|
-
say "Removed item from the list." if
|
90
|
-
else
|
89
|
+
say "Removed item from the list." if write_list(list, params['FILE'].value)
|
90
|
+
else
|
91
91
|
say "Could not find item to remove."
|
92
92
|
end
|
93
|
-
|
94
|
-
say "Todo list file is invalid or do not exist."
|
95
|
-
end
|
93
|
+
end
|
96
94
|
end
|
97
95
|
end
|
98
|
-
|
96
|
+
|
99
97
|
mode 'list' do
|
100
98
|
description 'Lists todo items'
|
101
|
-
|
99
|
+
|
102
100
|
environment('FILE'){
|
103
101
|
synopsis 'export barfoo=value'
|
104
102
|
}
|
105
|
-
|
103
|
+
|
106
104
|
option('tag', 't'){
|
107
|
-
argument_required
|
105
|
+
argument_required
|
108
106
|
}
|
109
|
-
|
107
|
+
|
110
108
|
option('all=[all]', 'a'){ # note shortcut syntax for optional args
|
111
109
|
#argument_optional # we could also use this method
|
112
110
|
cast :bool
|
113
111
|
default false
|
114
112
|
}
|
115
|
-
|
113
|
+
|
116
114
|
def run
|
117
|
-
|
118
|
-
|
115
|
+
read_list(params['FILE'].value) do |list|
|
116
|
+
|
119
117
|
if params['tag'].given?
|
120
118
|
title = "Listing todos tagged '#{params['tag'].value}'"
|
121
|
-
tasks = list.tagged(params['tag'].value)
|
119
|
+
tasks = list.tagged(params['tag'].value)
|
122
120
|
else
|
123
121
|
title = "Listing all todos"
|
124
122
|
tasks = list
|
125
123
|
end
|
126
|
-
|
124
|
+
|
127
125
|
say title
|
128
126
|
tasks.each do |task, tags|
|
129
127
|
tag_string = ("(#{tags.join(", ")})") unless tags.include?(nil)
|
130
128
|
say " - #{task} #{tag_string} \n"
|
131
129
|
end
|
132
|
-
|
133
|
-
say "Todo list file is invalid or do not exist."
|
130
|
+
|
134
131
|
end
|
135
|
-
end
|
132
|
+
end
|
136
133
|
end
|
137
134
|
}
|
data/lib/todo/version.rb
CHANGED
@@ -1,63 +1,63 @@
|
|
1
|
-
require
|
1
|
+
require 'todo/list'
|
2
2
|
|
3
3
|
describe "Todo::List" do
|
4
|
-
|
4
|
+
|
5
5
|
describe "filtering by tag" do
|
6
6
|
before(:each) do
|
7
7
|
@todolist = Todo::List["dummy task" => ["added:31-07-2008", "important"], "Buy milk" => ["important", "home"]]
|
8
8
|
@list_with_task_tagged_home = {"Buy milk" => ["important", "home"]}
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
it "should return matched items by tag" do
|
12
12
|
@todolist.tagged("important").should == @todolist
|
13
13
|
end
|
14
|
-
|
15
|
-
it "should filter items by tags" do
|
16
|
-
@todolist.tagged("home").should == @list_with_task_tagged_home
|
14
|
+
|
15
|
+
it "should filter items by tags" do
|
16
|
+
@todolist.tagged("home").should == @list_with_task_tagged_home
|
17
17
|
end
|
18
|
-
|
19
|
-
it "should be able to apply chain of filters" do
|
18
|
+
|
19
|
+
it "should be able to apply chain of filters" do
|
20
20
|
@todolist.tagged("important").tagged("home").should == @list_with_task_tagged_home
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
describe "add" do
|
26
26
|
before(:each) do
|
27
27
|
@todolist =Todo::List["dummy task" => ["added:31-07-2008", "important"]]
|
28
28
|
@after_list =Todo::List["dummy task" => ["added:31-07-2008", "important"], "Buy milk" => []]
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
it "should add new item to the exisitng task list" do
|
32
32
|
@todolist.add("Buy milk").should == @after_list
|
33
|
-
end
|
34
|
-
|
33
|
+
end
|
34
|
+
|
35
35
|
it "should accept list of tags with the item" do
|
36
36
|
list_with_tags_added = {"dummy task" => ["added:31-07-2008", "important"], "Buy milk" => ["important", "assigned:mom"]}
|
37
|
-
|
37
|
+
|
38
38
|
@todolist.add("Buy milk", "important", "assigned:mom").should == list_with_tags_added
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
describe "remove" do
|
44
44
|
before(:each) do
|
45
45
|
@todolist =Todo::List["dummy task" => ["added:31-07-2008", "important"], "Buy milk" => []]
|
46
|
-
@after_list =Todo::List["dummy task" => ["added:31-07-2008", "important"]]
|
46
|
+
@after_list =Todo::List["dummy task" => ["added:31-07-2008", "important"]]
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
it "should remove a task by name" do
|
50
50
|
@todolist.remove("Buy milk").should == @after_list
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
it "should remove a task by its index" do
|
54
54
|
@todolist.remove(2).should == @after_list
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
it "should return nil if the task is not found" do
|
58
58
|
@todolist.remove("not done").should == nil
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
end
|
62
|
-
|
63
|
-
end
|
62
|
+
|
63
|
+
end
|
@@ -1,10 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require 'todo/store'
|
2
2
|
|
3
|
-
describe "Todo::
|
3
|
+
describe "Todo::CLI" do
|
4
4
|
it "should read the YAML file and output Todo::List hash" do
|
5
5
|
#list = {"Buy milk" => ["important", "home"]}
|
6
6
|
#Todo::Store.read(list.to_yaml).should be_an_instance_of(Todo::List)
|
7
7
|
end
|
8
|
-
|
9
|
-
it "should output a modified YAML file"
|
10
|
-
end
|
8
|
+
end
|
data/todo.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'todo/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "todo"
|
8
|
+
spec.version = Todo::VERSION
|
9
|
+
spec.authors = ["Lakshan Perera", "Aniket Pant"]
|
10
|
+
spec.email = ["lakshan@web2media.net", "me@aniketpant.com"]
|
11
|
+
spec.description = %q{simple command line todo list manager}
|
12
|
+
spec.summary = %q{simple command line todo list manager}
|
13
|
+
spec.homepage = %q{http://todo.rubyforge.org}
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec", "~> 2.6"
|
24
|
+
|
25
|
+
spec.add_runtime_dependency "main", ">= 2.8.2"
|
26
|
+
spec.add_runtime_dependency "highline", ">= 1.4.0"
|
27
|
+
end
|