ruote-couch 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +5 -0
- data/LICENSE.txt +21 -0
- data/README.rdoc +26 -0
- data/Rakefile +77 -0
- data/TODO.txt +8 -0
- data/lib/ruote-couch.rb +3 -0
- data/lib/ruote/couch.rb +3 -0
- data/lib/ruote/couch/database.rb +145 -0
- data/lib/ruote/couch/storage.rb +144 -0
- data/lib/ruote/couch/version.rb +7 -0
- data/ruote-couch.gemspec +66 -0
- data/test/functional/ft_0_echo.rb +42 -0
- data/test/functional/test.rb +11 -0
- data/test/integration_connection.rb +23 -0
- data/test/path_helper.rb +16 -0
- data/test/test.rb +10 -0
- data/test/test_helper.rb +13 -0
- data/test/unit/test.rb +11 -0
- data/test/unit/ut_0_initial.rb +27 -0
- metadata +93 -0
data/CHANGELOG.txt
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
Copyright (c) 2001-2010, John Mettraux, jmettraux@gmail.com
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
12
|
+
all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
THE SOFTWARE.
|
21
|
+
|
data/README.rdoc
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
= ruote-couch
|
3
|
+
|
4
|
+
A storage implementation for ruote 2.1.x.
|
5
|
+
|
6
|
+
Warning : this is a very naive implementation for now. No optimizations.
|
7
|
+
|
8
|
+
|
9
|
+
== license
|
10
|
+
|
11
|
+
MIT
|
12
|
+
|
13
|
+
|
14
|
+
== Links
|
15
|
+
|
16
|
+
http://ruote.rubyforge.org
|
17
|
+
http://github.com/jmettraux/ruote
|
18
|
+
|
19
|
+
http://jmettraux.wordpress.com (blog)
|
20
|
+
|
21
|
+
|
22
|
+
== feedback
|
23
|
+
|
24
|
+
mailing list : http://groups.google.com/group/openwferu-users
|
25
|
+
irc : irc.freenode.net #ruote
|
26
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
require 'lib/ruote/couch/version.rb'
|
6
|
+
|
7
|
+
#
|
8
|
+
# CLEAN
|
9
|
+
|
10
|
+
require 'rake/clean'
|
11
|
+
CLEAN.include('pkg', 'tmp', 'html')
|
12
|
+
task :default => [ :clean ]
|
13
|
+
|
14
|
+
|
15
|
+
#
|
16
|
+
# GEM
|
17
|
+
|
18
|
+
require 'jeweler'
|
19
|
+
|
20
|
+
Jeweler::Tasks.new do |gem|
|
21
|
+
|
22
|
+
gem.version = Ruote::Couch::VERSION
|
23
|
+
gem.name = 'ruote-couch'
|
24
|
+
gem.summary = 'CouchDB storage for ruote 2.1'
|
25
|
+
gem.description = %{
|
26
|
+
CouchDB storage for ruote 2.1 (ruby workflow engine)
|
27
|
+
}.strip
|
28
|
+
gem.email = 'jmettraux@gmail.com'
|
29
|
+
gem.homepage = 'http://github.com/jmettraux/ruote-couch'
|
30
|
+
gem.authors = [ 'John Mettraux' ]
|
31
|
+
gem.rubyforge_project = 'ruote'
|
32
|
+
|
33
|
+
gem.test_file = 'test/test.rb'
|
34
|
+
|
35
|
+
#gem.add_dependency 'yajl-ruby'
|
36
|
+
#gem.add_dependency 'json'
|
37
|
+
gem.add_dependency 'rufus-jig', '>= 0.1.6'
|
38
|
+
gem.add_development_dependency 'yard', '>= 0'
|
39
|
+
|
40
|
+
# gemspec spec : http://www.rubygems.org/read/chapter/20
|
41
|
+
end
|
42
|
+
Jeweler::GemcutterTasks.new
|
43
|
+
|
44
|
+
|
45
|
+
#
|
46
|
+
# DOC
|
47
|
+
|
48
|
+
begin
|
49
|
+
|
50
|
+
require 'yard'
|
51
|
+
|
52
|
+
YARD::Rake::YardocTask.new do |doc|
|
53
|
+
doc.options = [
|
54
|
+
'-o', 'html/ruote-couch', '--title',
|
55
|
+
"ruote-couch #{Ruote::Couch::VERSION}"
|
56
|
+
]
|
57
|
+
end
|
58
|
+
|
59
|
+
rescue LoadError
|
60
|
+
|
61
|
+
task :yard do
|
62
|
+
abort "YARD is not available : sudo gem install yard"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
#
|
68
|
+
# TO THE WEB
|
69
|
+
|
70
|
+
task :upload_website => [ :clean, :yard ] do
|
71
|
+
|
72
|
+
account = 'jmettraux@rubyforge.org'
|
73
|
+
webdir = '/var/www/gforge-projects/ruote'
|
74
|
+
|
75
|
+
sh "rsync -azv -e ssh html/ruote-couch #{account}:#{webdir}/"
|
76
|
+
end
|
77
|
+
|
data/TODO.txt
ADDED
data/lib/ruote-couch.rb
ADDED
data/lib/ruote/couch.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#
|
22
|
+
# Made in Japan.
|
23
|
+
#++
|
24
|
+
|
25
|
+
|
26
|
+
module Ruote::Couch
|
27
|
+
|
28
|
+
class Database
|
29
|
+
|
30
|
+
attr_reader :type
|
31
|
+
|
32
|
+
def initialize (host, port, type, name, re_put_ok=true)
|
33
|
+
|
34
|
+
@couch = Rufus::Jig::Couch.new(host, port, name, :re_put_ok => re_put_ok)
|
35
|
+
@couch.put('.') unless @couch.get('.')
|
36
|
+
|
37
|
+
@type = type
|
38
|
+
|
39
|
+
prepare
|
40
|
+
end
|
41
|
+
|
42
|
+
def put (doc, opts)
|
43
|
+
|
44
|
+
doc['put_at'] = Ruote.now_to_utc_s
|
45
|
+
|
46
|
+
@couch.put(doc, :update_rev => opts[:update_rev])
|
47
|
+
#
|
48
|
+
# :update_rev => true :
|
49
|
+
# updating the current doc _rev, this trick allows
|
50
|
+
# direct "create then apply" chaining
|
51
|
+
end
|
52
|
+
|
53
|
+
def get (key)
|
54
|
+
|
55
|
+
@couch.get(key)
|
56
|
+
end
|
57
|
+
|
58
|
+
def delete (doc)
|
59
|
+
|
60
|
+
begin
|
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
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_many (key, opts)
|
74
|
+
|
75
|
+
os = if l = opts[:limit]
|
76
|
+
"&limit=#{l}"
|
77
|
+
else
|
78
|
+
''
|
79
|
+
end
|
80
|
+
|
81
|
+
rs = @couch.get("_all_docs?include_docs=true#{os}")
|
82
|
+
|
83
|
+
rs = rs['rows'].collect { |e| e['doc'] }
|
84
|
+
|
85
|
+
rs = rs.select { |doc| doc['_id'].match(key) } if key
|
86
|
+
# naive...
|
87
|
+
|
88
|
+
rs
|
89
|
+
end
|
90
|
+
|
91
|
+
def dump
|
92
|
+
|
93
|
+
s = "=== #{@type} ===\n"
|
94
|
+
|
95
|
+
get_many(nil, {}).inject(s) do |s1, e|
|
96
|
+
s1 << "\n"
|
97
|
+
e.keys.sort.inject(s1) do |s2, k|
|
98
|
+
s2 << " #{k} => #{e[k].inspect}\n"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def shutdown
|
104
|
+
|
105
|
+
@couch.close
|
106
|
+
end
|
107
|
+
|
108
|
+
def purge!
|
109
|
+
|
110
|
+
@couch.delete('.')
|
111
|
+
@couch.close
|
112
|
+
end
|
113
|
+
|
114
|
+
protected
|
115
|
+
|
116
|
+
def prepare
|
117
|
+
|
118
|
+
# nothing to do for a index-less database
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
class WfidIndexedDatabase < Database
|
123
|
+
|
124
|
+
#DESIGN_DOC_TEMPLATE = %{
|
125
|
+
# {
|
126
|
+
# "_id": "_design/ruote",
|
127
|
+
# "version": 0,
|
128
|
+
#
|
129
|
+
# "views": {
|
130
|
+
# "by_type": {
|
131
|
+
# "map": "function (doc) { emit(doc.type, doc); }"
|
132
|
+
# }
|
133
|
+
# }
|
134
|
+
# }
|
135
|
+
#}.strip
|
136
|
+
|
137
|
+
protected
|
138
|
+
|
139
|
+
def prepare
|
140
|
+
|
141
|
+
# TODO
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
@@ -0,0 +1,144 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#
|
22
|
+
# Made in Japan.
|
23
|
+
#++
|
24
|
+
|
25
|
+
require 'ruote/storage/base'
|
26
|
+
require 'ruote/couch/version'
|
27
|
+
require 'ruote/couch/database'
|
28
|
+
require 'rufus/jig' # gem install rufus-jig
|
29
|
+
|
30
|
+
|
31
|
+
module Ruote
|
32
|
+
module Couch
|
33
|
+
|
34
|
+
class CouchStorage
|
35
|
+
|
36
|
+
include Ruote::StorageBase
|
37
|
+
|
38
|
+
attr_reader :couch
|
39
|
+
|
40
|
+
def initialize (host, port, options={})
|
41
|
+
|
42
|
+
@host = host
|
43
|
+
@port = port
|
44
|
+
|
45
|
+
@options = options
|
46
|
+
|
47
|
+
@prefix = options['prefix'] || ''
|
48
|
+
@prefix = "#{@prefix}_" if @prefix.size > 0
|
49
|
+
|
50
|
+
@dbs = {}
|
51
|
+
|
52
|
+
%w[ msgs schedules configurations variables ].each do |type|
|
53
|
+
|
54
|
+
@dbs[type] = Database.new(
|
55
|
+
@host, @port, type, "#{@prefix}ruote_#{type}")
|
56
|
+
end
|
57
|
+
|
58
|
+
%w[ errors workitems ].each do |type|
|
59
|
+
|
60
|
+
@dbs[type] = WfidIndexedDatabase.new(
|
61
|
+
@host, @port, type, "#{@prefix}ruote_#{type}")
|
62
|
+
end
|
63
|
+
|
64
|
+
@dbs['expressions'] = WfidIndexedDatabase.new(
|
65
|
+
@host, @port, 'expressions', "#{@prefix}ruote_expressions", false)
|
66
|
+
|
67
|
+
put_configuration
|
68
|
+
end
|
69
|
+
|
70
|
+
def put (doc, opts={})
|
71
|
+
|
72
|
+
@dbs[doc['type']].put(doc, opts)
|
73
|
+
end
|
74
|
+
|
75
|
+
def get (type, key)
|
76
|
+
|
77
|
+
@dbs[type].get(key)
|
78
|
+
end
|
79
|
+
|
80
|
+
def delete (doc)
|
81
|
+
|
82
|
+
db = @dbs[doc['type']]
|
83
|
+
|
84
|
+
raise ArgumentError.new("no database for type '#{doc['type']}'") unless db
|
85
|
+
|
86
|
+
db.delete(doc)
|
87
|
+
end
|
88
|
+
|
89
|
+
def get_many (type, key=nil, opts={})
|
90
|
+
|
91
|
+
@dbs[type].get_many(key, opts)
|
92
|
+
end
|
93
|
+
|
94
|
+
def purge!
|
95
|
+
|
96
|
+
@dbs.values.each { |db| db.purge! }
|
97
|
+
end
|
98
|
+
|
99
|
+
def dump (type)
|
100
|
+
|
101
|
+
@dbs[type].dump
|
102
|
+
end
|
103
|
+
|
104
|
+
def shutdown
|
105
|
+
|
106
|
+
@dbs.values.each { |db| db.shutdown }
|
107
|
+
end
|
108
|
+
|
109
|
+
# Mainly used by ruote's test/unit/ut_17_storage.rb
|
110
|
+
#
|
111
|
+
def add_test_type (type)
|
112
|
+
|
113
|
+
@dbs[type] = Database.new(
|
114
|
+
@host, @port, type, "#{@prefix}ruote_#{type}", false)
|
115
|
+
end
|
116
|
+
|
117
|
+
protected
|
118
|
+
|
119
|
+
def put_configuration
|
120
|
+
|
121
|
+
return if get('configurations', 'engine')
|
122
|
+
|
123
|
+
conf = { '_id' => 'engine', 'type' => 'configurations' }.merge!(@options)
|
124
|
+
|
125
|
+
put(conf)
|
126
|
+
end
|
127
|
+
|
128
|
+
# def put_design_document
|
129
|
+
#
|
130
|
+
# doc = Rufus::Jig::Json.decode(
|
131
|
+
# File.read(File.join(File.dirname(__FILE__), 'storage.json')))
|
132
|
+
#
|
133
|
+
# current = @couch.get('_design/ruote')
|
134
|
+
#
|
135
|
+
# if current.nil? || doc['version'] >= (current['version'] || -1)
|
136
|
+
#
|
137
|
+
# @couch.delete(current) if current
|
138
|
+
# @couch.put(doc)
|
139
|
+
# end
|
140
|
+
# end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
data/ruote-couch.gemspec
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ruote-couch}
|
8
|
+
s.version = "2.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["John Mettraux"]
|
12
|
+
s.date = %q{2009-12-31}
|
13
|
+
s.description = %q{CouchDB storage for ruote 2.1 (ruby workflow engine)}
|
14
|
+
s.email = %q{jmettraux@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"CHANGELOG.txt",
|
21
|
+
"LICENSE.txt",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"TODO.txt",
|
25
|
+
"lib/ruote-couch.rb",
|
26
|
+
"lib/ruote/couch.rb",
|
27
|
+
"lib/ruote/couch/database.rb",
|
28
|
+
"lib/ruote/couch/storage.rb",
|
29
|
+
"lib/ruote/couch/version.rb",
|
30
|
+
"ruote-couch.gemspec",
|
31
|
+
"test/functional/ft_0_echo.rb",
|
32
|
+
"test/functional/test.rb",
|
33
|
+
"test/integration_connection.rb",
|
34
|
+
"test/path_helper.rb",
|
35
|
+
"test/test.rb",
|
36
|
+
"test/test_helper.rb",
|
37
|
+
"test/unit/test.rb",
|
38
|
+
"test/unit/ut_0_initial.rb"
|
39
|
+
]
|
40
|
+
s.homepage = %q{http://github.com/jmettraux/ruote-couch}
|
41
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
42
|
+
s.require_paths = ["lib"]
|
43
|
+
s.rubyforge_project = %q{ruote}
|
44
|
+
s.rubygems_version = %q{1.3.5}
|
45
|
+
s.summary = %q{CouchDB storage for ruote 2.1}
|
46
|
+
s.test_files = [
|
47
|
+
"test/test.rb"
|
48
|
+
]
|
49
|
+
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
55
|
+
s.add_runtime_dependency(%q<rufus-jig>, [">= 0.1.6"])
|
56
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<rufus-jig>, [">= 0.1.6"])
|
59
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
60
|
+
end
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<rufus-jig>, [">= 0.1.6"])
|
63
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote-couch
|
4
|
+
#
|
5
|
+
# Fri Dec 11 22:06:25 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), '..', 'test_helper.rb')
|
9
|
+
|
10
|
+
require 'ruote/engine'
|
11
|
+
require 'ruote/worker'
|
12
|
+
|
13
|
+
require File.join(File.dirname(__FILE__), '..', 'integration_connection.rb')
|
14
|
+
|
15
|
+
|
16
|
+
class FtInitialTest < Test::Unit::TestCase
|
17
|
+
|
18
|
+
def test_echo
|
19
|
+
|
20
|
+
#require 'ruote/storage/hash_storage'
|
21
|
+
#storage = Ruote::HashStorage.new
|
22
|
+
#require 'ruote/storage/fs_storage'
|
23
|
+
#storage = Ruote::FsStorage.new('work')
|
24
|
+
|
25
|
+
storage = new_storage(nil)
|
26
|
+
|
27
|
+
engine = Ruote::Engine.new(Ruote::Worker.new(storage))
|
28
|
+
|
29
|
+
engine.context[:noisy] = true
|
30
|
+
|
31
|
+
pdef = Ruote.process_definition :name => 'test' do
|
32
|
+
echo '* SEEN *'
|
33
|
+
end
|
34
|
+
|
35
|
+
wfid = engine.launch(pdef)
|
36
|
+
|
37
|
+
engine.wait_for(wfid)
|
38
|
+
|
39
|
+
#storage.purge!
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote-couch
|
4
|
+
#
|
5
|
+
# Sun Dec 13 20:22:43 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'yajl' rescue require 'json'
|
9
|
+
Rufus::Json.detect_backend
|
10
|
+
|
11
|
+
require 'patron' rescue nil
|
12
|
+
|
13
|
+
require 'ruote/couch/storage'
|
14
|
+
|
15
|
+
|
16
|
+
def new_storage (opts)
|
17
|
+
|
18
|
+
opts ||= {}
|
19
|
+
|
20
|
+
Ruote::Couch::CouchStorage.new(
|
21
|
+
'127.0.0.1', 5984, opts.merge!('prefix' => 'test'))
|
22
|
+
end
|
23
|
+
|
data/test/path_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote-couch
|
4
|
+
#
|
5
|
+
# Thu Dec 10 11:04:02 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
ruote_lib = File.expand_path(
|
9
|
+
File.join(File.dirname(__FILE__), *%w[ .. .. ruote lib ]))
|
10
|
+
ruote_couch_lib = File.expand_path(
|
11
|
+
File.join(File.dirname(__FILE__), *%w[ .. lib ]))
|
12
|
+
|
13
|
+
[ ruote_lib, ruote_couch_lib ].each do |lib|
|
14
|
+
$:.unshift(lib) unless $:.include?(lib)
|
15
|
+
end
|
16
|
+
|
data/test/test.rb
ADDED
data/test/test_helper.rb
ADDED
data/test/unit/test.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote-couch
|
4
|
+
#
|
5
|
+
# Thu Dec 10 11:07:56 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), '..', 'test_helper.rb')
|
9
|
+
|
10
|
+
require 'ruote/couch/storage'
|
11
|
+
|
12
|
+
|
13
|
+
class UtInitialTest < Test::Unit::TestCase
|
14
|
+
|
15
|
+
def test_connect
|
16
|
+
|
17
|
+
storage = Ruote::Couch::CouchStorage.new(
|
18
|
+
'127.0.0.1', 5984, :prefix => 'test')
|
19
|
+
|
20
|
+
v = storage.get_many('configurations')
|
21
|
+
|
22
|
+
#p v
|
23
|
+
|
24
|
+
assert_equal 1, v.size
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruote-couch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Mettraux
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-31 00:00:00 +09:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rufus-jig
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.1.6
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: yard
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description: CouchDB storage for ruote 2.1 (ruby workflow engine)
|
36
|
+
email: jmettraux@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- LICENSE.txt
|
43
|
+
- README.rdoc
|
44
|
+
files:
|
45
|
+
- CHANGELOG.txt
|
46
|
+
- LICENSE.txt
|
47
|
+
- README.rdoc
|
48
|
+
- Rakefile
|
49
|
+
- TODO.txt
|
50
|
+
- lib/ruote-couch.rb
|
51
|
+
- lib/ruote/couch.rb
|
52
|
+
- lib/ruote/couch/database.rb
|
53
|
+
- lib/ruote/couch/storage.rb
|
54
|
+
- lib/ruote/couch/version.rb
|
55
|
+
- ruote-couch.gemspec
|
56
|
+
- test/functional/ft_0_echo.rb
|
57
|
+
- test/functional/test.rb
|
58
|
+
- test/integration_connection.rb
|
59
|
+
- test/path_helper.rb
|
60
|
+
- test/test.rb
|
61
|
+
- test/test_helper.rb
|
62
|
+
- test/unit/test.rb
|
63
|
+
- test/unit/ut_0_initial.rb
|
64
|
+
has_rdoc: true
|
65
|
+
homepage: http://github.com/jmettraux/ruote-couch
|
66
|
+
licenses: []
|
67
|
+
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options:
|
70
|
+
- --charset=UTF-8
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: "0"
|
84
|
+
version:
|
85
|
+
requirements: []
|
86
|
+
|
87
|
+
rubyforge_project: ruote
|
88
|
+
rubygems_version: 1.3.5
|
89
|
+
signing_key:
|
90
|
+
specification_version: 3
|
91
|
+
summary: CouchDB storage for ruote 2.1
|
92
|
+
test_files:
|
93
|
+
- test/test.rb
|