Create a gist now

Instantly share code, notes, and snippets.

anonymous /testing.rb
Created Jan 7, 2011

What would you like to do?
require 'rubygems'
require 'ruote'
engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new))
class MyParticipant
include Ruote::LocalParticipant
def consume(workitem)
p [ workitem.participant_name, :tags, workitem.tags ]
workitem.fields['qa_ok'] = true
reply_to_engine(workitem)
end
end
engine.register do
catchall MyParticipant
end
#engine.noisy = true
pdef = Ruote.define do
cursor do
sequence :tag => 'production-stage' do
production
concurrence :tag => 'qa_stage' do
qa1
qa2
end
end
rewind :unless => '${qa_ok}'
sequence :tag => 'delivery-stage' do
packaging
delivery
end
end
end
wfid = engine.launch(pdef)
engine.wait_for(wfid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment