ruote-sequel 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -2,6 +2,16 @@
2
2
  = ruote-sequel - CHANGELOG.txt
3
3
 
4
4
 
5
+ == ruote-sequel 2.3.0 released 2012/09/01
6
+
7
+ - switched to "begin_step" model
8
+ - StorageParticipant#by_participant :skip :limit fix (Thanks Jan Topiński)
9
+ - #delete : doc count > 1 is OK
10
+ - StorageParticipant :count => true made consistent (Thanks Jan Topiński)
11
+ - query_workitems didn't recognize :skip option (Thanks Eric Smith)
12
+ - 'table_name' option for specifying something other than 'documents'
13
+
14
+
5
15
  == ruote-sequel 2.2.0 released 2011/03/01
6
16
 
7
17
  - initial release
data/CREDITS.txt CHANGED
@@ -1,15 +1,24 @@
1
1
 
2
2
  = ruote-sequel CREDITS.txt
3
3
 
4
+
4
5
  == authors
5
6
 
6
- - John Mettraux - http://github.com/jmettraux
7
+ - John Mettraux - https://github.com/jmettraux
7
8
 
8
9
 
9
10
  == contributors
10
11
 
12
+ - Wesley Moore - https://github.com/wezm
13
+
14
+
15
+ == feedback
16
+
17
+ - Chad Albers - https://github.com/neomantic
18
+ - Eric Smith - issue reporting
19
+
11
20
 
12
21
  == many thanks to
13
22
 
14
- - Jeremy Evans and all the Sequel community
23
+ - Jeremy Evans and the Sequel community
15
24
 
data/LICENSE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
2
+ Copyright (c) 2005-2012, 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/TODO.txt CHANGED
@@ -1,3 +1,5 @@
1
1
 
2
- [ ] nothing for now
2
+ [o] implement #reserve (simpler delete?)
3
+ that will prevent the SELECT in case of delete count < 1
4
+ [ ] lots of select('configurations', 'engine') when starting, investigate
3
5
 
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
2
+ # Copyright (c) 2005-2012, 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
@@ -33,20 +33,29 @@ module Sequel
33
33
  # Creates the 'documents' table necessary for this storage.
34
34
  #
35
35
  # If re_create is set to true, it will destroy any previous 'documents'
36
- # table and create it.
36
+ # table and create it. If false (default) then the table will be created
37
+ # if it doesn't already exist.
37
38
  #
38
- def self.create_table(sequel, re_create=false)
39
+ # It's also possible to change the default table_name from 'documents' to
40
+ # something else with the optional third parameter
41
+ #
42
+ def self.create_table(sequel, re_create=false, table_name='documents')
43
+
44
+ m = re_create ? :create_table! : :create_table?
39
45
 
40
- m = re_create ? :create_table! : :create_table
46
+ sequel.send(m, table_name.to_sym) do
41
47
 
42
- sequel.send(m, :documents) do
43
48
  String :ide, :size => 255, :null => false
44
49
  Integer :rev, :null => false
45
50
  String :typ, :size => 55, :null => false
46
51
  String :doc, :text => true, :null => false
47
- String :wfid, :size => 255, :index => true
52
+ String :wfid, :size => 255
48
53
  String :participant_name, :size => 512
49
- primary_key [ :ide, :rev, :typ ]
54
+
55
+ primary_key [ :typ, :ide, :rev ]
56
+
57
+ index :wfid
58
+ #index [ :typ, :wfid ]
50
59
  end
51
60
  end
52
61
 
@@ -80,9 +89,10 @@ module Sequel
80
89
  def initialize(sequel, options={})
81
90
 
82
91
  @sequel = sequel
83
- @options = options
92
+ #@options = options
93
+ @table = (options['sequel_table_name'] || :documents).to_sym
84
94
 
85
- put_configuration
95
+ replace_engine_configuration(options)
86
96
  end
87
97
 
88
98
  def put_msg(action, options)
@@ -94,6 +104,17 @@ module Sequel
94
104
  nil
95
105
  end
96
106
 
107
+ # Used to reserve 'msgs' and 'schedules'. Simply deletes the document,
108
+ # return true if the delete was successful (ie if the reservation is
109
+ # valid).
110
+ #
111
+ def reserve(doc)
112
+
113
+ @sequel[@table].where(
114
+ :typ => doc['type'], :ide => doc['_id'], :rev => 1
115
+ ).delete > 0
116
+ end
117
+
97
118
  def put_schedule(flavour, owner_fei, s, msg)
98
119
 
99
120
  # put_schedule is a unique action, no need for all the complexity of put
@@ -109,6 +130,8 @@ module Sequel
109
130
 
110
131
  def put(doc, opts={})
111
132
 
133
+ cache_clear(doc)
134
+
112
135
  if doc['_rev']
113
136
 
114
137
  d = get(doc['type'], doc['_id'])
@@ -122,7 +145,7 @@ module Sequel
122
145
 
123
146
  begin
124
147
 
125
- do_insert(doc, nrev)
148
+ do_insert(doc, nrev, opts[:update_rev])
126
149
 
127
150
  rescue ::Sequel::DatabaseError => de
128
151
 
@@ -130,30 +153,31 @@ module Sequel
130
153
  # failure
131
154
  end
132
155
 
133
- @sequel[:documents].where(
156
+ @sequel[@table].where(
134
157
  :typ => doc['type'], :ide => doc['_id']
135
158
  ).filter { rev < nrev }.delete
136
159
 
137
- doc['_rev'] = nrev if opts[:update_rev]
138
-
139
160
  nil
140
161
  # success
141
162
  end
142
163
 
143
164
  def get(type, key)
144
165
 
145
- d = do_get(type, key)
146
-
147
- d ? Rufus::Json.decode(d[:doc]) : nil
166
+ cache_get(type, key) || do_get(type, key)
148
167
  end
149
168
 
150
169
  def delete(doc)
151
170
 
152
171
  raise ArgumentError.new('no _rev for doc') unless doc['_rev']
153
172
 
154
- count = do_delete(doc)
173
+ cache_clear(doc)
174
+ # usually not necessary, adding it not to forget it later on
175
+
176
+ count = @sequel[@table].where(
177
+ :typ => doc['type'], :ide => doc['_id'], :rev => doc['_rev'].to_i
178
+ ).delete
155
179
 
156
- return (get(doc['type'], doc['_id']) || true) if count != 1
180
+ return (get(doc['type'], doc['_id']) || true) if count < 1
157
181
  # failure
158
182
 
159
183
  nil
@@ -162,26 +186,30 @@ module Sequel
162
186
 
163
187
  def get_many(type, key=nil, opts={})
164
188
 
165
- ds = @sequel[:documents].where(:typ => type)
189
+ cached = cache_get_many(type, key, opts)
190
+ return cached if cached
191
+
192
+ ds = @sequel[@table].where(:typ => type)
166
193
 
167
194
  keys = key ? Array(key) : nil
168
195
  ds = ds.filter(:wfid => keys) if keys && keys.first.is_a?(String)
169
196
 
170
- return ds.all.size if opts[:count]
197
+ return ds.count if opts[:count]
171
198
 
172
199
  ds = ds.order(
173
- *(opts[:descending] ? [ :ide.desc, :rev.desc ] : [ :ide.asc, :rev.asc ])
200
+ opts[:descending] ? :ide.desc : :ide.asc, :rev.desc
201
+ ).limit(
202
+ opts[:limit], opts[:skip] || opts[:offset]
174
203
  )
175
204
 
176
- ds = ds.limit(opts[:limit], opts[:skip])
177
-
178
- docs = ds.all
179
- docs = select_last_revs(docs, opts[:descending])
205
+ docs = select_last_revs(ds)
180
206
  docs = docs.collect { |d| Rufus::Json.decode(d[:doc]) }
181
207
 
182
- keys && keys.first.is_a?(Regexp) ?
183
- docs.select { |doc| keys.find { |key| key.match(doc['_id']) } } :
208
+ if keys && keys.first.is_a?(Regexp)
209
+ docs.select { |doc| keys.find { |key| key.match(doc['_id']) } }
210
+ else
184
211
  docs
212
+ end
185
213
 
186
214
  # (pass on the dataset.filter(:wfid => /regexp/) for now
187
215
  # since we have potentially multiple keys)
@@ -191,23 +219,14 @@ module Sequel
191
219
  #
192
220
  def ids(type)
193
221
 
194
- @sequel[:documents].where(:typ => type).collect { |d| d[:ide] }.uniq.sort
222
+ @sequel[@table].where(:typ => type).collect { |d| d[:ide] }.uniq.sort
195
223
  end
196
224
 
197
225
  # Nukes all the documents in this storage.
198
226
  #
199
227
  def purge!
200
228
 
201
- @sequel[:documents].delete
202
- end
203
-
204
- # Returns a string representation the current content of the storage for
205
- # a given type.
206
- #
207
- def dump(type)
208
-
209
- "=== #{type} ===\n" +
210
- get_many(type).map { |h| " #{h['_id']} => #{h.inspect}" }.join("\n")
229
+ @sequel[@table].delete
211
230
  end
212
231
 
213
232
  # Calls #disconnect on the db. According to Sequel's doc, it closes
@@ -237,25 +256,34 @@ module Sequel
237
256
  #
238
257
  def purge_type!(type)
239
258
 
240
- @sequel[:documents].where(:typ => type).delete
259
+ @sequel[@table].where(:typ => type).delete
241
260
  end
242
261
 
243
262
  # A provision made for workitems, allow to query them directly by
244
263
  # participant name.
245
264
  #
246
- def by_participant(type, participant_name, opts)
265
+ def by_participant(type, participant_name, opts={})
247
266
 
248
267
  raise NotImplementedError if type != 'workitems'
249
268
 
250
- docs = @sequel[:documents].where(
251
- :typ => type, :participant_name => participant_name)
269
+ docs = @sequel[@table].where(
270
+ :typ => type, :participant_name => participant_name
271
+ )
272
+
273
+ return docs.count if opts[:count]
274
+
275
+ docs = docs.order(
276
+ :ide.asc, :rev.desc
277
+ ).limit(
278
+ opts[:limit], opts[:offset] || opts[:skip]
279
+ )
252
280
 
253
- select_last_revs(docs).collect { |d| Rufus::Json.decode(d[:doc]) }
281
+ select_last_revs(docs).collect { |d| Ruote::Workitem.from_json(d[:doc]) }
254
282
  end
255
283
 
256
284
  # Querying workitems by field (warning, goes deep into the JSON structure)
257
285
  #
258
- def by_field(type, field, value=nil)
286
+ def by_field(type, field, value, opts={})
259
287
 
260
288
  raise NotImplementedError if type != 'workitems'
261
289
 
@@ -263,21 +291,31 @@ module Sequel
263
291
  lk.push(Rufus::Json.encode(value)) if value
264
292
  lk.push('%')
265
293
 
266
- docs = @sequel[:documents].where(:typ => type).filter(:doc.like(lk.join))
294
+ docs = @sequel[@table].where(
295
+ :typ => type
296
+ ).filter(
297
+ :doc.like(lk.join)
298
+ )
299
+
300
+ return docs.count if opts[:count]
301
+
302
+ docs = docs.order(
303
+ :ide.asc, :rev.desc
304
+ ).limit(
305
+ opts[:limit], opts[:offset] || opts[:skip]
306
+ )
267
307
 
268
- select_last_revs(docs).collect { |d| Rufus::Json.decode(d[:doc]) }
308
+ select_last_revs(docs).collect { |d| Ruote::Workitem.from_json(d[:doc]) }
269
309
  end
270
310
 
271
311
  def query_workitems(criteria)
272
312
 
273
- ds = @sequel[:documents].where(:typ => 'workitems')
313
+ ds = @sequel[@table].where(:typ => 'workitems')
274
314
 
275
- return select_last_revs(ds.all).size if criteria['count']
315
+ count = criteria.delete('count')
276
316
 
277
317
  limit = criteria.delete('limit')
278
- offset = criteria.delete('offset')
279
-
280
- ds = ds.limit(limit, offset)
318
+ offset = criteria.delete('offset') || criteria.delete('skip')
281
319
 
282
320
  wfid =
283
321
  criteria.delete('wfid')
@@ -291,29 +329,35 @@ module Sequel
291
329
  ds = ds.filter(:doc.like("%\"#{k}\":#{Rufus::Json.encode(v)}%"))
292
330
  end
293
331
 
294
- select_last_revs(ds.all).collect { |d|
295
- Ruote::Workitem.new(Rufus::Json.decode(d[:doc]))
296
- }
297
- end
332
+ return ds.count if count
298
333
 
299
- protected
334
+ ds = ds.order(:ide.asc, :rev.desc).limit(limit, offset)
300
335
 
301
- def do_delete(doc)
336
+ select_last_revs(ds).collect { |d| Ruote::Workitem.from_json(d[:doc]) }
337
+ end
302
338
 
303
- @sequel[:documents].where(
304
- :ide => doc['_id'], :typ => doc['type'], :rev => doc['_rev'].to_i
305
- ).delete
339
+ # Used by the worker to indicate a new step begins. For ruote-sequel,
340
+ # it means the cache can be prepared (a unique select yielding
341
+ # all the info necessary for one worker step (expressions excluded)).
342
+ #
343
+ def begin_step
344
+
345
+ prepare_cache
306
346
  end
307
347
 
308
- def do_insert(doc, rev)
348
+ protected
309
349
 
310
- @sequel[:documents].insert(
350
+ def do_insert(doc, rev, update_rev=false)
351
+
352
+ doc = doc.send(
353
+ update_rev ? :merge! : :merge,
354
+ { '_rev' => rev, 'put_at' => Ruote.now_to_utc_s })
355
+
356
+ @sequel[@table].insert(
311
357
  :ide => doc['_id'],
312
358
  :rev => rev,
313
359
  :typ => doc['type'],
314
- :doc => Rufus::Json.encode(doc.merge(
315
- '_rev' => rev,
316
- 'put_at' => Ruote.now_to_utc_s)),
360
+ :doc => Rufus::Json.encode(doc),
317
361
  :wfid => extract_wfid(doc),
318
362
  :participant_name => doc['participant_name']
319
363
  )
@@ -326,33 +370,91 @@ module Sequel
326
370
 
327
371
  def do_get(type, key)
328
372
 
329
- @sequel[:documents].where(
373
+ d = @sequel[@table].select(:doc).where(
330
374
  :typ => type, :ide => key
331
375
  ).reverse_order(:rev).first
376
+
377
+ d ? Rufus::Json.decode(d[:doc]) : nil
332
378
  end
333
379
 
334
- # Don't put configuration if it's already in
380
+ # Weed out older docs (same ide, smaller rev).
335
381
  #
336
- # (avoid storages from trashing configuration...)
382
+ # This could all have been done via SQL, but those inconsistencies
383
+ # are rare, the cost of the pumped SQL is not constant :-(
337
384
  #
338
- def put_configuration
385
+ def select_last_revs(docs)
339
386
 
340
- return if get('configurations', 'engine')
387
+ docs.each_with_object([]) { |doc, a|
388
+ a << doc if a.last.nil? || doc[:ide] != a.last[:ide]
389
+ }
390
+ end
391
+
392
+ #--
393
+ # worker step cache
394
+ #
395
+ # in order to cut down the number of selects, do one select with
396
+ # all the information the worker needs for one step of work
397
+ #++
398
+
399
+ CACHED_TYPES = %w[ msgs schedules configurations variables ]
400
+
401
+ # One select to grab in all the info necessary for a worker step
402
+ # (expressions excepted).
403
+ #
404
+ def prepare_cache
405
+
406
+ CACHED_TYPES.each { |t| cache[t] = {} }
407
+
408
+ @sequel[@table].select(
409
+ :ide, :typ, :doc
410
+ ).where(
411
+ :typ => CACHED_TYPES
412
+ ).order(
413
+ :ide.asc, :rev.desc
414
+ ).each do |d|
415
+ (cache[d[:typ]] ||= {})[d[:ide]] ||= Rufus::Json.decode(d[:doc])
416
+ end
341
417
 
342
- conf = { '_id' => 'engine', 'type' => 'configurations' }.merge(@options)
343
- put(conf)
418
+ cache['variables']['trackers'] ||=
419
+ { '_id' => 'trackers', 'type' => 'variables', 'trackers' => {} }
344
420
  end
345
421
 
346
- def select_last_revs(docs, reverse=false)
422
+ # Ask the cache for a doc. Returns nil if it's not cached.
423
+ #
424
+ def cache_get(type, key)
347
425
 
348
- docs = docs.inject({}) { |h, doc|
349
- h[doc[:ide]] = doc
350
- h
351
- }.values.sort_by { |h|
352
- h[:ide]
353
- }
426
+ (cache[type] || {})[key]
427
+ end
428
+
429
+ # Ask the cache for a set of documents. Returns nil if it's not cached
430
+ # or caching is not OK.
431
+ #
432
+ def cache_get_many(type, keys, options)
433
+
434
+ if !options[:batch] && CACHED_TYPES.include?(type) && cache[type]
435
+ cache[type].values
436
+ else
437
+ nil
438
+ end
439
+ end
440
+
441
+ # Removes a document from the cache.
442
+ #
443
+ def cache_clear(doc)
444
+
445
+ (cache[doc['type']] || {}).delete(doc['_id'])
446
+ end
447
+
448
+ # Returns the cache for the given thread. Returns {} if there is no
449
+ # cache available.
450
+ #
451
+ def cache
452
+
453
+ worker = Thread.current['ruote_worker']
454
+
455
+ return {} unless worker
354
456
 
355
- reverse ? docs.reverse : docs
457
+ (Thread.current["cache_#{worker.name}"] ||= {})
356
458
  end
357
459
  end
358
460
  end
@@ -1,8 +1,32 @@
1
+ #--
2
+ # Copyright (c) 2005-2012, 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
+
1
25
 
2
26
  module Ruote
3
27
  module Sequel
4
28
 
5
- VERSION = '2.2.0'
29
+ VERSION = '2.3.0'
6
30
  end
7
31
  end
8
32
 
data/ruote-sequel.gemspec CHANGED
@@ -1,9 +1,13 @@
1
- # encoding: utf-8
1
+ # encoding: UTF-8
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
 
5
5
  s.name = 'ruote-sequel'
6
- s.version = File.read('lib/ruote/sequel/version.rb').match(/VERSION = '([^']+)'/)[1]
6
+
7
+ s.version = File.read(
8
+ File.expand_path('../lib/ruote/sequel/version.rb', __FILE__)
9
+ ).match(/ VERSION *= *['"]([^'"]+)/)[1]
10
+
7
11
  s.platform = Gem::Platform::RUBY
8
12
  s.authors = [ 'John Mettraux' ]
9
13
  s.email = [ 'jmettraux@gmail.com' ]
@@ -12,7 +16,7 @@ Gem::Specification.new do |s|
12
16
  s.summary = 'Sequel storage for ruote (a workflow engine)'
13
17
  s.description = %q{
14
18
  Sequel storage for ruote (a workflow engine)
15
- }
19
+ }
16
20
 
17
21
  #s.files = `git ls-files`.split("\n")
18
22
  s.files = Dir[
@@ -21,7 +25,7 @@ Sequel storage for ruote (a workflow engine)
21
25
  '*.gemspec', '*.txt', '*.rdoc', '*.md'
22
26
  ]
23
27
 
24
- s.add_runtime_dependency 'sequel', '3.20.0'
28
+ s.add_runtime_dependency 'sequel'#, '>= 3.31.0'
25
29
  s.add_runtime_dependency 'ruote', ">= #{s.version}"
26
30
 
27
31
  s.add_development_dependency 'rake'
@@ -0,0 +1,54 @@
1
+
2
+ #
3
+ # testing ruote-sequel
4
+ #
5
+ # Thu Feb 10 11:14:56 JST 2011
6
+ #
7
+
8
+ require 'rufus-json/automatic'
9
+ require 'ruote-sequel'
10
+
11
+
12
+ unless $sequel
13
+
14
+ $sequel = case ENV['RUOTE_STORAGE_DB'] || 'postgres'
15
+ when 'pg', 'postgres'
16
+ Sequel.connect('postgres://localhost/ruote_test')
17
+ when 'my', 'mysql'
18
+ #Sequel.connect('mysql://root:root@localhost/ruote_test')
19
+ Sequel.connect('mysql://root@localhost/ruote_test')
20
+ when 'mysql2'
21
+ Sequel.connect('mysql2://root@localhost/ruote_test')
22
+ when /:/
23
+ Sequel.connect(ENV['RUOTE_STORAGE_DB'])
24
+ else
25
+ raise ArgumentError.new("unknown DB: #{ENV['RUOTE_STORAGE_DB'].inspect}")
26
+ end
27
+
28
+ require 'logger'
29
+
30
+ logger = case ENV['RUOTE_STORAGE_DEBUG']
31
+ when 'log'
32
+ FileUtils.rm('debug.log') rescue nil
33
+ Logger.new('debug.log')
34
+ when 'stdout'
35
+ Logger.new($stdout)
36
+ else
37
+ nil
38
+ end
39
+
40
+ if logger
41
+ logger.level = Logger::DEBUG
42
+ $sequel.loggers << logger
43
+ end
44
+
45
+ Ruote::Sequel.create_table($sequel, true)
46
+ # true forces re_create of 'documents' table
47
+ end
48
+
49
+
50
+ def new_storage(opts)
51
+
52
+ Ruote::Sequel::Storage.new($sequel, opts)
53
+ end
54
+
metadata CHANGED
@@ -1,150 +1,137 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruote-sequel
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 2
7
- - 2
8
- - 0
9
- version: 2.2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.3.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - John Mettraux
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-03-01 00:00:00 +09:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-09-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: sequel
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - "="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 3
30
- - 20
31
- - 0
32
- version: 3.20.0
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: ruote
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: ruote
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- segments:
44
- - 2
45
- - 2
46
- - 0
47
- version: 2.2.0
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 2.3.0
48
38
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: rake
52
39
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 2.3.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
54
49
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- segments:
59
- - 0
60
- version: "0"
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
61
54
  type: :development
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: pg
65
55
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
67
57
  none: false
68
- requirements:
69
- - - "="
70
- - !ruby/object:Gem::Version
71
- segments:
72
- - 0
73
- - 10
74
- - 1
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: pg
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - '='
68
+ - !ruby/object:Gem::Version
75
69
  version: 0.10.1
76
70
  type: :development
77
- version_requirements: *id004
78
- - !ruby/object:Gem::Dependency
79
- name: mysql
80
71
  prerelease: false
81
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
82
73
  none: false
83
- requirements:
84
- - - "="
85
- - !ruby/object:Gem::Version
86
- segments:
87
- - 2
88
- - 8
89
- - 1
74
+ requirements:
75
+ - - '='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.10.1
78
+ - !ruby/object:Gem::Dependency
79
+ name: mysql
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - '='
84
+ - !ruby/object:Gem::Version
90
85
  version: 2.8.1
91
86
  type: :development
92
- version_requirements: *id005
93
- description: "\n\
94
- Sequel storage for ruote (a workflow engine)\n"
95
- email:
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - '='
92
+ - !ruby/object:Gem::Version
93
+ version: 2.8.1
94
+ description: ! "\nSequel storage for ruote (a workflow engine)\n "
95
+ email:
96
96
  - jmettraux@gmail.com
97
97
  executables: []
98
-
99
98
  extensions: []
100
-
101
99
  extra_rdoc_files: []
102
-
103
- files:
100
+ files:
104
101
  - Rakefile
105
102
  - lib/ruote/sequel/storage.rb
106
103
  - lib/ruote/sequel/version.rb
107
104
  - lib/ruote/sequel.rb
108
105
  - lib/ruote-sequel.rb
109
- - test/functional_connection.rb
106
+ - test/connection.rb
110
107
  - test/test.rb
111
108
  - ruote-sequel.gemspec
112
109
  - CHANGELOG.txt
113
110
  - CREDITS.txt
114
111
  - LICENSE.txt
115
112
  - TODO.txt
116
- - README.rdoc
117
- has_rdoc: true
118
113
  homepage: http://ruote.rubyforge.org
119
114
  licenses: []
120
-
121
115
  post_install_message:
122
116
  rdoc_options: []
123
-
124
- require_paths:
117
+ require_paths:
125
118
  - lib
126
- required_ruby_version: !ruby/object:Gem::Requirement
119
+ required_ruby_version: !ruby/object:Gem::Requirement
127
120
  none: false
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- segments:
132
- - 0
133
- version: "0"
134
- required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
126
  none: false
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- segments:
140
- - 0
141
- version: "0"
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
142
131
  requirements: []
143
-
144
132
  rubyforge_project: ruote
145
- rubygems_version: 1.3.7
133
+ rubygems_version: 1.8.24
146
134
  signing_key:
147
135
  specification_version: 3
148
136
  summary: Sequel storage for ruote (a workflow engine)
149
137
  test_files: []
150
-
data/README.rdoc DELETED
@@ -1,75 +0,0 @@
1
-
2
- = ruote-sequel
3
-
4
- Sequel storage implementation for ruote >= 2.2.0
5
-
6
-
7
- == usage
8
-
9
- This is how a ruote engine is setup with a ruote-dm storage (postgres) and a worker :
10
-
11
- require 'rubygems'
12
- require 'json' # gem install json
13
- require 'ruote'
14
- require 'ruote-sequel' # gem install ruote-sequel
15
-
16
- sequel = Sequel.connect('postgres://localhost/ruote_test')
17
- #sequel = Sequel.connect('mysql://root:root@localhost/ruote_test')
18
-
19
- engine = Ruote::Engine.new(
20
- Ruote::Worker.new(
21
- Ruote::Sequel::Storage.new(sequel)))
22
-
23
- # ...
24
-
25
- To create the tables in the database :
26
-
27
- Ruote::Sequel.create_table($sequel, :re_create => true)
28
-
29
-
30
- Tested with sequel 3.20.0, with the postgresql (pg 0.10.1) adapter.
31
-
32
-
33
- == running tests
34
-
35
- assuming you have
36
-
37
- ruote/
38
- ruote-sequel/
39
-
40
- * unit tests :
41
-
42
- get into ruote/ and do
43
-
44
- ruby test/unit/storage.rb -- --sequel
45
-
46
- * functional tests :
47
-
48
- get into ruote/ and do
49
-
50
- ruby test/functional/test.rb -- --sequel
51
-
52
-
53
- == known issues
54
-
55
- none
56
-
57
-
58
- == license
59
-
60
- MIT
61
-
62
-
63
- == links
64
-
65
- http://sequel.rubyforge.org/
66
-
67
- http://ruote.rubyforge.org/
68
- http://github.com/jmettraux/ruote-sequel
69
-
70
-
71
- == feedback
72
-
73
- mailing list : http://groups.google.com/group/openwferu-users
74
- irc : irc.freenode.net #ruote
75
-
@@ -1,44 +0,0 @@
1
-
2
- #
3
- # testing ruote-sequel
4
- #
5
- # Thu Feb 10 11:14:56 JST 2011
6
- #
7
-
8
- require 'yajl' rescue require 'json'
9
- require 'rufus-json'
10
- Rufus::Json.detect_backend
11
-
12
- require 'ruote-sequel'
13
-
14
- unless $sequel
15
-
16
- $sequel = Sequel.connect('postgres://localhost/ruote_test')
17
- #$sequel = Sequel.connect('mysql://root:root@localhost/ruote_test')
18
-
19
- Ruote::Sequel.create_table($sequel, true)
20
- # true forces re_create of 'documents' table
21
-
22
- require 'logger'
23
-
24
- logger = nil
25
-
26
- if ARGV.include?('-l') || ARGV.include?('--l')
27
- FileUtils.rm('debug.log') rescue nil
28
- logger = Logger.new('debug.log')
29
- elsif ARGV.include?('-ls') || ARGV.include?('--ls')
30
- logger = Logger.new($stdout)
31
- end
32
-
33
- if logger
34
- logger.level = Logger::DEBUG
35
- $sequel.loggers << logger
36
- end
37
- end
38
-
39
-
40
- def new_storage (opts)
41
-
42
- Ruote::Sequel::Storage.new($sequel, opts)
43
- end
44
-