bizflow 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +27 -0
- data/.rspec +2 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +105 -0
- data/Rakefile +2 -0
- data/bin/bizflow +28 -0
- data/bizflow.gemspec +29 -0
- data/lib/bizflow/business_model/handler.rb +13 -0
- data/lib/bizflow/business_model/head.rb +34 -0
- data/lib/bizflow/business_model/input_action.rb +47 -0
- data/lib/bizflow/business_model/process.rb +46 -0
- data/lib/bizflow/business_model/simple_wrapper.rb +22 -0
- data/lib/bizflow/business_model/task.rb +41 -0
- data/lib/bizflow/business_model/task_action.rb +36 -0
- data/lib/bizflow/command/build_command.rb +33 -0
- data/lib/bizflow/command/clean_command.rb +9 -0
- data/lib/bizflow/command/command_helper.rb +19 -0
- data/lib/bizflow/command/help_command.rb +11 -0
- data/lib/bizflow/command/install_command.rb +16 -0
- data/lib/bizflow/command/setup_command.rb +29 -0
- data/lib/bizflow/config_generator.rb +16 -0
- data/lib/bizflow/data_model/action.rb +22 -0
- data/lib/bizflow/data_model/action_blueprint.rb +22 -0
- data/lib/bizflow/data_model/handler.rb +16 -0
- data/lib/bizflow/data_model/handler_blueprint.rb +17 -0
- data/lib/bizflow/data_model/head.rb +16 -0
- data/lib/bizflow/data_model/next_action.rb +17 -0
- data/lib/bizflow/data_model/next_action_blueprint.rb +17 -0
- data/lib/bizflow/data_model/process.rb +31 -0
- data/lib/bizflow/data_model/process_blueprint.rb +17 -0
- data/lib/bizflow/data_model/task.rb +17 -0
- data/lib/bizflow/data_model/task_blueprint.rb +17 -0
- data/lib/bizflow/fakes/action.rb +23 -0
- data/lib/bizflow/fakes/action_blueprint.rb +24 -0
- data/lib/bizflow/fakes/handler.rb +15 -0
- data/lib/bizflow/fakes/handler_blueprint.rb +18 -0
- data/lib/bizflow/fakes/head.rb +14 -0
- data/lib/bizflow/fakes/process.rb +20 -0
- data/lib/bizflow/fakes/process_blueprint.rb +14 -0
- data/lib/bizflow/fakes/task.rb +16 -0
- data/lib/bizflow/fakes/task_blueprint.rb +19 -0
- data/lib/bizflow/interpreters/domain_interpreter.rb +19 -0
- data/lib/bizflow/interpreters/input_action_interpreter.rb +35 -0
- data/lib/bizflow/interpreters/process_interpreter.rb +37 -0
- data/lib/bizflow/interpreters/task_action_interpreter.rb +29 -0
- data/lib/bizflow/lib/blueprint_builder.rb +90 -0
- data/lib/bizflow/lib/callback_handler.rb +27 -0
- data/lib/bizflow/lib/callbackable.rb +25 -0
- data/lib/bizflow/lib/process_builder.rb +61 -0
- data/lib/bizflow/lib/semantic_builder.rb +36 -0
- data/lib/bizflow/migrations/001_create_processes.rb +21 -0
- data/lib/bizflow/migrations/002_create_actions.rb +17 -0
- data/lib/bizflow/migrations/003_create_process_heads.rb +15 -0
- data/lib/bizflow/migrations/004_create_tasks.rb +16 -0
- data/lib/bizflow/migrations/005_create_process_blueprints.rb +14 -0
- data/lib/bizflow/migrations/006_action_blueprints.rb +16 -0
- data/lib/bizflow/migrations/007_next_action_blueprints.rb +14 -0
- data/lib/bizflow/migrations/008_handler_blueprints.rb +15 -0
- data/lib/bizflow/migrations/009_task_blueprints.rb +16 -0
- data/lib/bizflow/migrations/010_create_handlers.rb +16 -0
- data/lib/bizflow/migrations/011_next_actions.rb +14 -0
- data/lib/bizflow/monkey_patch.rb +12 -0
- data/lib/bizflow/repos/repo.rb +21 -0
- data/lib/bizflow/semantic_model/action.rb +29 -0
- data/lib/bizflow/semantic_model/domain_repo.rb +19 -0
- data/lib/bizflow/semantic_model/handler.rb +21 -0
- data/lib/bizflow/semantic_model/input_action.rb +19 -0
- data/lib/bizflow/semantic_model/process.rb +29 -0
- data/lib/bizflow/semantic_model/task.rb +18 -0
- data/lib/bizflow/semantic_model/task_action.rb +26 -0
- data/lib/bizflow/source_generator.rb +62 -0
- data/lib/bizflow/source_presenters/process_template_presenter.rb +26 -0
- data/lib/bizflow/templates/js/descriptor.tt +9 -0
- data/lib/bizflow/templates/js/process.tt +41 -0
- data/lib/bizflow/templates/rb/config.tt +11 -0
- data/lib/bizflow/templates/rb/handler.tt +4 -0
- data/lib/bizflow/templates/rb/process.tt +53 -0
- data/lib/bizflow/version.rb +3 -0
- data/lib/bizflow.rb +15 -0
- data/spec/factories/factories.rb +38 -0
- data/spec/spec_config.rb +42 -0
- data/spec/spec_helper.rb +89 -0
- data/spec/unit/business/business_process_spec.rb +203 -0
- data/spec/unit/business/process_alternative_spec.rb +77 -0
- data/spec/unit/command/build_order_spec.rb +44 -0
- data/spec/unit/command/build_spec.rb +44 -0
- data/spec/unit/creating_processes_spec.rb +59 -0
- data/spec/unit/dsl_scripts/breakfast/process_file.rb +50 -0
- data/spec/unit/dsl_scripts/order/order.rb +41 -0
- data/spec/unit/interpreters/interpreters_spec.rb +105 -0
- data/text/Master.odt +0 -0
- data/text/prezentacija.odp +0 -0
- data/text/zbornik.doc +0 -0
- metadata +248 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
require "bizflow/semantic_model/domain_repo"
|
2
|
+
require "bizflow/interpreters/domain_interpreter"
|
3
|
+
|
4
|
+
module Bizflow
|
5
|
+
module Lib
|
6
|
+
|
7
|
+
class SemanticBuilder
|
8
|
+
|
9
|
+
attr_accessor :repo, :source_path, :domain_interpreter
|
10
|
+
|
11
|
+
def initialize(source_path)
|
12
|
+
@repo = Bizflow::SemanticModel::DomainRepo.new
|
13
|
+
@source_path = source_path
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def build
|
18
|
+
|
19
|
+
@domain_interpreter = Bizflow::DomainInterpreter.new(repo)
|
20
|
+
source_files.each do |path|
|
21
|
+
@domain_interpreter.instance_eval(File.read(path), path, __LINE__)
|
22
|
+
end
|
23
|
+
repo
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def source_files
|
30
|
+
Dir["#{@source_path}/**/*.rb"]
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_table(:processes) do
|
4
|
+
primary_key :id
|
5
|
+
foreign_key :process_blueprint_id, :process_blueprints
|
6
|
+
Integer :start_action_id
|
7
|
+
String :name
|
8
|
+
String :description, :text=>true
|
9
|
+
Integer :creator_id, :null=>false
|
10
|
+
String :pid, :null => false
|
11
|
+
Integer :runner_id
|
12
|
+
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
|
13
|
+
DateTime :runned_at
|
14
|
+
DateTime :finished_at
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
down do
|
19
|
+
drop_table(:processes)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_table(:actions) do
|
4
|
+
primary_key :id
|
5
|
+
foreign_key :process_id, :processes
|
6
|
+
foreign_key :action_blueprint_id, :action_blueprints
|
7
|
+
String :description, :text => true
|
8
|
+
String :name, :null => false
|
9
|
+
String :type, :null => false
|
10
|
+
String :question
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
down do
|
15
|
+
drop_table(:actions)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_table(:heads) do
|
4
|
+
primary_key :id
|
5
|
+
foreign_key :process_id, :processes
|
6
|
+
foreign_key :action_id, :actions
|
7
|
+
DateTime :jumped_at
|
8
|
+
index [:process_id, :action_id], :unique=>true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
down do
|
13
|
+
drop_table(:process_heads)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_table(:tasks) do
|
4
|
+
primary_key :id
|
5
|
+
foreign_key :action_id, :actions
|
6
|
+
foreign_key :task_blueprint_id, :task_blueprints
|
7
|
+
Integer :assignee_id
|
8
|
+
String :name, :null => false
|
9
|
+
DateTime :finished_at
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
down do
|
14
|
+
drop_table(:tasks)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_table(:action_blueprints) do
|
4
|
+
primary_key :id
|
5
|
+
foreign_key :process_blueprint_id, :process_blueprints
|
6
|
+
String :name, :null => false
|
7
|
+
String :type, :null => false
|
8
|
+
String :description
|
9
|
+
String :question
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
down do
|
14
|
+
drop_table(:actions)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_table(:next_action_blueprints) do
|
4
|
+
primary_key :id
|
5
|
+
foreign_key :action_blueprint_id, :action_blueprints
|
6
|
+
foreign_key :next_blueprint_id, :action_blueprints
|
7
|
+
String :ending
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
down do
|
12
|
+
drop_table(:next_action_blueprints)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_table(:handler_blueprints) do
|
4
|
+
primary_key :id
|
5
|
+
foreign_key :action_blueprint_id, :action_blueprints
|
6
|
+
String :name, :null => false
|
7
|
+
String :namespace, :null => false
|
8
|
+
String :description
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
down do
|
13
|
+
drop_table(:handler_blueprints)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_table(:task_blueprints) do
|
4
|
+
primary_key :id
|
5
|
+
foreign_key :action_blueprint_id, :action_blueprints
|
6
|
+
String :name, :null => false
|
7
|
+
String :roles
|
8
|
+
String :description
|
9
|
+
TrueClass :auto_assign, :default => false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
down do
|
14
|
+
drop_table(:task_blueprints)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_table(:handlers) do
|
4
|
+
primary_key :id
|
5
|
+
foreign_key :action_id, :actions
|
6
|
+
foreign_key :handler_blueprint_id, :handler_blueprints
|
7
|
+
TrueClass :finished, :default => false
|
8
|
+
TrueClass :error, :default => false
|
9
|
+
String :error_text
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
down do
|
14
|
+
drop_table(:handlers)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# require "sqlite3"
|
2
|
+
require 'sequel'
|
3
|
+
|
4
|
+
module Bizflow
|
5
|
+
module Repos
|
6
|
+
|
7
|
+
class Repo
|
8
|
+
|
9
|
+
def self.connect(db_path)
|
10
|
+
@@connection ||= Sequel.connect("sqlite://#{db_path}")
|
11
|
+
Dir[File.expand_path("../../data_model/*.rb", __FILE__)].each { |file| require_relative file }
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.connection
|
15
|
+
@@connection
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Bizflow
|
2
|
+
module SemanticModel
|
3
|
+
|
4
|
+
class Action
|
5
|
+
|
6
|
+
attr_accessor :name, :description, :type, :question
|
7
|
+
|
8
|
+
def initialize(type, name, description = nil)
|
9
|
+
@type = type
|
10
|
+
@name = name
|
11
|
+
@description = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
def next_actions
|
15
|
+
raise NotImplementedError
|
16
|
+
end
|
17
|
+
|
18
|
+
def tasks
|
19
|
+
[]
|
20
|
+
end
|
21
|
+
|
22
|
+
def handler
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Bizflow
|
2
|
+
module SemanticModel
|
3
|
+
|
4
|
+
class Handler
|
5
|
+
|
6
|
+
attr_accessor :namespace, :name, :description
|
7
|
+
|
8
|
+
def initialize(name, options = {})
|
9
|
+
@name = name
|
10
|
+
@namespace = options[:namespace]
|
11
|
+
@description = options[:description]
|
12
|
+
end
|
13
|
+
|
14
|
+
def full_name
|
15
|
+
"#{namespace}:#{name}"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative "action"
|
2
|
+
|
3
|
+
module Bizflow
|
4
|
+
module SemanticModel
|
5
|
+
|
6
|
+
class InputAction < Action
|
7
|
+
|
8
|
+
attr_accessor :next_actions, :control_input
|
9
|
+
|
10
|
+
def initialize(name)
|
11
|
+
super("input", name)
|
12
|
+
@next_actions = {}
|
13
|
+
@control_input = nil
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Bizflow
|
2
|
+
module SemanticModel
|
3
|
+
|
4
|
+
class Process
|
5
|
+
|
6
|
+
attr_accessor :name, :description, :start, :actions
|
7
|
+
|
8
|
+
def initialize(name)
|
9
|
+
@name = name
|
10
|
+
@actions = []
|
11
|
+
@roles = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_action(action)
|
15
|
+
actions << action
|
16
|
+
end
|
17
|
+
|
18
|
+
def task_actions
|
19
|
+
actions.select { |acc| acc.type == "task" }
|
20
|
+
end
|
21
|
+
|
22
|
+
def input_actions
|
23
|
+
actions.select { |acc| acc.type == "input"}
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Bizflow
|
2
|
+
module SemanticModel
|
3
|
+
|
4
|
+
class Task
|
5
|
+
|
6
|
+
attr_accessor :name, :description, :roles, :auto_assign
|
7
|
+
|
8
|
+
def initialize(name, options = {})
|
9
|
+
@name = name
|
10
|
+
@roles = options[:roles]
|
11
|
+
@description = options[:description]
|
12
|
+
@auto_assign = options[:auto_assign] || false
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative "action"
|
2
|
+
|
3
|
+
module Bizflow
|
4
|
+
module SemanticModel
|
5
|
+
|
6
|
+
class TaskAction < Action
|
7
|
+
|
8
|
+
attr_accessor :tasks, :next_action
|
9
|
+
|
10
|
+
def initialize(name)
|
11
|
+
super("task", name)
|
12
|
+
@tasks = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_task(task)
|
16
|
+
tasks << task
|
17
|
+
end
|
18
|
+
|
19
|
+
def next_actions
|
20
|
+
{ only_one: next_action }
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'bizflow/source_presenters/process_template_presenter'
|
4
|
+
|
5
|
+
module Bizflow
|
6
|
+
class SourceGenerator
|
7
|
+
|
8
|
+
JsTemplatesPath = "#{File.dirname(__FILE__)}/templates/js"
|
9
|
+
RbTemplatesPath = "#{File.dirname(__FILE__)}/templates/rb"
|
10
|
+
|
11
|
+
attr_reader :domain_repo
|
12
|
+
|
13
|
+
def initialize(builder)
|
14
|
+
@builder = builder
|
15
|
+
@domain_repo = @builder.build
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate(config)
|
19
|
+
generate_processes(config[:dest_process_path])
|
20
|
+
generate_processes_descriptor(config[:dest_descriptor_path])
|
21
|
+
#generate_handlers(source_dest)
|
22
|
+
end
|
23
|
+
|
24
|
+
def generate_processes(source_dest)
|
25
|
+
|
26
|
+
domain_repo.processes.each do |_, process|
|
27
|
+
presenter = Bizflow::ProcessTemplatePresenter.new(process)
|
28
|
+
process_source = ERB.new(File.read("#{RbTemplatesPath}/process.tt"), nil, '-').result(presenter.get_binding)
|
29
|
+
out_file = File.new("#{source_dest}/#{presenter.name}_process.rb", "w")
|
30
|
+
out_file.puts(process_source)
|
31
|
+
out_file.close
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def generate_handlers(source_dest)
|
37
|
+
|
38
|
+
domain_repo.processes.each do |_, process|
|
39
|
+
presenter = Bizflow::ProcessTemplatePresenter.new(process)
|
40
|
+
handler_source = ERB.new(File.read("#{RbTemplatesPath}/handler.tt")).result(presenter.get_binding)
|
41
|
+
Dir.mkdir "#{source_dest}/handlers"
|
42
|
+
process.handlers.each do |handler|
|
43
|
+
out_file = File.new("#{source_dest}/handlers/#{handler.name}_handler.rb", "w")
|
44
|
+
out_file.puts(handler_source)
|
45
|
+
out_file.close
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
def generate_processes_descriptor(source_dest)
|
52
|
+
|
53
|
+
descriptor = ERB.new(File.read("#{JsTemplatesPath}/descriptor.tt"), nil, '-').result(domain_repo.get_binding)
|
54
|
+
out_file = File.new("#{source_dest}/process-descriptor.json", "w")
|
55
|
+
out_file.puts(descriptor)
|
56
|
+
out_file.close
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
require 'bizflow/monkey_patch'
|
3
|
+
|
4
|
+
class Bizflow::ProcessTemplatePresenter < SimpleDelegator
|
5
|
+
|
6
|
+
def render_dependencies
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
def render_comment_header
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_binding
|
15
|
+
binding
|
16
|
+
end
|
17
|
+
|
18
|
+
def classy_name(name)
|
19
|
+
name.camelcase_notation
|
20
|
+
end
|
21
|
+
|
22
|
+
def process_roles_list
|
23
|
+
roles.map{|r| "\"#{r}\""}.join(", ")
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
[
|
2
|
+
<%- @processes.values.sort { |x, y| x.name <=> y.name }.each_with_index do |process, index| -%>
|
3
|
+
{
|
4
|
+
"human_name" : "<%= process.name.split('_').join(" ").capitalize %>",
|
5
|
+
"name" : "<%= process.name %>",
|
6
|
+
"description" : "<%= process.description %>"
|
7
|
+
}<%= "," if index < @processes.count - 1 %>
|
8
|
+
<%- end -%>
|
9
|
+
]
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"name" : "<%= name %>",
|
3
|
+
"namespace" : "<%= namespace %>",
|
4
|
+
"description" : "<%= description %>",
|
5
|
+
"start" : "<%= start %>",
|
6
|
+
"roles" : [<%= process_roles_list %>],
|
7
|
+
|
8
|
+
"automated_actions" : [
|
9
|
+
<%- automated_actions.each do |_, blck| -%>
|
10
|
+
{
|
11
|
+
"name" : "<%= blck.name %>",
|
12
|
+
"description" : "<%= blck.description %>",
|
13
|
+
"handler" : "<%= blck.handler.full_name %>",
|
14
|
+
"next_actions" : {
|
15
|
+
<%- blck.next_actions.each do |k, v| -%>
|
16
|
+
"<%= k %>" : "<%= v %>",
|
17
|
+
<%- end -%>
|
18
|
+
}
|
19
|
+
},
|
20
|
+
<%- end -%>
|
21
|
+
],
|
22
|
+
|
23
|
+
"task_actions" : [
|
24
|
+
<%- task_actions.each do |_, blck| -%>
|
25
|
+
{
|
26
|
+
"name" : "<%= blck.name %>",
|
27
|
+
"description" : "<%= blck.description %>",
|
28
|
+
"next_action" : "<%= blck.next_action %>",
|
29
|
+
"tasks" : [
|
30
|
+
<%- blck.tasks.each do |task| -%>
|
31
|
+
{
|
32
|
+
"name" : "<%= task.name %>",
|
33
|
+
"description" : "<%= task.description %>",
|
34
|
+
"roles" : <%= task.roles %>
|
35
|
+
},
|
36
|
+
<%- end -%>
|
37
|
+
]
|
38
|
+
},
|
39
|
+
<%- end -%>
|
40
|
+
]
|
41
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# this is a generated file. Don't modify it directly, since it will probably be regenerated later
|
2
|
+
|
3
|
+
class <%= classy_name(name) %>Process < Bizflow::BusinessProcess
|
4
|
+
|
5
|
+
@dir = File.expand_path(__dir__)
|
6
|
+
|
7
|
+
StartAction = "<%= start_action %>"
|
8
|
+
|
9
|
+
Actions = {
|
10
|
+
<%- automated_actions.each do |_, blck| -%>
|
11
|
+
<%= blck.name %>: {
|
12
|
+
type: "auto",
|
13
|
+
description: "<%= blck.description %>",
|
14
|
+
handler: Handlers::<%= classy_name(blck.handler.namespace) %>::<%= classy_name(blck.handler.name) %>,
|
15
|
+
next_actions: {
|
16
|
+
<%- blck.next_actions.each do |k, v| -%>
|
17
|
+
<%= k %>: "<%= v %>",
|
18
|
+
<%- end -%>
|
19
|
+
}
|
20
|
+
},
|
21
|
+
<%- end -%>
|
22
|
+
<%- task_actions.each do |_, blck| -%>
|
23
|
+
<%= blck.name %>: {
|
24
|
+
type: "task",
|
25
|
+
description: "<%= blck.description %>",
|
26
|
+
next_action: "<%= blck.next_action %>",
|
27
|
+
tasks: [<%= blck.tasks.map {|t| ":#{t.name}"}.join(", ") %>]
|
28
|
+
},
|
29
|
+
<%- end -%>
|
30
|
+
}
|
31
|
+
|
32
|
+
Tasks = {
|
33
|
+
<%- tasks.each do |task| -%>
|
34
|
+
<%= task.name %>: {
|
35
|
+
description: "<%= task.description %>",
|
36
|
+
roles: <%= task.roles %>
|
37
|
+
},
|
38
|
+
<%- end -%>
|
39
|
+
}
|
40
|
+
|
41
|
+
def start_action
|
42
|
+
StartAction
|
43
|
+
end
|
44
|
+
|
45
|
+
def actions
|
46
|
+
Actions
|
47
|
+
end
|
48
|
+
|
49
|
+
def tasks
|
50
|
+
Tasks
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
data/lib/bizflow.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "bizflow/version"
|
2
|
+
|
3
|
+
require "bizflow/repos/repo"
|
4
|
+
require "bizflow/business_model/simple_wrapper"
|
5
|
+
require "bizflow/business_model/handler"
|
6
|
+
require "bizflow/business_model/head"
|
7
|
+
require "bizflow/business_model/input_action"
|
8
|
+
require "bizflow/business_model/process"
|
9
|
+
require "bizflow/business_model/task"
|
10
|
+
require "bizflow/business_model/task_action"
|
11
|
+
|
12
|
+
module Bizflow
|
13
|
+
|
14
|
+
# Your code goes here...
|
15
|
+
end
|