All Projects → jmettraux → Ruote Sequel

jmettraux / Ruote Sequel

Licence: mit
Sequel-based storage implementation for ruote (a Ruby workflow engine)

Programming Languages

ruby
36898 projects - #4 most used programming language

ruote-sequel

Sequel storage implementation for ruote >= 2.2.0

usage

This is how a ruote engine is setup with a ruote-sequel storage (postgres) and a worker:

require 'rubygems'
require 'json' # gem install json
require 'ruote'
require 'ruote-sequel' # gem install ruote-sequel

sequel = Sequel.connect('postgres://localhost/ruote_test')
#sequel = Sequel.connect('mysql://root:[email protected]/ruote_test')
#sequel = Sequel.connect(
#  :adapter => 'mysql2',
#  :user => 'root',
#  :password => 'root',
#  :socket=> '/tmp/mysql.sock',
#  :database => 'foo_development')

engine = Ruote::Engine.new(
  Ruote::Worker.new(
    Ruote::Sequel::Storage.new(sequel)))

# ...

To create the table in the database:

Ruote::Sequel.create_table(sequel, true)

Tested with sequel 3.20.0, with the postgresql (pg 0.10.1) adapter.

To learn more about connecting Sequel to a database:

http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html

A single 'documents' table is used. To change this name:

opts = { 'sequel_table_name' => 'ruote_docs' }

engine = Ruote::Engine.new(
  Ruote::Worker.new(
    Ruote::Sequel::Storage.new(sequel, opts)))

In case of reconnection errors (mysql and mysql2), doing something like

sequel = Sequel.connect(
  'mysql://root:[email protected]/ruote_test',
  :after_connect => proc { |c| c.reconnect = true })
    #
    # or
    #
sequel = Sequel.connect(
  'mysql://root:[email protected]/ruote_test',
  :after_connect => proc { |c| c.send(:reconnect=, true) })
    #
    # similar foro mysql2
    #
sequel = Sequel.connect(
  'mysql2://[email protected]/ruote_test',
  :after_connect => proc { |c| c.send(:reconnect=, true) })

might help (seems not OK with mysql2).

running tests

assuming you have

ruote/
ruote-sequel/
  • unit tests :

get into ruote/ and do

$ ruby test/unit/storage.rb -- --sequel
  • functional tests :

get into ruote/ and do

$ ruby test/functional/test.rb -- --sequel

license

MIT

links

http://sequel.rubyforge.org/

http://ruote.rubyforge.org/ http://github.com/jmettraux/ruote-sequel

feedback

mailing list : http://groups.google.com/group/openwferu-users irc : irc.freenode.net #ruote

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].