Skip to content

jmettraux/ruote-sequel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:root@localhost/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:root@localhost/ruote_test',
  :after_connect => proc { |c| c.reconnect = true })
    #
    # or
    #
sequel = Sequel.connect(
  'mysql://root:root@localhost/ruote_test',
  :after_connect => proc { |c| c.send(:reconnect=, true) })
    #
    # similar foro mysql2
    #
sequel = Sequel.connect(
  'mysql2://root@localhost/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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages