qer 0.2.3 → 0.2.6
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/History.txt +12 -0
- data/README.rdoc +2 -0
- data/Rakefile +13 -16
- data/lib/qer.rb +3 -3
- data/lib/qer/todo.rb +42 -27
- data/test/test_helper.rb +13 -0
- data/test/test_qer.rb +285 -244
- metadata +4 -14
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
== 0.2.5 2010-02-16
|
2
|
+
* 1 bugfix:
|
3
|
+
* Don't error badly when calling remove with a bad index
|
4
|
+
|
5
|
+
== 0.2.4 2010-02-15
|
6
|
+
* 1 very minor enhancement:
|
7
|
+
* remove index from history print.
|
8
|
+
|
9
|
+
== 0.2.3 2010-02-09
|
10
|
+
* 1 bugfix:
|
11
|
+
* fixed ruby 1.9 support
|
12
|
+
|
1
13
|
== 0.2.2 2010-01-25
|
2
14
|
* 2 bugfixes
|
3
15
|
* Bumping too far back was leaving nil rows
|
data/README.rdoc
CHANGED
@@ -45,6 +45,8 @@ Commands:
|
|
45
45
|
`qer bump 5 2` -> bumps index five up to 2
|
46
46
|
clear - Clears the entire list
|
47
47
|
`qer clear`
|
48
|
+
clear - Clears the given index without writing to the history file
|
49
|
+
`qer clear 2`
|
48
50
|
history - displays list of completed tasks
|
49
51
|
`qer history`
|
50
52
|
help - Prints this message
|
data/Rakefile
CHANGED
@@ -1,25 +1,22 @@
|
|
1
|
-
%w[rubygems rake rake/clean fileutils hoe
|
1
|
+
%w[rubygems rake rake/clean fileutils hoe].each { |f| require f }
|
2
2
|
require File.dirname(__FILE__) + '/lib/qer'
|
3
3
|
|
4
4
|
# Generate all the Rake tasks
|
5
5
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
-
$hoe = Hoe.spec('qer') do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
['shoulda','
|
16
|
-
['newgem', ">= #{::Newgem::VERSION}"]
|
6
|
+
$hoe = Hoe.spec('qer') do
|
7
|
+
developer('Josh Kleinpeter', 'josh@kleinpeter.org')
|
8
|
+
developer('Coby Randquist', 'randquistcp@gmail.com')
|
9
|
+
developer('Jacob Dunphy', 'jacob.dunphy@gmail.com')
|
10
|
+
self.changes = paragraphs_of("History.txt", 0..1).join("\n\n")
|
11
|
+
self.rubyforge_name = name
|
12
|
+
self.description = "Qer is an easy command-line todo list."
|
13
|
+
self.summary = "Just type `qer --help` to get started."
|
14
|
+
self.extra_dev_deps = [
|
15
|
+
['shoulda','> 2.10.1'],
|
17
16
|
]
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
22
|
-
p.rsync_args = '-av --delete --ignore-errors'
|
18
|
+
self.clean_globs |= %w[**/.DS_Store tmp *.log]
|
19
|
+
self.rsync_args = '-av --delete --ignore-errors'
|
23
20
|
end
|
24
21
|
|
25
22
|
require 'newgem/tasks' # load /tasks/*.rake
|
data/lib/qer.rb
CHANGED
@@ -3,7 +3,7 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) ||
|
|
3
3
|
require 'time'
|
4
4
|
require 'qer/todo'
|
5
5
|
module Qer
|
6
|
-
VERSION = '0.2.
|
6
|
+
VERSION = '0.2.6'
|
7
7
|
end
|
8
8
|
|
9
9
|
class Time
|
@@ -24,6 +24,6 @@ class Time
|
|
24
24
|
when 86400..525599 then "~ #{(distance_in_minutes / 43200).round} months ago"
|
25
25
|
when 525600..1051199 then "~ 1 year ago"
|
26
26
|
else "> #{(distance_in_minutes / 525600).round} years ago"
|
27
|
-
|
28
|
-
|
27
|
+
end
|
28
|
+
end
|
29
29
|
end
|
data/lib/qer/todo.rb
CHANGED
@@ -22,18 +22,28 @@ module Qer
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def remove(index)
|
25
|
-
|
25
|
+
if item = self.queue.delete_at(index)
|
26
26
|
self.history << [Time.now.to_s, item[0], item[1]]
|
27
27
|
write_history
|
28
28
|
write
|
29
|
-
print "Removed #{item.last}"
|
29
|
+
print "Removed: #{item.last}"
|
30
|
+
item
|
31
|
+
else
|
32
|
+
print "Provided index does not exist."
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
33
|
-
def clear
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
def clear(index = nil)
|
37
|
+
unless index.nil?
|
38
|
+
item = self.queue.delete_at(index.to_i)
|
39
|
+
write
|
40
|
+
print "Removed #{item.last}"
|
41
|
+
item
|
42
|
+
else
|
43
|
+
self.queue = []
|
44
|
+
write
|
45
|
+
print "ToDo list cleared"
|
46
|
+
end
|
37
47
|
end
|
38
48
|
|
39
49
|
def pop
|
@@ -43,7 +53,7 @@ module Qer
|
|
43
53
|
def push(item)
|
44
54
|
self.queue.unshift([Time.now.to_s, item])
|
45
55
|
write
|
46
|
-
print
|
56
|
+
print "Pushed to the top: #{item}"
|
47
57
|
end
|
48
58
|
|
49
59
|
def bump(index, new_index = 0)
|
@@ -61,7 +71,7 @@ module Qer
|
|
61
71
|
def print_history(string = nil)
|
62
72
|
dump self.history, string, history_title
|
63
73
|
end
|
64
|
-
|
74
|
+
|
65
75
|
def write
|
66
76
|
file("w+") {|f| Marshal.dump(self.queue, f) }
|
67
77
|
end
|
@@ -86,11 +96,6 @@ module Qer
|
|
86
96
|
self.queue.size
|
87
97
|
end
|
88
98
|
|
89
|
-
def returning(thing)
|
90
|
-
yield
|
91
|
-
thing
|
92
|
-
end
|
93
|
-
|
94
99
|
def width
|
95
100
|
80
|
96
101
|
end
|
@@ -113,7 +118,7 @@ module Qer
|
|
113
118
|
|
114
119
|
def process_line(index, item)
|
115
120
|
return unless item
|
116
|
-
item.size == 2 ? process_queue_line(index,item) : process_history_line(
|
121
|
+
item.size == 2 ? process_queue_line(index,item) : process_history_line(item)
|
117
122
|
end
|
118
123
|
|
119
124
|
def process_queue_line(index, item)
|
@@ -123,11 +128,10 @@ module Qer
|
|
123
128
|
right.insert(0, left)
|
124
129
|
end
|
125
130
|
|
126
|
-
def process_history_line(
|
131
|
+
def process_history_line(item)
|
127
132
|
end_time, time, task = item
|
128
|
-
|
129
|
-
right
|
130
|
-
right.insert(0, left)
|
133
|
+
right = "#{tf(time)} | #{tf(end_time)}".rjust(width-task.length)
|
134
|
+
right.insert(0, task)
|
131
135
|
end
|
132
136
|
|
133
137
|
def dump(queue, string, label = title)
|
@@ -148,15 +152,24 @@ module Qer
|
|
148
152
|
|
149
153
|
def command(args)
|
150
154
|
case(args.shift)
|
151
|
-
when /^a(dd)?/
|
152
|
-
|
153
|
-
when /^
|
154
|
-
|
155
|
-
when /^
|
156
|
-
|
157
|
-
when
|
158
|
-
|
159
|
-
|
155
|
+
when /^a(dd)?/
|
156
|
+
self.add(args.join(" ")) # qer add Some task 1
|
157
|
+
when /^r(emove)?/
|
158
|
+
self.remove(args.shift.to_i) # qer remove 0
|
159
|
+
when /^pu(sh)?/
|
160
|
+
self.push(args.join(" ")) # qer push Some task 2
|
161
|
+
when /^po(p)?/
|
162
|
+
self.pop # qer pop
|
163
|
+
when /^b(ump)?/
|
164
|
+
self.bump(*args.first(2)) # qer bump
|
165
|
+
when /^clear/
|
166
|
+
self.clear(args.shift) # qer clear
|
167
|
+
when /.*help/
|
168
|
+
self.help # qer help
|
169
|
+
when /^h(istory)?/
|
170
|
+
self.print_history # qer history
|
171
|
+
else
|
172
|
+
self.print # qer
|
160
173
|
end
|
161
174
|
end
|
162
175
|
|
@@ -182,6 +195,8 @@ Commands:
|
|
182
195
|
`qer bump 5 2` -> bumps index five up to 2
|
183
196
|
clear - Clears the entire list
|
184
197
|
`qer clear`
|
198
|
+
clear - Clears the given index without writing to history file
|
199
|
+
`qer clear 3`
|
185
200
|
h(istory) - displays list of completed tasks
|
186
201
|
`qer history`
|
187
202
|
help - Prints this message
|
data/test/test_helper.rb
CHANGED
@@ -4,3 +4,16 @@ require 'shoulda'
|
|
4
4
|
require File.dirname(__FILE__) + '/../lib/qer'
|
5
5
|
|
6
6
|
Qer::ToDo.quiet = true
|
7
|
+
|
8
|
+
class Test::Unit::TestCase
|
9
|
+
|
10
|
+
def assert_output matcher
|
11
|
+
assert_match matcher, read_stdout
|
12
|
+
end
|
13
|
+
|
14
|
+
def read_stdout
|
15
|
+
@output.rewind
|
16
|
+
@output.read
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
data/test/test_qer.rb
CHANGED
@@ -1,251 +1,292 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
-
|
3
|
-
class TestQer < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@file = File.join(File.dirname(__FILE__), 'testqueue.tmp')
|
7
|
-
File.delete(@file) if File.exists?(@file)
|
8
|
-
@todo = Qer::ToDo.new(@file)
|
9
|
-
end
|
10
|
-
|
11
|
-
context "push" do
|
12
|
-
setup do
|
13
|
-
@todo.push("Some Task")
|
14
|
-
end
|
15
|
-
|
16
|
-
should "have one item" do
|
17
|
-
assert_equal 1, @todo.size
|
18
|
-
end
|
19
|
-
|
20
|
-
should "have two items" do
|
21
|
-
@todo.push("Some Other Task")
|
22
|
-
assert_equal 2, @todo.size
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
context "pop" do
|
27
|
-
setup do
|
28
|
-
@todo.push("Some Task")
|
29
|
-
@todo.push("Some Other Task")
|
30
|
-
@item = @todo.pop
|
31
|
-
end
|
32
|
-
|
33
|
-
should "pop the right item" do
|
34
|
-
assert_equal "Some Other Task", @item[1]
|
35
|
-
end
|
36
|
-
|
37
|
-
should "have one item" do
|
38
|
-
assert_equal 1, @todo.size
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context "add" do
|
43
|
-
setup do
|
44
|
-
@todo.add("Some Task")
|
45
|
-
end
|
46
|
-
|
47
|
-
should "have one item" do
|
48
|
-
assert_equal 1, @todo.size
|
49
|
-
end
|
50
|
-
|
51
|
-
should "have two items" do
|
52
|
-
@todo.add("Some Other Task")
|
53
|
-
assert_equal 2, @todo.size
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context "remove" do
|
58
|
-
setup do
|
59
|
-
@todo.add("Some Task")
|
60
|
-
@todo.add("Some Other Task")
|
61
|
-
@item = @todo.remove(0)
|
62
|
-
end
|
63
|
-
|
64
|
-
should "remove the right item" do
|
65
|
-
assert_equal "Some Task", @item[1]
|
66
|
-
end
|
67
|
-
|
68
|
-
should "have one item" do
|
69
|
-
assert_equal 1, @todo.size
|
70
|
-
end
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
@todo.
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
should "
|
99
|
-
@
|
100
|
-
|
101
|
-
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestQer < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@file = File.join(File.dirname(__FILE__), 'testqueue.tmp')
|
7
|
+
File.delete(@file) if File.exists?(@file)
|
8
|
+
@todo = Qer::ToDo.new(@file)
|
9
|
+
end
|
10
|
+
|
11
|
+
context "push" do
|
12
|
+
setup do
|
13
|
+
@todo.push("Some Task")
|
14
|
+
end
|
15
|
+
|
16
|
+
should "have one item" do
|
17
|
+
assert_equal 1, @todo.size
|
18
|
+
end
|
19
|
+
|
20
|
+
should "have two items" do
|
21
|
+
@todo.push("Some Other Task")
|
22
|
+
assert_equal 2, @todo.size
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "pop" do
|
27
|
+
setup do
|
28
|
+
@todo.push("Some Task")
|
29
|
+
@todo.push("Some Other Task")
|
30
|
+
@item = @todo.pop
|
31
|
+
end
|
32
|
+
|
33
|
+
should "pop the right item" do
|
34
|
+
assert_equal "Some Other Task", @item[1]
|
35
|
+
end
|
36
|
+
|
37
|
+
should "have one item" do
|
38
|
+
assert_equal 1, @todo.size
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "add" do
|
43
|
+
setup do
|
44
|
+
@todo.add("Some Task")
|
45
|
+
end
|
46
|
+
|
47
|
+
should "have one item" do
|
48
|
+
assert_equal 1, @todo.size
|
49
|
+
end
|
50
|
+
|
51
|
+
should "have two items" do
|
52
|
+
@todo.add("Some Other Task")
|
53
|
+
assert_equal 2, @todo.size
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "remove" do
|
58
|
+
setup do
|
59
|
+
@todo.add("Some Task")
|
60
|
+
@todo.add("Some Other Task")
|
61
|
+
@item = @todo.remove(0)
|
62
|
+
end
|
63
|
+
|
64
|
+
should "remove the right item" do
|
65
|
+
assert_equal "Some Task", @item[1]
|
66
|
+
end
|
67
|
+
|
68
|
+
should "have one item" do
|
69
|
+
assert_equal 1, @todo.size
|
70
|
+
end
|
71
|
+
|
72
|
+
should "not error out when an invalid index is removed" do
|
73
|
+
assert_nothing_raised {
|
74
|
+
@todo.remove(12)
|
75
|
+
}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "clear all" do
|
80
|
+
setup do
|
81
|
+
@todo.add("Some Task")
|
82
|
+
@todo.add("Some Other Task")
|
83
|
+
@todo.clear
|
84
|
+
end
|
85
|
+
|
86
|
+
should "have no items" do
|
87
|
+
assert_equal 0, @todo.size
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context "clear individual item" do
|
92
|
+
setup do
|
93
|
+
@todo.add("Some Task")
|
94
|
+
@todo.add("Some Other Task")
|
95
|
+
@item = @todo.clear(0)
|
96
|
+
end
|
97
|
+
|
98
|
+
should "have the right item left" do
|
99
|
+
assert_equal "Some Task", @item[1]
|
100
|
+
end
|
101
|
+
|
102
|
+
should "have one item" do
|
103
|
+
assert_equal 1, @todo.size
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context "bump" do
|
108
|
+
setup do
|
109
|
+
@todo.add("first")
|
110
|
+
@todo.add("second")
|
111
|
+
@todo.add("third")
|
112
|
+
end
|
113
|
+
|
114
|
+
should "be able to bump to the top" do
|
115
|
+
@todo.bump(2)
|
116
|
+
assert_equal "third", @todo.queue.first.last
|
117
|
+
end
|
118
|
+
|
119
|
+
should "be able to bump to a specific location" do
|
120
|
+
@todo.bump(2,1)
|
121
|
+
assert_equal "third", @todo.queue[1].last
|
122
|
+
end
|
102
123
|
|
103
124
|
should "not leave nil rows in if we bump too far back" do
|
104
125
|
@todo.bump(0,100)
|
105
126
|
assert !@todo.queue.include?(nil)
|
106
127
|
assert_equal "first", @todo.queue.last[1]
|
107
128
|
end
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
@
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
@
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
@todo.
|
167
|
-
|
168
|
-
end
|
169
|
-
|
170
|
-
should "
|
171
|
-
@todo.command(
|
172
|
-
assert_equal
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
@todo.command(%w(
|
178
|
-
assert_equal
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
@
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
assert_equal "
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
129
|
+
end
|
130
|
+
|
131
|
+
context "read" do
|
132
|
+
setup do
|
133
|
+
@file = File.join(File.dirname(__FILE__), 'test_queue')
|
134
|
+
@todo = Qer::ToDo.new(@file)
|
135
|
+
end
|
136
|
+
|
137
|
+
should "have 5 items" do
|
138
|
+
assert_equal 5, @todo.size
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
context "write" do
|
143
|
+
setup do
|
144
|
+
@todo.add("Some Task")
|
145
|
+
@todo.add("Some Other Task")
|
146
|
+
@other_todo = Qer::ToDo.new(@file)
|
147
|
+
end
|
148
|
+
|
149
|
+
should "have 2 items" do
|
150
|
+
assert_equal 2, @todo.size
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
context "command" do
|
155
|
+
setup do
|
156
|
+
@todo.add("Some Task")
|
157
|
+
Qer::ToDo.quiet = false
|
158
|
+
@orig_stdout = $stdout.dup
|
159
|
+
@output = StringIO.new
|
160
|
+
$stdout = @output
|
161
|
+
end
|
162
|
+
|
163
|
+
teardown do
|
164
|
+
Qer::ToDo.quiet = true
|
165
|
+
$stdout = @orig_stdout
|
166
|
+
end
|
167
|
+
|
168
|
+
should "add" do
|
169
|
+
@todo.command(%w(add some stuff))
|
170
|
+
assert_equal 2, @todo.size
|
171
|
+
assert_output(/Adding: some stuff/)
|
172
|
+
end
|
173
|
+
|
174
|
+
should "remove" do
|
175
|
+
assert_equal "Some Task", @todo.command(%w(remove 0)).last
|
176
|
+
assert_equal 0, @todo.size
|
177
|
+
assert_output "Removed: Some Task"
|
178
|
+
end
|
179
|
+
|
180
|
+
should "not remove bad index" do
|
181
|
+
@todo.command(%w(remove 14))
|
182
|
+
assert_output "Provided index does not exist."
|
183
|
+
end
|
184
|
+
|
185
|
+
should "push" do
|
186
|
+
@todo.command(%w(push some stuff))
|
187
|
+
assert_equal 2, @todo.size
|
188
|
+
assert_output "Pushed to the top: some stuff"
|
189
|
+
end
|
190
|
+
|
191
|
+
should "pop" do
|
192
|
+
assert_equal "Some Task", @todo.command(%w(pop)).last
|
193
|
+
assert_equal 0, @todo.size
|
194
|
+
assert_output "Removed: Some Task"
|
195
|
+
end
|
196
|
+
|
197
|
+
should "clear" do
|
198
|
+
@todo.command(%w(clear))
|
199
|
+
assert_equal 0, @todo.size
|
200
|
+
assert_output(/list cleared/)
|
201
|
+
end
|
202
|
+
|
203
|
+
should "help" do
|
204
|
+
@todo.command(%w(help))
|
205
|
+
assert_equal 1, @todo.size
|
206
|
+
assert_output(/Help for Qer/)
|
207
|
+
end
|
208
|
+
|
209
|
+
should "print" do
|
210
|
+
@todo.command([])
|
211
|
+
assert_equal 1, @todo.size
|
212
|
+
assert_output "Stuff on the Hopper"
|
213
|
+
end
|
214
|
+
|
215
|
+
should "bump" do
|
216
|
+
@todo.add("second")
|
217
|
+
@todo.command(%w(bump 1))
|
218
|
+
assert_equal "second", @todo.queue.first.last
|
219
|
+
|
220
|
+
assert_output(/Bumped second to position 0/)
|
221
|
+
|
222
|
+
@todo.add('third')
|
223
|
+
@todo.command(%w(bump 2 1))
|
224
|
+
assert_equal "third", @todo.queue[1].last
|
225
|
+
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
context "time" do
|
230
|
+
setup do
|
231
|
+
@time = Time.now
|
232
|
+
end
|
233
|
+
|
234
|
+
should "parse time" do
|
235
|
+
@time = @todo.tf("Fri Oct 02 15:04:59 -0700 2009")
|
236
|
+
end
|
237
|
+
|
238
|
+
should "have distance in seconds" do
|
239
|
+
assert_equal "> 1 sec ago", Time.time_ago(@time, @time - 1)
|
240
|
+
end
|
241
|
+
|
242
|
+
should "have distance in minutes" do
|
243
|
+
assert_equal "> 5 min ago", Time.time_ago(@time, @time - 5*60)
|
244
|
+
end
|
245
|
+
|
246
|
+
should "have distance in 1 hour" do
|
247
|
+
assert_equal "~ 1 hr ago", Time.time_ago(@time, @time - 3600)
|
248
|
+
end
|
249
|
+
|
250
|
+
should "have distance in hours" do
|
251
|
+
assert_equal "~ 2 hrs ago", Time.time_ago(@time, @time - 2*3600)
|
252
|
+
end
|
253
|
+
|
254
|
+
should "have distance in 1 day" do
|
255
|
+
assert_equal "~ 1 day ago", Time.time_ago(@time, @time - 86400)
|
256
|
+
end
|
257
|
+
|
258
|
+
should "have distance in days" do
|
259
|
+
assert_equal "~ 7 days ago", Time.time_ago(@time, @time - 7*86400)
|
260
|
+
end
|
261
|
+
|
262
|
+
should "have distance in 1 month" do
|
263
|
+
assert_equal "~ 1 month ago", Time.time_ago(@time, @time - 2592000)
|
264
|
+
end
|
265
|
+
|
266
|
+
should "have distance in months" do
|
267
|
+
assert_equal "~ 3 months ago", Time.time_ago(@time, @time - 3*2592000)
|
268
|
+
end
|
269
|
+
|
270
|
+
should "have distance in 1 year" do
|
271
|
+
assert_equal "~ 1 year ago", Time.time_ago(@time, @time - 31536000)
|
272
|
+
end
|
273
|
+
|
274
|
+
should "have distance in years" do
|
275
|
+
assert_equal "> 99 years ago", Time.time_ago(@time, @time - 99*31536000)
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
context "print" do
|
280
|
+
should "have width" do
|
239
281
|
assert_equal 80, @todo.width
|
240
|
-
end
|
241
|
-
|
242
|
-
should "have a title" do
|
243
|
-
assert_equal @todo.width, @todo.title.size
|
244
|
-
end
|
245
|
-
|
246
|
-
should "have a horizontal line printer" do
|
247
|
-
assert_equal @todo.width, @todo.hl.size
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
end
|
282
|
+
end
|
283
|
+
|
284
|
+
should "have a title" do
|
285
|
+
assert_equal @todo.width, @todo.title.size
|
286
|
+
end
|
287
|
+
|
288
|
+
should "have a horizontal line printer" do
|
289
|
+
assert_equal @todo.width, @todo.hl.size
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Kleinpeter
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2010-
|
14
|
+
date: 2010-03-22 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -20,20 +20,10 @@ dependencies:
|
|
20
20
|
version_requirement:
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
|
-
- - "
|
23
|
+
- - ">"
|
24
24
|
- !ruby/object:Gem::Version
|
25
25
|
version: 2.10.1
|
26
26
|
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: newgem
|
29
|
-
type: :development
|
30
|
-
version_requirement:
|
31
|
-
version_requirements: !ruby/object:Gem::Requirement
|
32
|
-
requirements:
|
33
|
-
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: 1.5.2
|
36
|
-
version:
|
37
27
|
- !ruby/object:Gem::Dependency
|
38
28
|
name: hoe
|
39
29
|
type: :development
|
@@ -42,7 +32,7 @@ dependencies:
|
|
42
32
|
requirements:
|
43
33
|
- - ">="
|
44
34
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.
|
35
|
+
version: 2.3.3
|
46
36
|
version:
|
47
37
|
description: Qer is an easy command-line todo list.
|
48
38
|
email:
|