tudu 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -2
- data/bin/tudu +2 -1
- data/lib/tudu/version.rb +1 -1
- data/lib/tudu_core.rb +18 -2
- data/spec/tudu_core_spec.rb +20 -2
- metadata +12 -12
data/README.md
CHANGED
@@ -97,9 +97,9 @@ $ tudu doings
|
|
97
97
|
hoge
|
98
98
|
~~~
|
99
99
|
|
100
|
+
### choose no args. from first todo to doing
|
100
101
|
* choose
|
101
102
|
|
102
|
-
### choose no args. from first todo to doing
|
103
103
|
~~~
|
104
104
|
$ tudu add hoge hige
|
105
105
|
$ tudu choose
|
@@ -124,7 +124,7 @@ $ tudu done
|
|
124
124
|
one
|
125
125
|
~~~
|
126
126
|
|
127
|
-
### done. from doing to done and from first todos to doing. after, if there is no todos, show celebration message.
|
127
|
+
### done. from doing to done and from first todos to doing. after, if there is no todos and doings, show celebration message.
|
128
128
|
* done
|
129
129
|
|
130
130
|
~~~
|
@@ -153,6 +153,24 @@ two
|
|
153
153
|
one
|
154
154
|
~~~
|
155
155
|
|
156
|
+
### tasks show all tasks from [todos, doings, dones] with categorized option.
|
157
|
+
* tudu tasks -c
|
158
|
+
|
159
|
+
~~~
|
160
|
+
$ tudu add one two three
|
161
|
+
$ tudu choose one
|
162
|
+
$ tudu done
|
163
|
+
$tudu tasks -c
|
164
|
+
========TODOS========
|
165
|
+
three
|
166
|
+
|
167
|
+
========DOINGS========
|
168
|
+
two
|
169
|
+
|
170
|
+
========DONES========
|
171
|
+
one
|
172
|
+
~~~
|
173
|
+
|
156
174
|
### show specific tasks from [todos, doings, dones].
|
157
175
|
* tudu tasks search_word
|
158
176
|
|
@@ -213,6 +231,7 @@ if you want to do other operation, edit [todos, doings, dones] directly.
|
|
213
231
|
it's only plain text, so you can edit freely.
|
214
232
|
|
215
233
|
## History
|
234
|
+
* version 0.0.3 : add categorized option to tasks.
|
216
235
|
* version 0.0.2 : after execute 'done', if there is no todos and doings, display celebration message.
|
217
236
|
* version 0.0.2 : if 'choose' no args. choose first tudu.
|
218
237
|
* version 0.0.1 : first release.
|
data/bin/tudu
CHANGED
@@ -38,8 +38,9 @@ module Tudu
|
|
38
38
|
end
|
39
39
|
|
40
40
|
desc "tasks", "tasks search tasks from todos,doings,dones file. no args => get all tasks. set search word args, you get hit tasks"
|
41
|
+
option :category, :type => :boolean, :aliases => '-c', :desc => "show categorized tasks"
|
41
42
|
def tasks(*args)
|
42
|
-
puts Tudu::Core.new.tasks args.first
|
43
|
+
puts Tudu::Core.new.tasks args.first, options
|
43
44
|
end
|
44
45
|
|
45
46
|
desc "todos", "todos search tasks from todos file. no args => get all tasks. set search word args, you get hit tasks"
|
data/lib/tudu/version.rb
CHANGED
data/lib/tudu_core.rb
CHANGED
@@ -44,8 +44,10 @@ module Tudu
|
|
44
44
|
#== search tasks
|
45
45
|
#=== Params
|
46
46
|
#- search_word : search word. enable regexp.
|
47
|
-
|
48
|
-
|
47
|
+
#- options : options.
|
48
|
+
def tasks(search_word, options)
|
49
|
+
tasks = Tudu::Tasks.filter_tasks(Tudu::Tasks.get_tasks, search_word).map(&:name)
|
50
|
+
(!options.nil? and options[:category]) ? categorized_tasks(tasks, search_word) : tasks
|
49
51
|
end
|
50
52
|
|
51
53
|
#== search todos
|
@@ -69,6 +71,20 @@ module Tudu
|
|
69
71
|
Tudu::Tasks.filter_tasks(Tudu::Tasks.get_dones, search_word).map(&:name)
|
70
72
|
end
|
71
73
|
|
74
|
+
def categorized_tasks(tasks, search_word)
|
75
|
+
ret = []
|
76
|
+
tasks = Tudu::Tasks.filter_tasks(Tudu::Tasks.get_tasks, search_word)
|
77
|
+
ret << "========TODOS========"
|
78
|
+
ret << tasks.select {|task|task.type == Tudu::Tasks::TUDU_TODOS_FILE}.map(&:name).join("\n")
|
79
|
+
ret << ""
|
80
|
+
ret << "========DOINGS========"
|
81
|
+
ret << tasks.select {|task|task.type == Tudu::Tasks::TUDU_DOINGS_FILE}.map(&:name).join("\n")
|
82
|
+
ret << ""
|
83
|
+
ret << "========DONES========"
|
84
|
+
ret << tasks.select {|task|task.type == Tudu::Tasks::TUDU_DONES_FILE}.map(&:name).join("\n")
|
85
|
+
ret
|
86
|
+
end
|
87
|
+
|
72
88
|
alias :now :doings
|
73
89
|
end
|
74
90
|
end
|
data/spec/tudu_core_spec.rb
CHANGED
@@ -145,7 +145,6 @@ describe Tudu::Core do
|
|
145
145
|
task_names2: nil,
|
146
146
|
task_names3: nil,
|
147
147
|
},
|
148
|
-
# TODO: add doing, done mix case. after implements choose, done method
|
149
148
|
]
|
150
149
|
|
151
150
|
cases.each do |c|
|
@@ -215,6 +214,25 @@ describe Tudu::Core do
|
|
215
214
|
search_word: "task_name2_",
|
216
215
|
expected: ["task_name2_1", "task_name2_2"]
|
217
216
|
},
|
217
|
+
{
|
218
|
+
case_no: 4,
|
219
|
+
case_title: "[todos, dosings, dones] all tasks with category option",
|
220
|
+
task_names1: "task_name1",
|
221
|
+
task_names2: "task_name2",
|
222
|
+
task_names3: "task_name3",
|
223
|
+
search_word: nil,
|
224
|
+
options: {:category => true},
|
225
|
+
expected: [
|
226
|
+
"========TODOS========",
|
227
|
+
"task_name1\ntask_name2\ntask_name3",
|
228
|
+
"",
|
229
|
+
"========DOINGS========",
|
230
|
+
"",
|
231
|
+
"",
|
232
|
+
"========DONES========",
|
233
|
+
""
|
234
|
+
]
|
235
|
+
},
|
218
236
|
]
|
219
237
|
|
220
238
|
cases.each do |c|
|
@@ -228,7 +246,7 @@ describe Tudu::Core do
|
|
228
246
|
tudu_core.add c[:task_names1], c[:task_names2], c[:task_names3], c[:task_names4]
|
229
247
|
|
230
248
|
# -- when --
|
231
|
-
actual = tudu_core.tasks c[:search_word]
|
249
|
+
actual = tudu_core.tasks c[:search_word], c[:options]
|
232
250
|
|
233
251
|
# -- then --
|
234
252
|
expect(actual).to eq(c[:expected])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tudu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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: 2013-12-
|
12
|
+
date: 2013-12-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &25932060 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.18.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *25932060
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &25931292 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.14.1
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *25931292
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: simplecov
|
38
|
-
requirement: &
|
38
|
+
requirement: &25930836 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.8.2
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *25930836
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &25929816 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '1.3'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *25929816
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &25929192 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *25929192
|
69
69
|
description: Single person's minimum unit of task manager
|
70
70
|
email:
|
71
71
|
- tbpgr@tbpgr.jp
|