rufus-cloche 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +10 -0
- data/lib/rufus/cloche.rb +8 -1
- data/rufus-cloche.gemspec +1 -1
- data/test/test.rb +13 -0
- metadata +1 -1
data/CHANGELOG.txt
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
= rufus-cloche CHANGELOG.txt
|
3
3
|
|
4
4
|
|
5
|
+
== rufus-cloche - 0.1.12 released 2010/01/06
|
6
|
+
|
7
|
+
- implemented Cloche#purge_type!(t)
|
8
|
+
|
9
|
+
|
10
|
+
== rufus-cloche - 0.1.11 released 2010/01/06
|
11
|
+
|
12
|
+
- test/con to test/conc, thanks gauched
|
13
|
+
|
14
|
+
|
5
15
|
== rufus-cloche - 0.1.10 released 2010/01/03
|
6
16
|
|
7
17
|
- increased mutex coverage (though flock matters more)
|
data/lib/rufus/cloche.rb
CHANGED
@@ -43,7 +43,7 @@ module Rufus
|
|
43
43
|
#
|
44
44
|
class Cloche
|
45
45
|
|
46
|
-
VERSION = '0.1.
|
46
|
+
VERSION = '0.1.12'
|
47
47
|
|
48
48
|
attr_reader :dir
|
49
49
|
|
@@ -192,6 +192,13 @@ module Rufus
|
|
192
192
|
docs
|
193
193
|
end
|
194
194
|
|
195
|
+
# Removes entirely documents of a given type.
|
196
|
+
#
|
197
|
+
def purge_type! (type)
|
198
|
+
|
199
|
+
FileUtils.rm_rf(dir_for(type))
|
200
|
+
end
|
201
|
+
|
195
202
|
protected
|
196
203
|
|
197
204
|
def self.neutralize (s)
|
data/rufus-cloche.gemspec
CHANGED
data/test/test.rb
CHANGED
@@ -186,6 +186,19 @@ class ClocheTest < Test::Unit::TestCase
|
|
186
186
|
assert_equal 1, @c.get_many('nothing').size
|
187
187
|
end
|
188
188
|
|
189
|
+
def test_purge_type
|
190
|
+
|
191
|
+
@c.put({ '_id' => 'thing.0', 'type' => 'unthing', 'color' => 'blue' })
|
192
|
+
@c.put({ '_id' => 'thing.1', 'type' => 'unthing', 'color' => 'blue' })
|
193
|
+
@c.put({ '_id' => 'thing.2', 'type' => 'unthing', 'color' => 'blue' })
|
194
|
+
|
195
|
+
assert_equal 3, @c.get_many('unthing').size
|
196
|
+
|
197
|
+
@c.purge_type!('unthing')
|
198
|
+
|
199
|
+
assert_equal 0, @c.get_many('unthing').size
|
200
|
+
end
|
201
|
+
|
189
202
|
protected
|
190
203
|
|
191
204
|
def load_people
|