Yawl is Yet another workflow library.
The target audience is for those who have workflows that are mostly sequential and don't need to create complex branching logic.
Add this line to your application's Gemfile:
gem 'yawl'
And then execute:
$ bundle
Or install it yourself as:
$ gem install yawl
The way you go about using it is:
- You define a set of steps where most of your logic will go
Yawl::Steps.set :morning_routine do
step :first_thing do
def run
puts "brush teeth"
end
end
end
- You define a process which references set(s) of steps, this will be the name you call when you want to run the process.
Yawl::ProcessDefinitions.add(:wake_up) do |process|
Yawl::Steps.realize_set_on(:morning_routine)
end
- You call the process with the name you defined in step 2, and add any variables that you need to the
Yawl::Process#config
json field.
p = Yawl::Process.create(:desired_state => "wake_up", :config => {})
p.start
bundle exec sequel -m migrations/ postgres://localhost/yawl_examples
bundle exec ruby examples/cook_worker.rb &
bundle exec ruby examples/cook.rb
Originally written by @dpiddy, extracted by @ricardochimal from a larger project into its own gem.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request