dooby 0.2.0 → 0.3.0
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/.rspec +2 -0
- data/CHANGELOG.md +38 -0
- data/Gemfile +13 -3
- data/Gemfile.lock +24 -0
- data/README.md +109 -99
- data/Rakefile +36 -37
- data/VERSION +1 -1
- data/bin/dooby +36 -20
- data/dooby.gemspec +62 -31
- data/lib/dooby.rb +12 -13
- data/lib/dooby/cli_helper.rb +5 -2
- data/lib/dooby/config.rb +29 -0
- data/lib/dooby/core_ext.rb +15 -1
- data/lib/dooby/dates_helper.rb +23 -0
- data/lib/dooby/list.rb +60 -18
- data/lib/dooby/status_generator.rb +13 -0
- data/lib/dooby/task.rb +14 -30
- data/spec/dooby_module_spec.rb +53 -0
- data/spec/list_spec.rb +167 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/task_spec.rb +51 -0
- metadata +154 -33
- data/.gitignore +0 -21
- data/lib/dooby/formatter.rb +0 -7
data/Rakefile
CHANGED
@@ -1,51 +1,50 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
require 'rubygems'
|
3
|
-
require '
|
3
|
+
require 'bundler'
|
4
4
|
|
5
5
|
begin
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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.add_runtime_dependency('colored', ">= 1.2")
|
18
|
-
gem.add_runtime_dependency('highline', ">= 1.6.1")
|
19
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
|
-
end
|
21
|
-
Jeweler::GemcutterTasks.new
|
22
|
-
rescue LoadError
|
23
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
24
11
|
end
|
12
|
+
require 'rake'
|
25
13
|
|
26
|
-
require '
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
14
|
+
require 'jeweler'
|
15
|
+
|
16
|
+
Jeweler::Tasks.new do |gem|
|
17
|
+
gem.name = "dooby"
|
18
|
+
gem.summary = %Q{A very simplistic command-line to-do list manager in Ruby}
|
19
|
+
gem.description = %Q{Handle your to-do/notes list through the command line}
|
20
|
+
gem.email = "raf.magana@gmail.com"
|
21
|
+
gem.homepage = "http://github.com/rafmagana/dooby"
|
22
|
+
gem.authors = ["Rafael Magaña"]
|
23
|
+
|
24
|
+
gem.add_runtime_dependency('main', ">= 4.2.0")
|
25
|
+
gem.add_runtime_dependency('colored', ">= 1.2")
|
26
|
+
gem.add_runtime_dependency('highline', ">= 1.6.1")
|
27
|
+
gem.add_runtime_dependency('chronic', ">= 0.3.0")
|
28
|
+
|
29
|
+
gem.add_development_dependency "rspec", ">= 2.0.1"
|
30
|
+
gem.add_development_dependency "bundler", "~> 1.0.0"
|
31
|
+
gem.add_development_dependency "jeweler", "~> 1.5.0.pre5"
|
32
|
+
gem.add_development_dependency "rcov", ">= 0"
|
31
33
|
end
|
34
|
+
Jeweler::RubygemsDotOrgTasks.new
|
32
35
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
test.pattern = 'test/**/test_*.rb'
|
38
|
-
test.verbose = true
|
39
|
-
end
|
40
|
-
rescue LoadError
|
41
|
-
task :rcov do
|
42
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
43
|
-
end
|
36
|
+
require 'rspec/core'
|
37
|
+
require 'rspec/core/rake_task'
|
38
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
39
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
44
40
|
end
|
45
41
|
|
46
|
-
|
42
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
43
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
44
|
+
spec.rcov = true
|
45
|
+
end
|
47
46
|
|
48
|
-
task :default => :
|
47
|
+
task :default => :spec
|
49
48
|
|
50
49
|
require 'rake/rdoctask'
|
51
50
|
Rake::RDocTask.new do |rdoc|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/bin/dooby
CHANGED
@@ -14,7 +14,7 @@ Main {
|
|
14
14
|
|
15
15
|
########################## DEFAULT #############################
|
16
16
|
def run
|
17
|
-
list = Dooby.current_list.
|
17
|
+
list = Dooby.current_list.find.tasks_by_tag(*Dooby::SPLITTABLE_TAGS)
|
18
18
|
if list
|
19
19
|
say 'Showing all items...'.blue_on_white.bold
|
20
20
|
puts list
|
@@ -34,15 +34,14 @@ Main {
|
|
34
34
|
|
35
35
|
########################## ADD #################################
|
36
36
|
mode 'add' do
|
37
|
-
description 'Creates a new
|
37
|
+
description 'Creates a new item and adds it to the current todo list'
|
38
38
|
argument 'task_text'
|
39
39
|
def run
|
40
40
|
Dooby.current_list.add do |t|
|
41
41
|
t.todo = params[:task_text].value
|
42
|
-
t.hold!
|
43
42
|
end
|
44
43
|
|
45
|
-
puts '
|
44
|
+
puts 'Item added!'
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
@@ -50,18 +49,19 @@ Main {
|
|
50
49
|
mode 'ilist' do
|
51
50
|
description "Interactive Listing"
|
52
51
|
def run
|
52
|
+
autocomp = Dooby.current_list.all_tags
|
53
53
|
say "input #hashtag, @person, %project, :status or simple text"
|
54
54
|
|
55
|
-
Dooby.cli_helper.keep_asking "> " do |what_to_show|
|
55
|
+
Dooby.cli_helper.keep_asking "> ", autocomp do |what_to_show|
|
56
56
|
puts
|
57
|
-
puts Dooby.current_list.
|
57
|
+
puts Dooby.current_list.find(what_to_show.split(' ')).tasks_by_tag(*Dooby::SPLITTABLE_TAGS)
|
58
58
|
puts
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
mode 'list' do
|
64
|
-
description 'Lists @people, #tags, %projects or
|
64
|
+
description 'Lists @people, #tags, %projects or items (default)'
|
65
65
|
|
66
66
|
argument('what_to_show'){
|
67
67
|
arity -1 # zero or more arguments
|
@@ -69,7 +69,7 @@ Main {
|
|
69
69
|
|
70
70
|
def run
|
71
71
|
what_to_show = params[:what_to_show].values
|
72
|
-
list = Dooby.current_list.
|
72
|
+
list = Dooby.current_list.find(what_to_show).tasks_by_tag(*Dooby::SPLITTABLE_TAGS)
|
73
73
|
if list
|
74
74
|
if what_to_show.empty?
|
75
75
|
say 'Showing all items...'.blue_on_white.bold
|
@@ -102,7 +102,7 @@ Main {
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def handle_tag_lists(tag, error_message)
|
105
|
-
list = Dooby.current_list.
|
105
|
+
list = Dooby.current_list.find tag
|
106
106
|
if list
|
107
107
|
puts list
|
108
108
|
else
|
@@ -112,11 +112,11 @@ Main {
|
|
112
112
|
|
113
113
|
########################## DELETE ###############################
|
114
114
|
mode 'flush' do
|
115
|
-
description 'Deletes all the
|
115
|
+
description 'Deletes all the items'
|
116
116
|
def run
|
117
117
|
if Dooby.cli_helper.flush?
|
118
118
|
Dooby.current_list.flush!
|
119
|
-
say "All the
|
119
|
+
say "All the items were deleted!".red.bold
|
120
120
|
else
|
121
121
|
say "Keep doing things!".green.bold
|
122
122
|
end
|
@@ -138,12 +138,12 @@ Main {
|
|
138
138
|
mode 'delete' do
|
139
139
|
def run
|
140
140
|
unless Dooby.current_list.tasks?
|
141
|
-
puts 'No
|
141
|
+
puts 'No items to delete'.red
|
142
142
|
exit
|
143
143
|
end
|
144
144
|
|
145
145
|
autocomp = Dooby.current_list.tasks.keys
|
146
|
-
question = '
|
146
|
+
question = 'Item ID '.red.bold + '> '
|
147
147
|
|
148
148
|
Dooby.cli_helper.keep_asking question, autocomp do |task_id|
|
149
149
|
|
@@ -151,7 +151,7 @@ Main {
|
|
151
151
|
say task_id + ' deleted...'
|
152
152
|
exit
|
153
153
|
else
|
154
|
-
say "Don't try to fool #{'Dooby'.red}, she knows such
|
154
|
+
say "Don't try to fool #{'Dooby'.red}, she knows such item doesn't exists"
|
155
155
|
end
|
156
156
|
|
157
157
|
end
|
@@ -160,16 +160,16 @@ Main {
|
|
160
160
|
end
|
161
161
|
|
162
162
|
mode 'bulkdelete' do
|
163
|
-
description "Deletes all the
|
163
|
+
description "Deletes all the items that contains the specified tags.\n $ dooby bulkdelete %mypage @jim \n It will only delete by tag, not by plain text"
|
164
164
|
def run
|
165
165
|
|
166
166
|
unless Dooby.current_list.tasks?
|
167
|
-
puts 'No
|
167
|
+
puts 'No items to delete'.red
|
168
168
|
exit
|
169
169
|
end
|
170
170
|
|
171
171
|
autocomp = Dooby.current_list.all_tags
|
172
|
-
question = "What do you want to bulk delete
|
172
|
+
question = "What do you want to bulk delete?\n> "
|
173
173
|
|
174
174
|
Dooby.cli_helper.keep_asking question, autocomp do |tags|
|
175
175
|
unless tags.empty?
|
@@ -186,7 +186,7 @@ Main {
|
|
186
186
|
def run
|
187
187
|
|
188
188
|
autocomp = Dooby.current_list.tasks.keys
|
189
|
-
question = '
|
189
|
+
question = 'Item ID '.blue.bold + '> '
|
190
190
|
|
191
191
|
current_task_id = ''
|
192
192
|
|
@@ -198,7 +198,7 @@ Main {
|
|
198
198
|
autocomp = [todo_to_edit]
|
199
199
|
break
|
200
200
|
else
|
201
|
-
puts "
|
201
|
+
puts "Item doesn't exist".red.bold
|
202
202
|
exit
|
203
203
|
end
|
204
204
|
|
@@ -219,5 +219,21 @@ Main {
|
|
219
219
|
|
220
220
|
end
|
221
221
|
end
|
222
|
-
|
222
|
+
|
223
|
+
########################## GIT #################################
|
224
|
+
mode 'commit' do
|
225
|
+
current_item = Dooby.current_list.current_item
|
226
|
+
if current_item
|
227
|
+
result = %x[git commit -m "#{current_item}"]
|
228
|
+
if result.include? current_item
|
229
|
+
puts "The commit message was #{current_item.yellow}".blue
|
230
|
+
else
|
231
|
+
puts 'Nothing added to commit'.red if result.include? 'added to commit'
|
232
|
+
end
|
233
|
+
exit
|
234
|
+
else
|
235
|
+
puts "First you have to tag an item with #{Dooby::CURRENT_ITEM_TAG.magenta}".red
|
236
|
+
exit
|
237
|
+
end
|
238
|
+
end
|
223
239
|
}
|
data/dooby.gemspec
CHANGED
@@ -5,49 +5,59 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dooby}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rafael Maga\303\261a"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-11-06}
|
13
13
|
s.default_executable = %q{dooby}
|
14
|
-
s.description = %q{
|
14
|
+
s.description = %q{Handle your to-do/notes list through the command line}
|
15
15
|
s.email = %q{raf.magana@gmail.com}
|
16
16
|
s.executables = ["dooby"]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
19
|
-
|
19
|
+
"README.md"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
23
|
+
".rspec",
|
24
|
+
"CHANGELOG.md",
|
25
|
+
"Gemfile",
|
26
|
+
"Gemfile.lock",
|
27
|
+
"LICENSE",
|
28
|
+
"README.md",
|
29
|
+
"Rakefile",
|
30
|
+
"VERSION",
|
31
|
+
"bin/dooby",
|
32
|
+
"dooby.gemspec",
|
33
|
+
"lib/dooby.rb",
|
34
|
+
"lib/dooby/base.rb",
|
35
|
+
"lib/dooby/cli_helper.rb",
|
36
|
+
"lib/dooby/config.rb",
|
37
|
+
"lib/dooby/core_ext.rb",
|
38
|
+
"lib/dooby/dates_helper.rb",
|
39
|
+
"lib/dooby/exceptions.rb",
|
40
|
+
"lib/dooby/list.rb",
|
41
|
+
"lib/dooby/status_generator.rb",
|
42
|
+
"lib/dooby/task.rb",
|
43
|
+
"spec/dooby_module_spec.rb",
|
44
|
+
"spec/list_spec.rb",
|
45
|
+
"spec/spec_helper.rb",
|
46
|
+
"spec/task_spec.rb",
|
47
|
+
"test/helper.rb",
|
48
|
+
"test/test_dooby.rb"
|
42
49
|
]
|
43
50
|
s.homepage = %q{http://github.com/rafmagana/dooby}
|
44
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
45
51
|
s.require_paths = ["lib"]
|
46
52
|
s.rubygems_version = %q{1.3.7}
|
47
53
|
s.summary = %q{A very simplistic command-line to-do list manager in Ruby}
|
48
54
|
s.test_files = [
|
55
|
+
"spec/dooby_module_spec.rb",
|
56
|
+
"spec/list_spec.rb",
|
57
|
+
"spec/spec_helper.rb",
|
58
|
+
"spec/task_spec.rb",
|
49
59
|
"test/helper.rb",
|
50
|
-
|
60
|
+
"test/test_dooby.rb"
|
51
61
|
]
|
52
62
|
|
53
63
|
if s.respond_to? :specification_version then
|
@@ -55,24 +65,45 @@ Gem::Specification.new do |s|
|
|
55
65
|
s.specification_version = 3
|
56
66
|
|
57
67
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
|
-
s.add_development_dependency(%q<
|
59
|
-
s.add_development_dependency(%q<
|
68
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.0.0"])
|
69
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
70
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.0.pre5"])
|
71
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
60
72
|
s.add_runtime_dependency(%q<main>, [">= 4.2.0"])
|
61
73
|
s.add_runtime_dependency(%q<colored>, [">= 1.2"])
|
62
74
|
s.add_runtime_dependency(%q<highline>, [">= 1.6.1"])
|
75
|
+
s.add_runtime_dependency(%q<chronic>, [">= 0.3.0"])
|
76
|
+
s.add_development_dependency(%q<rspec>, [">= 2.0.1"])
|
77
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
78
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.0.pre5"])
|
79
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
63
80
|
else
|
64
|
-
s.add_dependency(%q<
|
65
|
-
s.add_dependency(%q<
|
81
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0"])
|
82
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
83
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre5"])
|
84
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
66
85
|
s.add_dependency(%q<main>, [">= 4.2.0"])
|
67
86
|
s.add_dependency(%q<colored>, [">= 1.2"])
|
68
87
|
s.add_dependency(%q<highline>, [">= 1.6.1"])
|
88
|
+
s.add_dependency(%q<chronic>, [">= 0.3.0"])
|
89
|
+
s.add_dependency(%q<rspec>, [">= 2.0.1"])
|
90
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
91
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre5"])
|
92
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
69
93
|
end
|
70
94
|
else
|
71
|
-
s.add_dependency(%q<
|
72
|
-
s.add_dependency(%q<
|
95
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0"])
|
96
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
97
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre5"])
|
98
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
73
99
|
s.add_dependency(%q<main>, [">= 4.2.0"])
|
74
100
|
s.add_dependency(%q<colored>, [">= 1.2"])
|
75
101
|
s.add_dependency(%q<highline>, [">= 1.6.1"])
|
102
|
+
s.add_dependency(%q<chronic>, [">= 0.3.0"])
|
103
|
+
s.add_dependency(%q<rspec>, [">= 2.0.1"])
|
104
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
105
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre5"])
|
106
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
76
107
|
end
|
77
108
|
end
|
78
109
|
|
data/lib/dooby.rb
CHANGED
@@ -1,26 +1,25 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__))
|
2
2
|
|
3
|
-
|
3
|
+
#dependencies
|
4
|
+
%w[fileutils
|
5
|
+
digest/sha1
|
6
|
+
colored
|
7
|
+
readline
|
8
|
+
highline/import
|
9
|
+
chronic].each { |f| require "#{f}" }
|
4
10
|
|
5
|
-
|
11
|
+
#dooby
|
12
|
+
%w[config
|
13
|
+
exceptions
|
6
14
|
core_ext
|
7
15
|
base
|
16
|
+
dates_helper
|
8
17
|
list
|
9
|
-
|
18
|
+
status_generator
|
10
19
|
task
|
11
20
|
cli_helper].each { |f| require "dooby/#{f}" }
|
12
21
|
|
13
22
|
module Dooby
|
14
|
-
|
15
|
-
DOOBY_DIR = '.dooby'
|
16
|
-
CURRENT_TODO_LIST_FILE = "#{DOOBY_DIR}/list.yml"
|
17
|
-
|
18
|
-
DEFAULT_STATUS = :hold
|
19
|
-
|
20
|
-
AVAILABLE_STATUSES = [:hold, :doing, :done]
|
21
|
-
SPECIAL_TAGS = %w[@ # %]
|
22
|
-
SPLITTABLE_TAGS = %w[#today #urgent]
|
23
|
-
|
24
23
|
def self.init
|
25
24
|
unless File.exist? CURRENT_TODO_LIST_FILE
|
26
25
|
FileUtils.mkdir DOOBY_DIR
|
data/lib/dooby/cli_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Dooby
|
2
2
|
class CLIHelper
|
3
3
|
|
4
|
-
DEL_TASKS = "Sure you want to delete all the
|
4
|
+
DEL_TASKS = "Sure you want to delete all the items???".red_on_white.bold
|
5
5
|
TRASH = "Sure you want to delete the .dooby directory???".red_on_white.bold
|
6
6
|
|
7
7
|
def self.flush?
|
@@ -12,13 +12,16 @@ module Dooby
|
|
12
12
|
agree TRASH, true
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.keep_asking(question, autocompletion =
|
15
|
+
def self.keep_asking(question, autocompletion = [])
|
16
|
+
Readline.basic_word_break_characters =
|
17
|
+
Readline.basic_word_break_characters.delete("@")
|
16
18
|
Readline.completion_append_character = " "
|
17
19
|
Readline.completion_proc = proc { |s| autocompletion.grep( /^#{Regexp.escape(s)}/ ) }
|
18
20
|
|
19
21
|
stty_save = `stty -g`.chomp
|
20
22
|
|
21
23
|
while value = Readline.readline(question, true)
|
24
|
+
exit if value == 'q'
|
22
25
|
yield value.chomp.strip
|
23
26
|
end
|
24
27
|
|