dooby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Rafael Magana
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,221 @@
1
+ dooby
2
+ =====
3
+
4
+ A **very simplistic** command-line to-do/note list manager in Ruby.
5
+
6
+ WARNING!!!
7
+ -------
8
+
9
+ You should know this gem lacks of fancy things, meaning: social, cloud, mobile, web interface, etc.
10
+
11
+ Why another to-do list manager?
12
+ ----
13
+
14
+ I spend a lot of time in the terminal and I didn't really like any of the current options.
15
+
16
+ How does Dooby works?
17
+ ---------------------
18
+
19
+ Dooby is directory-based, so you can maintain different to-do/notes lists in every directory you want.
20
+
21
+ For instance, I use one to-do list per project, that way I don't have all the tasks in one place. So if I want to check my tasks for the project MySite I just cd to the directory and start using Dooby. That's it.
22
+
23
+ Usage
24
+ -----
25
+
26
+ ### Special characters
27
+
28
+ Dooby uses some characters to visually help us to differentiate between things
29
+
30
+ **@ => person** (@peter, @john)
31
+
32
+ **# => tag** (#today, #tomorrow, #urgent, #work)
33
+
34
+ **% => project** (%website, %store)
35
+
36
+ **: => status** (:hold, :doing, :done)
37
+
38
+ **^ => priority** (^1, ^2, ^3)
39
+
40
+ Most of the characters doesn't have any meaning, only some of them like:
41
+
42
+ #today
43
+ #urgent
44
+ #tomorrow
45
+
46
+ ###Creating an alias
47
+
48
+ $ alias d='dooby'
49
+
50
+ ### Initializing Dooby
51
+
52
+ $ d init
53
+
54
+ This creates a **.dooby/list.yml** file in the current directory. Dooby will save all the tasks on it.
55
+
56
+ ### Adding items
57
+
58
+ $ d add "#fix the email error in %website, talk to @peter #today"
59
+
60
+ $ d a "learn to use the #aliases of the #commands"
61
+
62
+ ### Listing items
63
+
64
+ $ d list @peter
65
+
66
+ $ d l today
67
+
68
+ $ d l %website
69
+
70
+ $ d l @
71
+ > shows tasks related to people
72
+
73
+ $ d l %
74
+ > shows all the tasks with a related project
75
+
76
+ #### Listing items interactively
77
+
78
+ $ d il
79
+
80
+ > #today
81
+ Showing items containing: #today
82
+ (b954bf) #fix the email error in %website, talk to @peter #today
83
+ (9cfbf4) Need to go to the #doctor #today
84
+
85
+ > #doctor
86
+ Showing items containing: #doctor
87
+ (9cfbf4) Need to go to the #doctor #today
88
+
89
+ > email
90
+ Showing items containing: email
91
+ (b954bf) #fix the email error in %website, talk to @peter #today
92
+
93
+ **Note:** Dooby uses SHA1 as Task ID.
94
+
95
+ ### Editing items
96
+
97
+ **Dooby** supports autocompletion of task IDs in the *delete* and the *edit* commands, to fire it just do the same as in a bash shell, press TAB TAB.
98
+
99
+ $ d edit
100
+
101
+ or
102
+
103
+ $ d e
104
+ Task ID > TAB TAB
105
+ b954bf 9cfbf4 (we only have 2 tasks)
106
+
107
+ $ d e
108
+ Task ID > b TAB
109
+
110
+ and you'll see that the task id have been auto-completed
111
+
112
+ $ d e
113
+ Task ID > b954bf
114
+
115
+ now press Enter and TAB TAB again if you want the original text of the item:
116
+
117
+ $ d e
118
+ Task ID > b954bf
119
+ TAB or up arrow to edit > TAB
120
+
121
+ $ d e
122
+ Task ID > b954bf
123
+ TAB or up arrow to edit > #fix the email error in %website, talk to @peter #today
124
+
125
+ $ d e
126
+ Task ID > b954bf
127
+ TAB or up arrow to edit > #fix the email error in %website #today
128
+
129
+ Edit it and press Enter and the task will be saved.
130
+
131
+ ### Deleting items
132
+
133
+ $ d delete
134
+
135
+ or
136
+
137
+ $ d d
138
+ Task ID > TAB TAB
139
+ 521a3d 9cfbf4
140
+
141
+ **Note:** the *SHA1* of the task we edited previously has changed because it's based on the content
142
+
143
+ $ d d
144
+ Task ID > 9cfbf4
145
+ 9cfbf4 deleted...
146
+
147
+ **Dooby** won't ask you if you really want to delete the task.
148
+
149
+ $ d l
150
+ Showing all items...
151
+ (521a3d) #fix the email error in %website #today
152
+
153
+ ### Deleting all the items
154
+
155
+ $ d flush
156
+
157
+ or
158
+
159
+ $ d f
160
+ Sure??? (yes/no)
161
+ yes
162
+ All the task were deleted!
163
+
164
+ ### Deleting the **.dooby** directory and all the tasks
165
+
166
+ $ d trash
167
+
168
+ or
169
+
170
+ $ d t
171
+ Sure??? (yes/no)
172
+ yes
173
+ No more dooby here T_T
174
+
175
+ ### Help
176
+
177
+ You can check the help out using the -h flag
178
+
179
+ $ d -h
180
+
181
+ $ d t -h
182
+
183
+ $ d l -h
184
+ NAME
185
+ dooby
186
+
187
+ SYNOPSIS
188
+ dooby list [what_to_show*] [options]+
189
+
190
+ DESCRIPTION
191
+ Lists @people, #tags, %projects or tasks (default)
192
+
193
+ PARAMETERS
194
+ what_to_show (-1 ~> what_to_show)
195
+ --help, -h
196
+
197
+
198
+ Special Thanks
199
+ --------------
200
+
201
+ Most of the the ideas to code **dooby** were based on the work of other programmers, here's a list of all of them:
202
+
203
+ **Gina Trapani** ([http://github.com/ginatrapani/todo.txt-cli](http://github.com/ginatrapani/todo.txt-cli "todo.txt-cli"))
204
+ **Lakshan Perera** ([http://github.com/laktek/todo](http://github.com/laktek/todo))
205
+ **Scott Chacon** ([http://github.com/schacon/ticgit](http://github.com/schacon/ticgit))
206
+
207
+ Thanks all of you!
208
+
209
+ == Note on Patches/Pull Requests
210
+
211
+ * Fork the project.
212
+ * Make your feature addition or bug fix.
213
+ * Add tests for it. This is important so I don't break it in a
214
+ future version unintentionally.
215
+ * Commit, do not mess with rakefile, version, or history.
216
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
217
+ * Send me a pull request. Bonus points for topic branches.
218
+
219
+ == Copyright
220
+
221
+ Copyright (c) 2010 Rafael Magana. See LICENSE for details.
@@ -0,0 +1,59 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'rubygems'
3
+ require 'rake'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = "dooby"
9
+ gem.summary = %Q{A very simplistic command-line to-do list manager in Ruby}
10
+ gem.description = %Q{A very simplistic command-line to-do list manager in Ruby}
11
+ gem.email = "raf.magana@gmail.com"
12
+ gem.homepage = "http://github.com/rafmagana/dooby"
13
+ gem.authors = ["Rafael Magaña"]
14
+ gem.add_development_dependency "shoulda", ">= 2.11.3"
15
+ gem.add_development_dependency "mocha", ">= 0.9.8"
16
+ #gem.add_runtime_dependency('main', ">= 4.2.0")
17
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
+ end
19
+ Jeweler::GemcutterTasks.new
20
+ rescue LoadError
21
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
22
+ end
23
+
24
+ require 'rake/testtask'
25
+ Rake::TestTask.new(:test) do |test|
26
+ test.libs << 'lib' << 'test'
27
+ test.pattern = 'test/**/test_*.rb'
28
+ test.verbose = true
29
+ end
30
+
31
+ begin
32
+ require 'rcov/rcovtask'
33
+ Rcov::RcovTask.new do |test|
34
+ test.libs << 'test'
35
+ test.pattern = 'test/**/test_*.rb'
36
+ test.verbose = true
37
+ end
38
+ rescue LoadError
39
+ task :rcov do
40
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
41
+ end
42
+ end
43
+
44
+ task :test => :check_dependencies
45
+
46
+ task :default => :test
47
+
48
+ require 'rake/rdoctask'
49
+ Rake::RDocTask.new do |rdoc|
50
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
51
+
52
+ rdoc.rdoc_dir = 'rdoc'
53
+ rdoc.title = "dooby #{version}"
54
+ rdoc.rdoc_files.include('README*')
55
+ rdoc.rdoc_files.include('lib/**/*.rb')
56
+ end
57
+
58
+ task :bi => [:build, :install]
59
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,150 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ STDOUT.sync = true
4
+
5
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
6
+
7
+ require 'rubygems'
8
+ require 'main'
9
+ require 'dooby'
10
+
11
+ ORIGINAL_ARGV = ARGV.dup
12
+
13
+ stty_save = `stty -g`.chomp
14
+
15
+ Main {
16
+
17
+ def run
18
+ puts Dooby.current_list.list
19
+ end
20
+
21
+ mode 'init' do
22
+ description 'Creates .dooby/list.yml file'
23
+ def run
24
+ Dooby.init
25
+ end
26
+ end
27
+
28
+ mode 'flush' do
29
+ description 'Deletes all the tasks'
30
+ def run
31
+ puts "Sure???".red_on_white.bold + " (yes/no)".red.bold
32
+ sure = STDIN.gets
33
+ if sure.chomp == 'yes'
34
+ Dooby.current_list.flush!
35
+ puts "All the task were deleted!".red.bold
36
+ else
37
+ puts "Keep doing things!".green.bold
38
+ end
39
+ end
40
+ end
41
+
42
+ mode 'trash' do
43
+ description 'Deletes the .dooby directory'
44
+ def run
45
+ puts "Sure???".red_on_white.bold + " (yes/no)".red.bold
46
+ sure = STDIN.gets
47
+ if sure.chomp == 'yes'
48
+ Dooby.trash!
49
+ puts "No more dooby here T_T".red.bold
50
+ else
51
+ puts "Keep doing things!".green.bold
52
+ end
53
+ end
54
+ end
55
+
56
+ mode 'add' do
57
+ description 'Creates a new task and adds it to the current todo list'
58
+ argument 'task_text'
59
+ def run
60
+ Dooby.current_list.add do |t|
61
+ t.todo = params[:task_text].value
62
+ t.hold!
63
+ end
64
+
65
+ puts 'Task added!'
66
+ end
67
+ end
68
+
69
+ mode 'ilist' do
70
+ description "Interactive Listing"
71
+ def run
72
+ puts "input #hashtag, @person, %project, :status or simple text"
73
+ while line = Readline.readline('> ', true)
74
+ puts
75
+ puts Dooby.current_list.list line.split(' ')
76
+ puts
77
+ end
78
+ end
79
+ end
80
+
81
+ mode 'list' do
82
+ description 'Lists @people, #tags, %projects or tasks (default)'
83
+
84
+ argument('what_to_show'){
85
+ arity -1 # zero or more arguments
86
+ }
87
+
88
+ def run
89
+ puts Dooby.current_list.list params[:what_to_show].values
90
+ end
91
+ end
92
+
93
+ mode 'delete' do
94
+ def run
95
+ if Dooby.current_list.tasks.empty?
96
+ puts 'No tasks to delete'.red
97
+ exit
98
+ end
99
+
100
+ Dooby.readline_helper.completion_list = Dooby.current_list.tasks.keys
101
+
102
+ task_id = ''
103
+
104
+ while line = Readline.readline('Task ID '.red.bold + '> ')
105
+ task_id = line.chomp.strip
106
+ if Dooby.current_list.delete! task_id
107
+ puts task_id + ' deleted...'
108
+ exit
109
+ else
110
+ puts "Don't try to fool #{'Dooby'.red}, she knows such task doesn't exists"
111
+ end
112
+ end
113
+ end
114
+ end
115
+
116
+ mode 'edit' do
117
+ def run
118
+ Dooby.readline_helper.completion_list = Dooby.current_list.tasks.keys
119
+
120
+ task_id = ''
121
+
122
+ while line = Readline.readline('Task ID '.blue.bold + '> ')
123
+ task_id = line.chomp.strip
124
+ if Dooby.current_list.tasks.key? task_id
125
+ todo_to_edit = Dooby.current_list.tasks[task_id].todo
126
+ Readline::HISTORY.push todo_to_edit
127
+ Dooby.readline_helper.completion_list = [todo_to_edit]
128
+ break
129
+ else
130
+ puts "Task doesn't exist".red.bold
131
+ exit
132
+ end
133
+ end
134
+
135
+ while line = Readline.readline('TAB or up arrow to edit '.blue.bold + '> ')
136
+ if line
137
+ Dooby.current_list.edit!(task_id, line.chomp.strip)
138
+ exit
139
+ end
140
+ end
141
+
142
+
143
+ rescue Interrupt
144
+ system("stty", stty_save)
145
+ exit
146
+
147
+ end
148
+ end
149
+
150
+ }
@@ -0,0 +1,66 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{dooby}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Rafael Maga\303\261a"]
12
+ s.date = %q{2010-10-27}
13
+ s.default_executable = %q{dooby}
14
+ s.description = %q{A very simplistic command-line to-do list manager in Ruby}
15
+ s.email = %q{raf.magana@gmail.com}
16
+ s.executables = ["dooby"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README.md"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ ".gitignore",
24
+ "LICENSE",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/dooby",
29
+ "dooby.gemspec",
30
+ "lib/dooby.rb",
31
+ "lib/dooby/base.rb",
32
+ "lib/dooby/exceptions.rb",
33
+ "lib/dooby/formatter.rb",
34
+ "lib/dooby/list.rb",
35
+ "lib/dooby/readline_helper.rb",
36
+ "lib/dooby/task.rb",
37
+ "test/helper.rb",
38
+ "test/test_dooby.rb"
39
+ ]
40
+ s.homepage = %q{http://github.com/rafmagana/dooby}
41
+ s.rdoc_options = ["--charset=UTF-8"]
42
+ s.require_paths = ["lib"]
43
+ s.rubygems_version = %q{1.3.7}
44
+ s.summary = %q{A very simplistic command-line to-do list manager in Ruby}
45
+ s.test_files = [
46
+ "test/helper.rb",
47
+ "test/test_dooby.rb"
48
+ ]
49
+
50
+ if s.respond_to? :specification_version then
51
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
52
+ s.specification_version = 3
53
+
54
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
+ s.add_development_dependency(%q<shoulda>, [">= 2.11.3"])
56
+ s.add_development_dependency(%q<mocha>, [">= 0.9.8"])
57
+ else
58
+ s.add_dependency(%q<shoulda>, [">= 2.11.3"])
59
+ s.add_dependency(%q<mocha>, [">= 0.9.8"])
60
+ end
61
+ else
62
+ s.add_dependency(%q<shoulda>, [">= 2.11.3"])
63
+ s.add_dependency(%q<mocha>, [">= 0.9.8"])
64
+ end
65
+ end
66
+
@@ -0,0 +1,49 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+
3
+ %w[fileutils digest/sha1 colored readline].each { |f| require "#{f}" }
4
+
5
+ %w[exceptions
6
+ base
7
+ list
8
+ formatter
9
+ task
10
+ readline_helper].each { |f| require "dooby/#{f}" }
11
+
12
+ module Dooby
13
+
14
+ DOOBY_DIR = '.dooby'
15
+ CURRENT_TODO_LIST_FILE = "#{DOOBY_DIR}/list.yml"
16
+
17
+ DEFAULT_PRIORITY = 5
18
+ DEFAULT_STATUS = :hold
19
+
20
+ AVAILABLE_STATUSES = [:hold, :doing, :done]
21
+
22
+ def self.init
23
+ unless File.exist? CURRENT_TODO_LIST_FILE
24
+ FileUtils.mkdir DOOBY_DIR
25
+ Base.create_file
26
+ true
27
+ else
28
+ puts "Todo list already exists inside this directory"
29
+ false
30
+ end
31
+ end
32
+
33
+ def self.trash!
34
+ FileUtils.remove_dir(DOOBY_DIR, force = true)
35
+ end
36
+
37
+ def self.current_list
38
+ @list ||= List.new CURRENT_TODO_LIST_FILE
39
+ end
40
+
41
+ def self.reload!
42
+ @list = nil
43
+ current_list
44
+ end
45
+
46
+ def self.readline_helper
47
+ @readline_helper ||= ReadlineHelper.new
48
+ end
49
+ end
@@ -0,0 +1,11 @@
1
+ require 'yaml'
2
+
3
+ module Dooby
4
+ class Base
5
+ def self.create_file
6
+ dooby_file = File.new CURRENT_TODO_LIST_FILE, "w+"
7
+ puts "Created a new todo list inside this directory" if dooby_file
8
+ dooby_file.close
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Dooby
2
+ module Exceptions
3
+ class NoYAMLFileFound < StandardError; end
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module Dooby
2
+ module Formateable
3
+ def format
4
+ "formatted"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,98 @@
1
+ module Dooby
2
+
3
+ class List
4
+
5
+ attr_reader :location
6
+
7
+ def initialize(location)
8
+ @location = location
9
+ @tasks = {}
10
+ load!
11
+ end
12
+
13
+ def flush!
14
+ @tasks = {}
15
+ save!
16
+ end
17
+
18
+ def add(task = Task.new)
19
+ yield task if block_given?
20
+ @tasks[task.id] = task
21
+ save!
22
+ end
23
+
24
+ def delete!(task_id)
25
+ if @tasks.delete task_id
26
+ save!
27
+ else
28
+ false
29
+ end
30
+ end
31
+
32
+ def edit!(task_id, new_text)
33
+ old_task = @tasks[task_id]
34
+ delete! task_id
35
+ add do |t|
36
+ t.todo = new_text
37
+ t.priority = old_task.priority
38
+ t.status = old_task.status
39
+ end
40
+ end
41
+
42
+ def tasks
43
+ @tasks.dup
44
+ end
45
+
46
+ def list (what_to_show=[])
47
+ list = []
48
+
49
+ if @tasks.empty?
50
+ list = 'No tasks'
51
+ else
52
+ if what_to_show.empty?
53
+ list << 'Showing all items...'.blue_on_white.bold
54
+ @tasks.each do |id, task|
55
+ list << " (#{id.red}) #{task.colorize}"
56
+ end
57
+ else
58
+ @tasks.each do |id, task|
59
+ if what_to_show.all? { |term| task.todo.include? term }
60
+ list << " (#{id.red}) #{task.colorize}"
61
+ end
62
+ end
63
+
64
+ if list.empty?
65
+ list.unshift 'No items found containing:'.red_on_white.bold + ' ' + what_to_show.join(' and '.blue)
66
+ else
67
+ list.unshift 'Showing items containing:'.blue_on_white.bold + ' ' + what_to_show.join(' and '.blue)
68
+ end
69
+ end
70
+ end
71
+
72
+ list
73
+ end
74
+
75
+ private
76
+ def save!
77
+ File.open( @location, 'w' ) do |f|
78
+ f << @tasks.to_yaml
79
+ end
80
+ end
81
+
82
+ def load!
83
+ begin
84
+ if File.exist? CURRENT_TODO_LIST_FILE
85
+ @tasks = YAML.load_file(@location)
86
+ @tasks = {} unless @tasks
87
+ else
88
+ raise Exceptions::NoYAMLFileFound.new
89
+ end
90
+
91
+ rescue Exceptions::NoYAMLFileFound
92
+ puts "Todo list file is invalid or do not exist."
93
+ end
94
+ end
95
+
96
+ end
97
+
98
+ end
@@ -0,0 +1,13 @@
1
+ module Dooby
2
+ class ReadlineHelper
3
+ attr_accessor :completion_list
4
+
5
+ def initialize
6
+ @completion_list = ''
7
+ @completion_proc = proc { |s| @completion_list.grep( /^#{Regexp.escape(s)}/ ) }
8
+
9
+ Readline.completion_append_character = " "
10
+ Readline.completion_proc = @completion_proc
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,50 @@
1
+ module Dooby
2
+ class Task
3
+ include Formateable
4
+
5
+ attr_accessor :todo, :priority, :status
6
+
7
+ def initialize
8
+ @todo ||= nil
9
+ @status ||= DEFAULT_STATUS
10
+ @priority ||= DEFAULT_PRIORITY
11
+ end
12
+
13
+ def id
14
+ @todo ? Digest::SHA1.hexdigest(@todo)[0,6] : nil
15
+ end
16
+
17
+ def valid?
18
+ @todo.nil? || @todo == '' ? false : true
19
+ end
20
+
21
+ def doing!
22
+ @status = :doing
23
+ end
24
+
25
+ def done!
26
+ @status = :done
27
+ end
28
+
29
+ def hold!
30
+ @status = :hold
31
+ end
32
+
33
+ def colorize
34
+ colorized_todo = @todo.dup
35
+
36
+ colorized_todo.gsub(/(#\w+)|(@\w+)|(%\w+)/).each do |todo|
37
+ if todo.include? "@"
38
+ todo.blue
39
+ elsif todo.include? "%"
40
+ todo.white
41
+ else
42
+ todo.yellow
43
+ end
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'dooby'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestDooby < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dooby
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - "Rafael Maga\xC3\xB1a"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-27 00:00:00 -05:00
19
+ default_executable: dooby
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: shoulda
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 37
30
+ segments:
31
+ - 2
32
+ - 11
33
+ - 3
34
+ version: 2.11.3
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: mocha
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 43
46
+ segments:
47
+ - 0
48
+ - 9
49
+ - 8
50
+ version: 0.9.8
51
+ type: :development
52
+ version_requirements: *id002
53
+ description: A very simplistic command-line to-do list manager in Ruby
54
+ email: raf.magana@gmail.com
55
+ executables:
56
+ - dooby
57
+ extensions: []
58
+
59
+ extra_rdoc_files:
60
+ - LICENSE
61
+ - README.md
62
+ files:
63
+ - .document
64
+ - .gitignore
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - VERSION
69
+ - bin/dooby
70
+ - dooby.gemspec
71
+ - lib/dooby.rb
72
+ - lib/dooby/base.rb
73
+ - lib/dooby/exceptions.rb
74
+ - lib/dooby/formatter.rb
75
+ - lib/dooby/list.rb
76
+ - lib/dooby/readline_helper.rb
77
+ - lib/dooby/task.rb
78
+ - test/helper.rb
79
+ - test/test_dooby.rb
80
+ has_rdoc: true
81
+ homepage: http://github.com/rafmagana/dooby
82
+ licenses: []
83
+
84
+ post_install_message:
85
+ rdoc_options:
86
+ - --charset=UTF-8
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ hash: 3
95
+ segments:
96
+ - 0
97
+ version: "0"
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ requirements: []
108
+
109
+ rubyforge_project:
110
+ rubygems_version: 1.3.7
111
+ signing_key:
112
+ specification_version: 3
113
+ summary: A very simplistic command-line to-do list manager in Ruby
114
+ test_files:
115
+ - test/helper.rb
116
+ - test/test_dooby.rb