Petri Net Workflow Engine for Ruby.
Workflow engine for Rails.
Add this line to your application's Gemfile:
gem 'petri_flow', require: 'wf'
And then execute:
$ bundle
Install graphviz
brew install graphviz
Migration:
bundle exec rake wf:install:migrations
bundle exec rails db:create
bundle exec rails db:migrate
bundle exec rails db:seed
Add wf_config:
# config/initializers/wf_config.rb
Wf.user_class = "::User"
Wf.org_classes = { group: "::Group" }
Set parties:
For normal org model, for example group or role etc.
module Wf
class Group < ApplicationRecord
has_many :users
include Wf::ActsAsParty
acts_as_party(user: false, party_name: :name)
end
end
For user model:
module Wf
class User < ApplicationRecord
belongs_to :group, optional: true
include Wf::ActsAsParty
acts_as_party(user: true, party_name: :name)
end
end
then
bundle exec rails
visit:
http://localhost:3000/wf
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.