rufus-jig 0.1.11 → 0.1.12

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/CHANGELOG.txt CHANGED
@@ -1,6 +1,10 @@
1
1
 
2
2
  = rufus-jig CHANGELOG.txt
3
3
 
4
+ == rufus-jig - 0.1.12 released 2010/01/13
5
+
6
+ - fixed bug with Couch and delete('missing')
7
+
4
8
 
5
9
  == rufus-jig - 0.1.11 released 2010/01/11
6
10
 
@@ -84,27 +84,34 @@ module Rufus::Jig
84
84
 
85
85
  def delete (doc_or_path, rev=nil)
86
86
 
87
- doc_or_path = { '_id' => doc_or_path, '_rev' => rev } if rev
88
-
89
- r = if doc_or_path.is_a?(String)
87
+ doc, path, rev = if rev
88
+ [ { '_id' => doc_or_path, '_rev' => rev }, doc_or_path ]
89
+ elsif doc_or_path.is_a?(String)
90
+ [ nil, doc_or_path ]
91
+ else
92
+ [ doc_or_path, doc_or_path['_id'] ]
93
+ end
90
94
 
91
- @http.delete(adjust(doc_or_path))
95
+ path = adjust(path)
92
96
 
93
- else
97
+ r = if doc
94
98
 
95
99
  raise(
96
100
  ArgumentError.new("cannot delete document without _rev")
97
- ) unless doc_or_path['_rev']
101
+ ) unless doc['_rev']
102
+
103
+ rpath = Rufus::Jig::Path.add_params(path, :rev => doc['_rev'])
98
104
 
99
- path = adjust(doc_or_path['_id'])
100
- path = Rufus::Jig::Path.add_params(path, :rev => doc_or_path['_rev'])
105
+ @http.delete(rpath)
106
+
107
+ else
101
108
 
102
109
  @http.delete(path)
103
110
  end
104
111
 
105
112
  if r == true # conflict
106
113
 
107
- doc = @http.get(adjust(doc_or_path['_id']))
114
+ doc = @http.get(path)
108
115
  doc ? doc : true
109
116
  # returns the doc if present or true if the doc is gone
110
117
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Rufus
3
3
  module Jig
4
- VERSION = '0.1.11'
4
+ VERSION = '0.1.12'
5
5
  end
6
6
  end
7
7
 
data/rufus-jig.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rufus-jig}
8
- s.version = "0.1.11"
8
+ s.version = "0.1.12"
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", "Kenneth Kalmer"]
12
- s.date = %q{2010-01-11}
12
+ s.date = %q{2010-01-13}
13
13
  s.description = %q{
14
14
  Json Interwebs Get.
15
15
 
data/test/ct_1_couchdb.rb CHANGED
@@ -154,5 +154,19 @@ class CtCouchDbTest < Test::Unit::TestCase
154
154
  doc = @c.get('coffee1')
155
155
  assert_equal 304, @c.http.last_response.status
156
156
  end
157
+
158
+ def test_delete_path
159
+
160
+ r = @c.delete('coffee1')
161
+
162
+ assert_equal(@c.get('coffee1'), r)
163
+ end
164
+
165
+ def test_delete_path_missing
166
+
167
+ r = @c.delete('missing')
168
+
169
+ assert_equal(true, r)
170
+ end
157
171
  end
158
172
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-jig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-01-11 00:00:00 +09:00
13
+ date: 2010-01-13 00:00:00 +09:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency