-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathseeds.rb
38 lines (31 loc) · 1.05 KB
/
seeds.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# frozen_string_literal: true
FlowCore::Definition.new name: "Simple sequence" do |net|
net.start_place :start, name: "Start"
net.end_place :end, name: "End"
net.transition :t1, input: :start, output: :p1
net.transition :t2, input: :p1, output: :end
end.deploy!
FlowCore::Definition.new name: "Parallel routing" do |net|
net.start_place :start
net.end_place :end
net.transition :t1, input: :start, output: %i[p1 p2]
net.transition :t2, input: :p1, output: :p3
net.transition :t3, input: :p2, output: :p4
net.transition :t4, input: %i[p3 p4], output: :end
end.deploy!
FlowCore::Definition.new name: "Timed split" do |net|
net.start_place :start
net.end_place :end
net.transition :t1, input: :start, output: :p
net.transition :t2, input: :p, output: :end
net.transition :t3, input: :start, output: :end do |t|
t.with_trigger FlowKit::TransitionTriggers::Timer, countdown_in_seconds: 5
end
end.deploy!
w = FlowCore::Workflow.first
i = w.create_instance!
i.activate!
t = i.tasks.enabled.first
t.finish!
t = i.tasks.enabled.first
t.finish!