qer 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/.gemtest +0 -0
  2. data/README.rdoc +1 -1
  3. data/lib/qer.rb +1 -1
  4. data/lib/qer/todo.rb +22 -11
  5. data/test/test_qer.rb +18 -0
  6. metadata +18 -16
File without changes
@@ -70,7 +70,7 @@ Commands:
70
70
 
71
71
  == INSTALL:
72
72
 
73
- sudo gem install qer
73
+ gem install qer
74
74
 
75
75
  == LICENSE:
76
76
 
data/lib/qer.rb CHANGED
@@ -6,7 +6,7 @@ require 'time'
6
6
  require 'yaml'
7
7
  require 'qer/todo'
8
8
  module Qer
9
- VERSION = '0.3.0'
9
+ VERSION = '0.3.1'
10
10
  end
11
11
 
12
12
  class Time
@@ -24,7 +24,11 @@ module Qer
24
24
  end
25
25
 
26
26
  def remove(index)
27
- if item = self.queue.delete_at(index)
27
+ if index.nil?
28
+ print "Remove must have an index: ex. 'qer remove 3'"
29
+ return
30
+ end
31
+ if item = self.queue.delete_at(index.to_i)
28
32
  self.history << [Time.now.to_s, item[0], item[1]]
29
33
  write_history
30
34
  write
@@ -166,25 +170,28 @@ module Qer
166
170
  end
167
171
 
168
172
  def command(args)
169
- case(args.shift)
170
- when /^a(dd)?/
173
+ cmd = args.shift
174
+ case(cmd)
175
+ when "add", "a"
171
176
  self.add(args.join(" ")) # qer add Some task 1
172
- when /^r(emove)?/
173
- self.remove(args.shift.to_i) # qer remove 0
174
- when /^pu(sh)?/
177
+ when "remove", "r"
178
+ self.remove(args.shift) # qer remove 0
179
+ when "push", "pu"
175
180
  self.push(args.join(" ")) # qer push Some task 2
176
- when /^po(p)?/
181
+ when "pop", "po"
177
182
  self.pop # qer pop
178
- when /^b(ump)?/
183
+ when "bump", "b"
179
184
  self.bump(*args.first(2)) # qer bump
180
- when /^clear/
185
+ when "clear"
181
186
  self.clear(args.shift) # qer clear
182
187
  when /.*help/
183
188
  self.help # qer help
184
- when /^h(istory)?/
189
+ when "history", "h"
185
190
  self.print_history # qer history
186
- else
191
+ when "", nil
187
192
  self.print # qer
193
+ else
194
+ self.no_match cmd
188
195
  end
189
196
  end
190
197
 
@@ -220,5 +227,9 @@ Commands:
220
227
  EOF
221
228
  puts string unless self.class.quiet
222
229
  end
230
+
231
+ def no_match cmd
232
+ puts "Did not recognize command: #{cmd}"
233
+ end
223
234
  end
224
235
  end
@@ -172,6 +172,18 @@ class TestQer < Test::Unit::TestCase
172
172
  assert_output(/Adding: some stuff/)
173
173
  end
174
174
 
175
+ should "add with shorthand cmd" do
176
+ @todo.command(%w(a some stuff))
177
+ assert_equal 2, @todo.queue.size
178
+ assert_output(/Adding: some stuff/)
179
+ end
180
+
181
+ should "not add" do
182
+ @todo.command(%w(asdf))
183
+ assert_equal 1, @todo.queue.size
184
+ assert_output(/did not recognize/i)
185
+ end
186
+
175
187
  should "remove" do
176
188
  assert_equal "Some Task", @todo.command(%w(remove 0)).last
177
189
  assert_equal 0, @todo.queue.size
@@ -183,6 +195,12 @@ class TestQer < Test::Unit::TestCase
183
195
  assert_output "Provided index does not exist."
184
196
  end
185
197
 
198
+ should "not remove anything with nil index" do
199
+ @todo.command(%w(remove))
200
+ assert_output /Remove must have an index:/
201
+ assert_equal 1, @todo.queue.size
202
+ end
203
+
186
204
  should "push" do
187
205
  @todo.command(%w(push some stuff))
188
206
  assert_equal 2, @todo.queue.size
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ prerelease:
5
+ version: 0.3.1
5
6
  platform: ruby
6
7
  authors:
7
8
  - Josh Kleinpeter
@@ -11,29 +12,30 @@ autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
14
 
14
- date: 2010-05-18 00:00:00 -07:00
15
- default_executable:
15
+ date: 2011-04-21 00:00:00 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: shoulda
19
- type: :development
20
- version_requirement:
21
- version_requirements: !ruby/object:Gem::Requirement
19
+ prerelease: false
20
+ requirement: &id001 !ruby/object:Gem::Requirement
21
+ none: false
22
22
  requirements:
23
23
  - - ">"
24
24
  - !ruby/object:Gem::Version
25
25
  version: 2.10.1
26
- version:
26
+ type: :development
27
+ version_requirements: *id001
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: hoe
29
- type: :development
30
- version_requirement:
31
- version_requirements: !ruby/object:Gem::Requirement
30
+ prerelease: false
31
+ requirement: &id002 !ruby/object:Gem::Requirement
32
+ none: false
32
33
  requirements:
33
34
  - - ">="
34
35
  - !ruby/object:Gem::Version
35
- version: 2.5.0
36
- version:
36
+ version: 2.9.4
37
+ type: :development
38
+ version_requirements: *id002
37
39
  description: Qer is an easy command-line todo list.
38
40
  email:
39
41
  - josh@kleinpeter.org
@@ -62,7 +64,7 @@ files:
62
64
  - test/test_qer.rb
63
65
  - test/test_queue
64
66
  - test/testqueue
65
- has_rdoc: true
67
+ - .gemtest
66
68
  homepage:
67
69
  licenses: []
68
70
 
@@ -73,21 +75,21 @@ rdoc_options:
73
75
  require_paths:
74
76
  - lib
75
77
  required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
76
79
  requirements:
77
80
  - - ">="
78
81
  - !ruby/object:Gem::Version
79
82
  version: "0"
80
- version:
81
83
  required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
82
85
  requirements:
83
86
  - - ">="
84
87
  - !ruby/object:Gem::Version
85
88
  version: "0"
86
- version:
87
89
  requirements: []
88
90
 
89
91
  rubyforge_project: qer
90
- rubygems_version: 1.3.5
92
+ rubygems_version: 1.7.2
91
93
  signing_key:
92
94
  specification_version: 3
93
95
  summary: Just type `qer --help` to get started.