ruote-couch 2.1.1 → 2.1.4
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 +8 -1
- data/Rakefile +2 -1
- data/lib/ruote/couch/database.rb +20 -11
- data/lib/ruote/couch/storage.rb +15 -1
- data/lib/ruote/couch/version.rb +1 -1
- data/ruote-couch.gemspec +8 -5
- data/test/integration_connection.rb +6 -1
- metadata +13 -3
data/CHANGELOG.txt
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
|
2
2
|
= ruote-couch - CHANGELOG.txt
|
3
3
|
|
4
|
-
|
4
|
+
|
5
|
+
== ruote-couch 2.1.4 released 2009/01/11
|
6
|
+
|
7
|
+
- Ruote::Couch::Storage added #ids(type)
|
8
|
+
- Ruote::Couch::Storage added #purge_type!(t)
|
9
|
+
|
10
|
+
|
11
|
+
== ruote-couch 2.1.3 released 2009/01/05
|
5
12
|
|
data/Rakefile
CHANGED
@@ -32,9 +32,10 @@ CouchDB storage for ruote 2.1 (ruby workflow engine)
|
|
32
32
|
|
33
33
|
gem.test_file = 'test/test.rb'
|
34
34
|
|
35
|
+
gem.add_dependency 'ruote', ">= #{Ruote::Couch::VERSION}"
|
35
36
|
#gem.add_dependency 'yajl-ruby'
|
36
37
|
#gem.add_dependency 'json'
|
37
|
-
gem.add_dependency 'rufus-jig', '>= 0.1.
|
38
|
+
gem.add_dependency 'rufus-jig', '>= 0.1.11'
|
38
39
|
gem.add_development_dependency 'yard', '>= 0'
|
39
40
|
|
40
41
|
# gemspec spec : http://www.rubygems.org/read/chapter/20
|
data/lib/ruote/couch/database.rb
CHANGED
@@ -57,17 +57,7 @@ module Ruote::Couch
|
|
57
57
|
|
58
58
|
def delete (doc)
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
@couch.delete(doc)
|
63
|
-
|
64
|
-
rescue Rufus::Jig::HttpError => he
|
65
|
-
if he.status == 404
|
66
|
-
true
|
67
|
-
else
|
68
|
-
raise he
|
69
|
-
end
|
70
|
-
end
|
60
|
+
@couch.delete(doc)
|
71
61
|
end
|
72
62
|
|
73
63
|
def get_many (key, opts)
|
@@ -88,6 +78,15 @@ module Ruote::Couch
|
|
88
78
|
rs
|
89
79
|
end
|
90
80
|
|
81
|
+
# Returns a sorted list of the ids of all the docs in this database.
|
82
|
+
#
|
83
|
+
def ids
|
84
|
+
|
85
|
+
rs = @couch.get('_all_docs')
|
86
|
+
|
87
|
+
rs['rows'].collect { |r| r['id'] }
|
88
|
+
end
|
89
|
+
|
91
90
|
def dump
|
92
91
|
|
93
92
|
s = "=== #{@type} ===\n"
|
@@ -105,12 +104,22 @@ module Ruote::Couch
|
|
105
104
|
@couch.close
|
106
105
|
end
|
107
106
|
|
107
|
+
# Deletes database and closes it.
|
108
|
+
#
|
108
109
|
def purge!
|
109
110
|
|
110
111
|
@couch.delete('.')
|
111
112
|
@couch.close
|
112
113
|
end
|
113
114
|
|
115
|
+
# Removes all the documents in this database.
|
116
|
+
#
|
117
|
+
def purge_docs!
|
118
|
+
|
119
|
+
@couch.delete('.')
|
120
|
+
@couch.put('.')
|
121
|
+
end
|
122
|
+
|
114
123
|
protected
|
115
124
|
|
116
125
|
def prepare
|
data/lib/ruote/couch/storage.rb
CHANGED
@@ -91,6 +91,11 @@ module Couch
|
|
91
91
|
@dbs[type].get_many(key, opts)
|
92
92
|
end
|
93
93
|
|
94
|
+
def ids (type)
|
95
|
+
|
96
|
+
@dbs[type].ids
|
97
|
+
end
|
98
|
+
|
94
99
|
def purge!
|
95
100
|
|
96
101
|
@dbs.values.each { |db| db.purge! }
|
@@ -108,12 +113,21 @@ module Couch
|
|
108
113
|
|
109
114
|
# Mainly used by ruote's test/unit/ut_17_storage.rb
|
110
115
|
#
|
111
|
-
def
|
116
|
+
def add_type (type)
|
112
117
|
|
113
118
|
@dbs[type] = Database.new(
|
114
119
|
@host, @port, type, "#{@prefix}ruote_#{type}", false)
|
115
120
|
end
|
116
121
|
|
122
|
+
# Nukes a db type and reputs it (losing all the documents that were in it).
|
123
|
+
#
|
124
|
+
def purge_type! (type)
|
125
|
+
|
126
|
+
if db = @dbs[type]
|
127
|
+
db.purge_docs!
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
117
131
|
protected
|
118
132
|
|
119
133
|
def put_configuration
|
data/lib/ruote/couch/version.rb
CHANGED
data/ruote-couch.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruote-couch}
|
8
|
-
s.version = "2.1.
|
8
|
+
s.version = "2.1.4"
|
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{
|
12
|
+
s.date = %q{2010-01-11}
|
13
13
|
s.description = %q{CouchDB storage for ruote 2.1 (ruby workflow engine)}
|
14
14
|
s.email = %q{jmettraux@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -52,14 +52,17 @@ Gem::Specification.new do |s|
|
|
52
52
|
s.specification_version = 3
|
53
53
|
|
54
54
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
55
|
-
s.add_runtime_dependency(%q<
|
55
|
+
s.add_runtime_dependency(%q<ruote>, [">= 2.1.4"])
|
56
|
+
s.add_runtime_dependency(%q<rufus-jig>, [">= 0.1.11"])
|
56
57
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
57
58
|
else
|
58
|
-
s.add_dependency(%q<
|
59
|
+
s.add_dependency(%q<ruote>, [">= 2.1.4"])
|
60
|
+
s.add_dependency(%q<rufus-jig>, [">= 0.1.11"])
|
59
61
|
s.add_dependency(%q<yard>, [">= 0"])
|
60
62
|
end
|
61
63
|
else
|
62
|
-
s.add_dependency(%q<
|
64
|
+
s.add_dependency(%q<ruote>, [">= 2.1.4"])
|
65
|
+
s.add_dependency(%q<rufus-jig>, [">= 0.1.11"])
|
63
66
|
s.add_dependency(%q<yard>, [">= 0"])
|
64
67
|
end
|
65
68
|
end
|
@@ -6,9 +6,14 @@
|
|
6
6
|
#
|
7
7
|
|
8
8
|
require 'yajl' rescue require 'json'
|
9
|
+
require 'rufus-json'
|
9
10
|
Rufus::Json.detect_backend
|
10
11
|
|
11
|
-
|
12
|
+
begin
|
13
|
+
require 'patron'
|
14
|
+
rescue LoadError
|
15
|
+
# then use 'net/http'
|
16
|
+
end
|
12
17
|
|
13
18
|
require 'ruote/couch/storage'
|
14
19
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruote-couch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
@@ -9,9 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-11 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ruote
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.1.4
|
24
|
+
version:
|
15
25
|
- !ruby/object:Gem::Dependency
|
16
26
|
name: rufus-jig
|
17
27
|
type: :runtime
|
@@ -20,7 +30,7 @@ dependencies:
|
|
20
30
|
requirements:
|
21
31
|
- - ">="
|
22
32
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.1.
|
33
|
+
version: 0.1.11
|
24
34
|
version:
|
25
35
|
- !ruby/object:Gem::Dependency
|
26
36
|
name: yard
|