ruote-couch 2.1.11 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +8 -0
- data/CREDITS.txt +6 -0
- data/LICENSE.txt +1 -1
- data/README.rdoc +2 -2
- data/Rakefile +48 -45
- data/lib/ruote/couch/database.rb +43 -78
- data/lib/ruote/couch/storage.rb +58 -34
- data/lib/ruote/couch/version.rb +2 -1
- data/ruote-couch.gemspec +23 -66
- data/test/functional_connection.rb +18 -3
- metadata +33 -52
data/CHANGELOG.txt
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
= ruote-couch - CHANGELOG.txt
|
3
3
|
|
4
4
|
|
5
|
+
== ruote-couch 2.2.0 released 2011/03/01
|
6
|
+
|
7
|
+
- Ruote::Couch::CouchStorage -> Ruote::Couch::Storage
|
8
|
+
- get_msgs : once per minute do a real get, to avoid losing msgs
|
9
|
+
- engine.process(wfid) : fixed issue with freshly deleted documents
|
10
|
+
(Thanks Claudio)
|
11
|
+
|
12
|
+
|
5
13
|
== ruote-couch 2.1.11 released 2010/10/01
|
6
14
|
|
7
15
|
- storage#shutdown back in business (for the sake of tests mostly)
|
data/CREDITS.txt
CHANGED
@@ -9,9 +9,15 @@
|
|
9
9
|
|
10
10
|
== contributors
|
11
11
|
|
12
|
+
- Sean Johnson - https://github.com/belucid
|
12
13
|
- Torsten Schoenebaum - http://github.com/tosch
|
13
14
|
|
14
15
|
|
16
|
+
== feedback
|
17
|
+
|
18
|
+
- Claudio Petasecca Donati - https://github.com/etapeta
|
19
|
+
|
20
|
+
|
15
21
|
== many thanks to
|
16
22
|
|
17
23
|
- the CouchDB team for their great project
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.rdoc
CHANGED
@@ -19,13 +19,13 @@ assuming you have
|
|
19
19
|
|
20
20
|
get into ruote/ and do
|
21
21
|
|
22
|
-
ruby test/unit/storage.rb --couch
|
22
|
+
ruby test/unit/storage.rb -- --couch
|
23
23
|
|
24
24
|
* functional tests :
|
25
25
|
|
26
26
|
get into ruote/ and do
|
27
27
|
|
28
|
-
ruby test/functional/test.rb --couch
|
28
|
+
ruby test/functional/test.rb -- --couch
|
29
29
|
|
30
30
|
|
31
31
|
== license
|
data/Rakefile
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
|
2
|
+
$:.unshift('.') # 1.9.2
|
3
|
+
|
2
4
|
require 'rubygems'
|
5
|
+
|
3
6
|
require 'rake'
|
7
|
+
require 'rake/clean'
|
8
|
+
require 'rake/rdoctask'
|
4
9
|
|
5
|
-
require 'lib/ruote/couch/version.rb'
|
6
10
|
|
7
11
|
#
|
8
|
-
#
|
12
|
+
# clean
|
13
|
+
|
14
|
+
CLEAN.include('pkg', 'rdoc')
|
9
15
|
|
10
|
-
require 'rake/clean'
|
11
|
-
CLEAN.include('pkg', 'tmp', 'html')
|
12
16
|
task :default => [ :clean ]
|
13
17
|
|
14
18
|
|
15
19
|
#
|
16
|
-
#
|
20
|
+
# test / spec
|
21
|
+
|
22
|
+
task :test do
|
23
|
+
|
24
|
+
puts
|
25
|
+
puts "to test ruote-couch, head to your ruote/ dir and run"
|
26
|
+
puts
|
27
|
+
puts " ruby test/test.rb -- --couch"
|
28
|
+
puts
|
29
|
+
puts "but first, make sure your ruote-couch/test/functional_connection.rb"
|
30
|
+
puts "is set correctly."
|
31
|
+
puts
|
32
|
+
end
|
17
33
|
|
18
|
-
|
34
|
+
task :default => [ :test ]
|
19
35
|
|
20
|
-
Jeweler::Tasks.new do |gem|
|
21
36
|
|
22
|
-
|
23
|
-
|
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'
|
37
|
+
#
|
38
|
+
# gem
|
32
39
|
|
33
|
-
|
40
|
+
GEMSPEC_FILE = Dir['*.gemspec'].first
|
41
|
+
GEMSPEC = eval(File.read(GEMSPEC_FILE))
|
42
|
+
GEMSPEC.validate
|
34
43
|
|
35
|
-
#gem.add_dependency 'ruote', ">= #{Ruote::Couch::VERSION}"
|
36
|
-
gem.add_dependency 'ruote', ">= 2.1.11"
|
37
|
-
gem.add_dependency 'rufus-jig', '>= 0.1.23'
|
38
|
-
gem.add_development_dependency 'yard'
|
39
|
-
gem.add_development_dependency 'rake'
|
40
|
-
gem.add_development_dependency 'jeweler'
|
41
44
|
|
42
|
-
|
45
|
+
desc %{
|
46
|
+
builds the gem and places it in pkg/
|
47
|
+
}
|
48
|
+
task :build do
|
49
|
+
|
50
|
+
sh "gem build #{GEMSPEC_FILE}"
|
51
|
+
sh "mkdir pkg" rescue nil
|
52
|
+
sh "mv #{GEMSPEC.name}-#{GEMSPEC.version}.gem pkg/"
|
43
53
|
end
|
44
|
-
Jeweler::GemcutterTasks.new
|
45
54
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
task :
|
50
|
-
|
51
|
-
|
52
|
-
require 'rufus/jig'
|
53
|
-
couch = Rufus::Jig::Couch.new('127.0.0.1', 5984)
|
54
|
-
%w[
|
55
|
-
configurations errors expressions msgs schedules variables workitems
|
56
|
-
].each do |type|
|
57
|
-
couch.delete("/test_ruote_#{type}")
|
58
|
-
end
|
55
|
+
desc %{
|
56
|
+
builds the gem and pushes it to rubygems.org
|
57
|
+
}
|
58
|
+
task :push => :build do
|
59
|
+
|
60
|
+
sh "gem push pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem"
|
59
61
|
end
|
60
62
|
|
61
63
|
|
62
64
|
#
|
63
|
-
#
|
64
|
-
|
65
|
+
# rdoc
|
65
66
|
#
|
66
67
|
# make sure to have rdoc 2.5.x to run that
|
67
|
-
|
68
|
-
require 'rake/rdoctask'
|
68
|
+
|
69
69
|
Rake::RDocTask.new do |rd|
|
70
70
|
|
71
71
|
rd.main = 'README.rdoc'
|
@@ -74,13 +74,16 @@ Rake::RDocTask.new do |rd|
|
|
74
74
|
rd.rdoc_files.include(
|
75
75
|
'README.rdoc', 'CHANGELOG.txt', 'CREDITS.txt', 'lib/**/*.rb')
|
76
76
|
|
77
|
-
rd.title = "
|
77
|
+
rd.title = "#{GEMSPEC.name} #{GEMSPEC.version}"
|
78
78
|
end
|
79
79
|
|
80
80
|
|
81
81
|
#
|
82
|
-
#
|
82
|
+
# upload_rdoc
|
83
83
|
|
84
|
+
desc %{
|
85
|
+
upload the rdoc to rubyforge
|
86
|
+
}
|
84
87
|
task :upload_rdoc => [ :clean, :rdoc ] do
|
85
88
|
|
86
89
|
account = 'jmettraux@rubyforge.org'
|
data/lib/ruote/couch/database.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -22,8 +22,6 @@
|
|
22
22
|
# Made in Japan.
|
23
23
|
#++
|
24
24
|
|
25
|
-
require 'cgi'
|
26
|
-
|
27
25
|
|
28
26
|
module Ruote::Couch
|
29
27
|
|
@@ -36,7 +34,6 @@ module Ruote::Couch
|
|
36
34
|
class Database
|
37
35
|
|
38
36
|
attr_reader :type
|
39
|
-
|
40
37
|
attr_reader :couch
|
41
38
|
|
42
39
|
def initialize (host, port, type, name, opts={})
|
@@ -84,11 +81,14 @@ module Ruote::Couch
|
|
84
81
|
#
|
85
82
|
def get_many (key, opts)
|
86
83
|
|
87
|
-
|
84
|
+
if key.nil? && opts.empty?
|
85
|
+
return @couch.all(:include_design_docs => false)
|
86
|
+
end
|
88
87
|
|
89
88
|
is = ids
|
90
89
|
|
91
90
|
return is.length if opts[:count]
|
91
|
+
return [] if is.empty?
|
92
92
|
|
93
93
|
is = is.reverse if opts[:descending]
|
94
94
|
|
@@ -102,22 +102,17 @@ module Ruote::Couch
|
|
102
102
|
|
103
103
|
is = is[skip, limit]
|
104
104
|
|
105
|
-
|
105
|
+
#return [] if is.empty?
|
106
|
+
# not necessary at this point, jig provides already this optimization.
|
106
107
|
|
107
|
-
|
108
|
-
# maybe _count come be of use here
|
109
|
-
# http://wiki.apache.org/couchdb/Built-In_Reduce_Functions
|
108
|
+
@couch.all(:keys => is)
|
110
109
|
end
|
111
110
|
|
112
111
|
# Returns a sorted list of the ids of all the docs in this database.
|
113
112
|
#
|
114
113
|
def ids
|
115
114
|
|
116
|
-
@couch.
|
117
|
-
r['id']
|
118
|
-
}.reject { |i|
|
119
|
-
DESIGN_DOC_REGEX.match(i)
|
120
|
-
}
|
115
|
+
@couch.ids(:include_design_docs => false)
|
121
116
|
end
|
122
117
|
|
123
118
|
def dump
|
@@ -143,12 +138,14 @@ module Ruote::Couch
|
|
143
138
|
#
|
144
139
|
def purge!
|
145
140
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
end
|
141
|
+
#@couch.http.cache.clear
|
142
|
+
#@couch.all(
|
143
|
+
# :include_docs => false, :include_design_docs => false
|
144
|
+
#).each do |doc|
|
145
|
+
# @couch.delete(doc)
|
146
|
+
#end
|
147
|
+
docs = @couch.all(:include_docs => false, :include_design_docs => false)
|
148
|
+
@couch.bulk_delete(docs)
|
152
149
|
#
|
153
150
|
# which is faster than
|
154
151
|
#
|
@@ -159,50 +156,9 @@ module Ruote::Couch
|
|
159
156
|
|
160
157
|
protected
|
161
158
|
|
162
|
-
|
163
|
-
|
164
|
-
# nothing to do for a index-less database
|
165
|
-
end
|
166
|
-
|
167
|
-
# These options are known and passed to CouchDB.
|
168
|
-
#
|
169
|
-
QUERY_OPTIONS = [ :skip, :limit, :descending ]
|
170
|
-
|
171
|
-
# :limit and :skip support
|
159
|
+
# Well, empty. Nothing to do for a index-less database
|
172
160
|
#
|
173
|
-
def
|
174
|
-
|
175
|
-
opts = opts.select { |k, v| QUERY_OPTIONS.include?(k) && v != nil }
|
176
|
-
|
177
|
-
s = opts.collect { |k, v| "#{k}=#{v}" }.join('&')
|
178
|
-
|
179
|
-
s.length > 0 ? "&#{s}" : ''
|
180
|
-
end
|
181
|
-
|
182
|
-
# Used by #get_many and #ids when filtering design documents out of
|
183
|
-
# '_all_docs'.
|
184
|
-
#
|
185
|
-
DESIGN_DOC_REGEX = /^\_design\//
|
186
|
-
|
187
|
-
def filter_design_docs (docs)
|
188
|
-
|
189
|
-
docs.reject { |d| DESIGN_DOC_REGEX.match(d['_id']) }
|
190
|
-
end
|
191
|
-
|
192
|
-
def query (uri)
|
193
|
-
|
194
|
-
rs = @couch.get(uri)
|
195
|
-
|
196
|
-
filter_design_docs(rs['rows'].collect { |e| e['doc'] })
|
197
|
-
end
|
198
|
-
|
199
|
-
def query_by_post (uri, keys)
|
200
|
-
|
201
|
-
keys = { 'keys' => keys }
|
202
|
-
|
203
|
-
rs = @couch.post(uri, keys)
|
204
|
-
|
205
|
-
filter_design_docs(rs['rows'].collect { |e| e['doc'] }.uniq)
|
161
|
+
def prepare
|
206
162
|
end
|
207
163
|
end
|
208
164
|
|
@@ -219,14 +175,13 @@ module Ruote::Couch
|
|
219
175
|
|
220
176
|
# key is a wfid
|
221
177
|
|
222
|
-
|
178
|
+
@couch.query_for_docs('ruote:by_wfid', :key => key)
|
223
179
|
end
|
224
180
|
|
225
181
|
# Used by WorkitemDatabase#query
|
226
182
|
#
|
227
183
|
def by_wfid (wfid)
|
228
184
|
|
229
|
-
#get_many(/!#{wfid}$/, {})
|
230
185
|
get_many(wfid, {})
|
231
186
|
end
|
232
187
|
|
@@ -267,6 +222,21 @@ module Ruote::Couch
|
|
267
222
|
|
268
223
|
@couch.put(design_doc)
|
269
224
|
end
|
225
|
+
|
226
|
+
#--
|
227
|
+
#def try (&block)
|
228
|
+
# try = 0
|
229
|
+
# begin
|
230
|
+
# try = try + 1
|
231
|
+
# block.call
|
232
|
+
# rescue Rufus::Jig::HttpError => he
|
233
|
+
# raise he
|
234
|
+
# rescue
|
235
|
+
# retry unless try > 1
|
236
|
+
# end
|
237
|
+
#end
|
238
|
+
# keeping it frozen for now
|
239
|
+
#++
|
270
240
|
end
|
271
241
|
|
272
242
|
#
|
@@ -274,28 +244,25 @@ module Ruote::Couch
|
|
274
244
|
#
|
275
245
|
class WorkitemDatabase < WfidIndexedDatabase
|
276
246
|
|
277
|
-
# This method is called by
|
247
|
+
# This method is called by Storage#by_field
|
278
248
|
#
|
279
249
|
def by_field (field, value=nil, opts={})
|
280
250
|
|
281
251
|
field = { field => value } if value
|
282
|
-
field = CGI.escape(Rufus::Json.encode(field))
|
283
252
|
|
284
|
-
|
285
|
-
|
286
|
-
"&include_docs=true#{query_options(opts)}")
|
253
|
+
@couch.query_for_docs(
|
254
|
+
'ruote:by_field', opts.merge(:key => field))
|
287
255
|
end
|
288
256
|
|
289
|
-
# This method is called by
|
257
|
+
# This method is called by Storage#by_participant
|
290
258
|
#
|
291
259
|
def by_participant (name, opts={})
|
292
260
|
|
293
|
-
|
294
|
-
|
295
|
-
"&include_docs=true#{query_options(opts)}")
|
261
|
+
@couch.query_for_docs(
|
262
|
+
'ruote:by_participant_name', opts.merge(:key => name))
|
296
263
|
end
|
297
264
|
|
298
|
-
# This method is called by
|
265
|
+
# This method is called by Storage#query
|
299
266
|
#
|
300
267
|
def query_workitems (criteria)
|
301
268
|
|
@@ -318,9 +285,7 @@ module Ruote::Couch
|
|
318
285
|
|
319
286
|
opts = { :skip => offset, :limit => limit }
|
320
287
|
|
321
|
-
hwis =
|
322
|
-
"_design/ruote/_view/by_field?include_docs=true#{query_options(opts)}",
|
323
|
-
cr)
|
288
|
+
hwis = @couch.query_for_docs('ruote:by_field', opts.merge(:keys => cr))
|
324
289
|
|
325
290
|
hwis = hwis.select { |hwi| hwi['fei']['wfid'] == wfid } if wfid
|
326
291
|
|
data/lib/ruote/couch/storage.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2005-
|
2
|
+
# Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -38,7 +38,7 @@ module Couch
|
|
38
38
|
# The storage merely 'routes' work to Ruote::Couch::Database instances,
|
39
39
|
# one per document 'type' (expressions, msgs, schedules, variables, ...)
|
40
40
|
#
|
41
|
-
class
|
41
|
+
class Storage
|
42
42
|
|
43
43
|
include Ruote::StorageBase
|
44
44
|
|
@@ -82,12 +82,14 @@ module Couch
|
|
82
82
|
|
83
83
|
put_configuration
|
84
84
|
|
85
|
-
@
|
85
|
+
@poll_threads = {}
|
86
|
+
|
86
87
|
@msgs_queue = ::Queue.new
|
88
|
+
@msgs_last_min = nil
|
87
89
|
|
88
|
-
@schedules_thread = nil
|
89
90
|
@schedules_queue = ::Queue.new
|
90
|
-
@schedules =
|
91
|
+
@schedules = {}
|
92
|
+
@schedules_last_min = nil
|
91
93
|
end
|
92
94
|
|
93
95
|
def put (doc, opts={})
|
@@ -133,9 +135,7 @@ module Couch
|
|
133
135
|
def shutdown
|
134
136
|
|
135
137
|
@dbs.values.each { |db| db.shutdown }
|
136
|
-
|
137
|
-
@msgs_thread.kill rescue nil
|
138
|
-
@schedules_thread.kill rescue nil
|
138
|
+
@poll_threads.values.each { |t| t.kill rescue nil }
|
139
139
|
end
|
140
140
|
|
141
141
|
# Mainly used by ruote's test/unit/ut_17_storage.rb
|
@@ -189,19 +189,34 @@ module Couch
|
|
189
189
|
#
|
190
190
|
def get_msgs
|
191
191
|
|
192
|
-
mt = @
|
192
|
+
mt = @poll_threads['msgs']
|
193
193
|
|
194
194
|
ensure_msgs_thread_is_running
|
195
195
|
|
196
196
|
msgs = []
|
197
|
-
2.times {
|
197
|
+
2.times {
|
198
|
+
(msgs = get_many('msgs')) rescue nil
|
199
|
+
} if mt != @poll_threads['msgs']
|
198
200
|
#
|
199
201
|
# seems necessary to avoid any msgs leak :-(
|
202
|
+
#
|
203
|
+
# added the "rescue nil", to rescue timeout exceptions
|
200
204
|
|
201
205
|
while @msgs_queue.size > 0
|
202
206
|
msgs << @msgs_queue.pop
|
203
207
|
end
|
204
208
|
|
209
|
+
if msgs.empty? && Time.now.min != @msgs_last_min
|
210
|
+
#
|
211
|
+
# once per minute, do a regular get, to avoid lost msgs
|
212
|
+
#
|
213
|
+
begin
|
214
|
+
msgs = get_many('msgs')
|
215
|
+
@msgs_last_min = Time.now.min
|
216
|
+
rescue Rufus::Jig::TimeoutError => te
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
205
220
|
msgs
|
206
221
|
end
|
207
222
|
|
@@ -209,16 +224,6 @@ module Couch
|
|
209
224
|
|
210
225
|
ensure_schedules_thread_is_running
|
211
226
|
|
212
|
-
if @schedules.nil?
|
213
|
-
|
214
|
-
# NOTE : the problem with this approach is that ALL the schedules
|
215
|
-
# are stored in memory. Most of the time it's not a problem, but
|
216
|
-
# for people will lots of schedules...
|
217
|
-
|
218
|
-
@schedules = get_many('schedules')
|
219
|
-
@schedules = @schedules.inject({}) { |h, s| h[s['_id']] = s; h }
|
220
|
-
end
|
221
|
-
|
222
227
|
while @schedules_queue.size > 0
|
223
228
|
|
224
229
|
deleted, s = @schedules_queue.pop
|
@@ -232,6 +237,15 @@ module Couch
|
|
232
237
|
end
|
233
238
|
end
|
234
239
|
|
240
|
+
if Time.now.min != @schedules_last_min
|
241
|
+
#
|
242
|
+
# once per minute, do a regular get, to avoid lost schedules
|
243
|
+
#
|
244
|
+
@schedules = get_many('schedules')
|
245
|
+
@schedules = @schedules.inject({}) { |h, s| h[s['_id']] = s; h }
|
246
|
+
@schedules_last_min = Time.now.min
|
247
|
+
end
|
248
|
+
|
235
249
|
filter_schedules(@schedules.values.reject { |sch| sch['at'].nil? }, now)
|
236
250
|
end
|
237
251
|
|
@@ -246,30 +260,40 @@ module Couch
|
|
246
260
|
put(conf)
|
247
261
|
end
|
248
262
|
|
249
|
-
def
|
263
|
+
def ensure_poll_thread_is_running (doctype, &block)
|
250
264
|
|
251
|
-
|
252
|
-
|
265
|
+
if t = @poll_threads[doctype]
|
266
|
+
return if t.status == 'run' || t.status == 'sleep' # thread is OK
|
267
|
+
end
|
253
268
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
269
|
+
# create or revive thread....
|
270
|
+
|
271
|
+
@poll_threads[doctype] = Thread.new do
|
272
|
+
|
273
|
+
@dbs[doctype].couch.on_change(&block) rescue nil
|
258
274
|
end
|
259
275
|
end
|
260
276
|
|
261
|
-
def
|
277
|
+
def ensure_msgs_thread_is_running
|
262
278
|
|
263
|
-
|
264
|
-
|
279
|
+
ensure_poll_thread_is_running 'msgs' do |_, deleted, doc|
|
280
|
+
@msgs_queue << doc unless deleted
|
281
|
+
end
|
282
|
+
end
|
265
283
|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
284
|
+
def ensure_schedules_thread_is_running
|
285
|
+
|
286
|
+
ensure_poll_thread_is_running 'schedules' do |_, deleted, doc|
|
287
|
+
@schedules_queue << [ deleted, doc ]
|
270
288
|
end
|
271
289
|
end
|
272
290
|
end
|
291
|
+
|
292
|
+
#
|
293
|
+
# Kept for backward compatibility.
|
294
|
+
#
|
295
|
+
class CouchStorage < Storage
|
296
|
+
end
|
273
297
|
end
|
274
298
|
end
|
275
299
|
|
data/lib/ruote/couch/version.rb
CHANGED
data/ruote-couch.gemspec
CHANGED
@@ -1,74 +1,31 @@
|
|
1
|
-
#
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
1
|
+
# encoding: utf-8
|
5
2
|
|
6
3
|
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{ruote-couch}
|
8
|
-
s.version = "2.1.11"
|
9
4
|
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
s.email =
|
15
|
-
s.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"lib/ruote/couch.rb",
|
28
|
-
"lib/ruote/couch/database.rb",
|
29
|
-
"lib/ruote/couch/storage.rb",
|
30
|
-
"lib/ruote/couch/version.rb",
|
31
|
-
"ruote-couch.gemspec",
|
32
|
-
"test/functional/base.rb",
|
33
|
-
"test/functional/test.rb",
|
34
|
-
"test/functional_connection.rb",
|
35
|
-
"test/test.rb",
|
36
|
-
"test/unit/test.rb",
|
37
|
-
"test/unit/ut_0_design_doc.rb"
|
38
|
-
]
|
39
|
-
s.homepage = %q{http://github.com/jmettraux/ruote-couch}
|
40
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
41
|
-
s.require_paths = ["lib"]
|
42
|
-
s.rubyforge_project = %q{ruote}
|
43
|
-
s.rubygems_version = %q{1.3.6}
|
44
|
-
s.summary = %q{CouchDB storage for ruote 2.1}
|
45
|
-
s.test_files = [
|
46
|
-
"test/test.rb"
|
5
|
+
s.name = 'ruote-couch'
|
6
|
+
s.version = File.read('lib/ruote/couch/version.rb').match(/VERSION = '([^']+)'/)[1]
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = [ 'John Mettraux' ]
|
9
|
+
s.email = [ 'jmettraux@gmail.com' ]
|
10
|
+
s.homepage = 'http://github.com/jmettraux/ruote-couch'
|
11
|
+
s.rubyforge_project = 'ruote'
|
12
|
+
s.summary = 'CouchDB storage for ruote 2.1'
|
13
|
+
s.description = %{
|
14
|
+
CouchDB storage for ruote 2.1 (ruby workflow engine)
|
15
|
+
}.strip
|
16
|
+
|
17
|
+
#s.files = `git ls-files`.split("\n")
|
18
|
+
s.files = Dir[
|
19
|
+
'Rakefile',
|
20
|
+
'lib/**/*.rb', 'spec/**/*.rb', 'test/**/*.rb',
|
21
|
+
'*.gemspec', '*.txt', '*.rdoc', '*.md'
|
47
22
|
]
|
48
23
|
|
49
|
-
|
50
|
-
|
51
|
-
|
24
|
+
s.add_dependency 'ruote', ">= #{s.version}"
|
25
|
+
s.add_dependency 'rufus-jig', '>= 1.0.0'
|
26
|
+
|
27
|
+
s.add_development_dependency 'rake'
|
52
28
|
|
53
|
-
|
54
|
-
s.add_runtime_dependency(%q<ruote>, [">= 2.1.11"])
|
55
|
-
s.add_runtime_dependency(%q<rufus-jig>, [">= 0.1.23"])
|
56
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
57
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
58
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
59
|
-
else
|
60
|
-
s.add_dependency(%q<ruote>, [">= 2.1.11"])
|
61
|
-
s.add_dependency(%q<rufus-jig>, [">= 0.1.23"])
|
62
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
63
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
64
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
65
|
-
end
|
66
|
-
else
|
67
|
-
s.add_dependency(%q<ruote>, [">= 2.1.11"])
|
68
|
-
s.add_dependency(%q<rufus-jig>, [">= 0.1.23"])
|
69
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
70
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
71
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
72
|
-
end
|
29
|
+
s.require_path = 'lib'
|
73
30
|
end
|
74
31
|
|
@@ -41,8 +41,20 @@ unless $_RUOTE_COUCH_CLEANED
|
|
41
41
|
%w[
|
42
42
|
configurations errors expressions msgs schedules variables workitems
|
43
43
|
].each do |type|
|
44
|
-
|
44
|
+
|
45
|
+
count = 0
|
46
|
+
|
47
|
+
begin
|
48
|
+
|
49
|
+
count = count + 1
|
50
|
+
couch.delete("/test_ruote_#{type}")
|
51
|
+
|
52
|
+
rescue Rufus::Jig::TimeoutError => te
|
53
|
+
retry unless count > 1
|
54
|
+
raise te
|
55
|
+
end
|
45
56
|
end
|
57
|
+
|
46
58
|
puts "(purged all /test_ruote_xxx databases)"
|
47
59
|
$_RUOTE_COUCH_CLEANED = true
|
48
60
|
end
|
@@ -52,8 +64,11 @@ def new_storage (opts)
|
|
52
64
|
|
53
65
|
opts ||= {}
|
54
66
|
|
55
|
-
Ruote::Couch::
|
67
|
+
#Ruote::Couch::Storage.new(
|
68
|
+
# _couch_url,
|
69
|
+
# opts.merge!('couch_prefix' => 'test', :basic_auth => %w[ admin admin ]))
|
70
|
+
Ruote::Couch::Storage.new(
|
56
71
|
_couch_url,
|
57
|
-
opts.merge!('couch_prefix' => 'test'
|
72
|
+
opts.merge!('couch_prefix' => 'test'))
|
58
73
|
end
|
59
74
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 2
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 2.
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 2.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Mettraux
|
@@ -14,41 +14,44 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-03-01 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: ruote
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
26
27
|
- !ruby/object:Gem::Version
|
27
28
|
segments:
|
28
29
|
- 2
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 2.
|
30
|
+
- 2
|
31
|
+
- 0
|
32
|
+
version: 2.2.0
|
32
33
|
type: :runtime
|
33
34
|
version_requirements: *id001
|
34
35
|
- !ruby/object:Gem::Dependency
|
35
36
|
name: rufus-jig
|
36
37
|
prerelease: false
|
37
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
38
40
|
requirements:
|
39
41
|
- - ">="
|
40
42
|
- !ruby/object:Gem::Version
|
41
43
|
segments:
|
42
|
-
- 0
|
43
44
|
- 1
|
44
|
-
-
|
45
|
-
|
45
|
+
- 0
|
46
|
+
- 0
|
47
|
+
version: 1.0.0
|
46
48
|
type: :runtime
|
47
49
|
version_requirements: *id002
|
48
50
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
51
|
+
name: rake
|
50
52
|
prerelease: false
|
51
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
52
55
|
requirements:
|
53
56
|
- - ">="
|
54
57
|
- !ruby/object:Gem::Version
|
@@ -57,68 +60,45 @@ dependencies:
|
|
57
60
|
version: "0"
|
58
61
|
type: :development
|
59
62
|
version_requirements: *id003
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: rake
|
62
|
-
prerelease: false
|
63
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
segments:
|
68
|
-
- 0
|
69
|
-
version: "0"
|
70
|
-
type: :development
|
71
|
-
version_requirements: *id004
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
name: jeweler
|
74
|
-
prerelease: false
|
75
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - ">="
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
segments:
|
80
|
-
- 0
|
81
|
-
version: "0"
|
82
|
-
type: :development
|
83
|
-
version_requirements: *id005
|
84
63
|
description: CouchDB storage for ruote 2.1 (ruby workflow engine)
|
85
|
-
email:
|
64
|
+
email:
|
65
|
+
- jmettraux@gmail.com
|
86
66
|
executables: []
|
87
67
|
|
88
68
|
extensions: []
|
89
69
|
|
90
|
-
extra_rdoc_files:
|
91
|
-
|
92
|
-
- README.rdoc
|
70
|
+
extra_rdoc_files: []
|
71
|
+
|
93
72
|
files:
|
94
|
-
- CHANGELOG.txt
|
95
|
-
- CREDITS.txt
|
96
|
-
- LICENSE.txt
|
97
|
-
- README.rdoc
|
98
73
|
- Rakefile
|
99
|
-
- TODO.txt
|
100
|
-
- lib/ruote-couch.rb
|
101
|
-
- lib/ruote/couch.rb
|
102
74
|
- lib/ruote/couch/database.rb
|
103
75
|
- lib/ruote/couch/storage.rb
|
104
76
|
- lib/ruote/couch/version.rb
|
105
|
-
- ruote
|
77
|
+
- lib/ruote/couch.rb
|
78
|
+
- lib/ruote-couch.rb
|
106
79
|
- test/functional/base.rb
|
107
80
|
- test/functional/test.rb
|
108
81
|
- test/functional_connection.rb
|
109
82
|
- test/test.rb
|
110
83
|
- test/unit/test.rb
|
111
84
|
- test/unit/ut_0_design_doc.rb
|
85
|
+
- ruote-couch.gemspec
|
86
|
+
- CHANGELOG.txt
|
87
|
+
- CREDITS.txt
|
88
|
+
- LICENSE.txt
|
89
|
+
- TODO.txt
|
90
|
+
- README.rdoc
|
112
91
|
has_rdoc: true
|
113
92
|
homepage: http://github.com/jmettraux/ruote-couch
|
114
93
|
licenses: []
|
115
94
|
|
116
95
|
post_install_message:
|
117
|
-
rdoc_options:
|
118
|
-
|
96
|
+
rdoc_options: []
|
97
|
+
|
119
98
|
require_paths:
|
120
99
|
- lib
|
121
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
122
102
|
requirements:
|
123
103
|
- - ">="
|
124
104
|
- !ruby/object:Gem::Version
|
@@ -126,6 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
106
|
- 0
|
127
107
|
version: "0"
|
128
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
129
110
|
requirements:
|
130
111
|
- - ">="
|
131
112
|
- !ruby/object:Gem::Version
|
@@ -135,9 +116,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
116
|
requirements: []
|
136
117
|
|
137
118
|
rubyforge_project: ruote
|
138
|
-
rubygems_version: 1.3.
|
119
|
+
rubygems_version: 1.3.7
|
139
120
|
signing_key:
|
140
121
|
specification_version: 3
|
141
122
|
summary: CouchDB storage for ruote 2.1
|
142
|
-
test_files:
|
143
|
-
|
123
|
+
test_files: []
|
124
|
+
|