rufus-cloche 0.1.8 → 0.1.9

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.
@@ -2,6 +2,11 @@
2
2
  = rufus-cloche CHANGELOG.txt
3
3
 
4
4
 
5
+ == rufus-cloche - 0.1.9 released 2009/12/29
6
+
7
+ - put returns true when document is gone
8
+
9
+
5
10
  == rufus-cloche - 0.1.8 released 2009/12/25
6
11
 
7
12
  - now using rufus-json
@@ -42,7 +42,7 @@ module Rufus
42
42
  #
43
43
  class Cloche
44
44
 
45
- VERSION = '0.1.8'
45
+ VERSION = '0.1.9'
46
46
 
47
47
  attr_reader :dir
48
48
 
@@ -90,6 +90,7 @@ module Rufus
90
90
  cur = do_get(file)
91
91
 
92
92
  return cur if cur && cur['_rev'] != doc['_rev']
93
+ return true if cur.nil? && doc['_rev'] != -1
93
94
 
94
95
  doc['_rev'] = doc['_rev'] + 1
95
96
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rufus-cloche}
8
- s.version = "0.1.8"
8
+ s.version = "0.1.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["John Mettraux"]
12
- s.date = %q{2009-12-25}
12
+ s.date = %q{2009-12-29}
13
13
  s.description = %q{
14
14
  A very stupid JSON hash store.
15
15
 
@@ -91,6 +91,22 @@ class ClocheTest < Test::Unit::TestCase
91
91
  assert_equal 1, h['_rev']
92
92
  end
93
93
 
94
+ def test_put_gone
95
+
96
+ @c.put(
97
+ { '_id' => 'john', 'type' => 'person', 'eyes' => 'green' })
98
+ @c.delete(
99
+ { '_id' => 'john', 'type' => 'person', '_rev' => 0 })
100
+
101
+ assert_nil @c.get('person', 'john')
102
+
103
+ r = @c.put(
104
+ { '_id' => 'john', 'type' => 'person', 'eyes' => 'blue', '_rev' => 0 })
105
+
106
+ assert_equal true, r
107
+ assert_nil @c.get('person', 'john')
108
+ end
109
+
94
110
  def test_delete_missing
95
111
 
96
112
  r = @c.delete({ '_id' => 'john', 'type' => 'person', 'eyes' => 'green', '_rev' => 7 })
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-cloche
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-25 00:00:00 +09:00
12
+ date: 2009-12-29 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency