workflow_core 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 811e973c52672a22910d4cbd3cea630788de539f951d0ed5b83185e7bf7b8dc6
4
- data.tar.gz: 8cac78ded90082dbf6a66c77fb4d2969b3a30846192f27c20d15ae0bae86670a
3
+ metadata.gz: e80a40cece14fd323e6be9a6975da25ef1127fcd013aa62e2a4d036fb1b30390
4
+ data.tar.gz: ae753290c74c1ebaee65b7f411fef0c6834e0a5fd54f432f66b4de7d4318dd0d
5
5
  SHA512:
6
- metadata.gz: 316fef5691389a031987ec16a194d242d5b961511ec20dac720841e07eff364958d210072dd61b6abbec87daa7337e27359450ccbb27e4a2cb09e219dd39ba17
7
- data.tar.gz: 0adeeeba9b7c7a80aa2b11ac73cc1b28c559ad88f5f47f6a987acfa800eac77bd3842e4753a10eb4be3789db5f449edd0e858db72396b6b264298232dec41a11
6
+ metadata.gz: 894663aa689f0b3e80a81928cfdc95ea4be21776f4d79f1fdd6460c0c7cf9c30a8a96b1c297eedfd3fdbb0f7746ceb1b9ee3f4369f4d9b67b77e83ed0f4f39d2
7
+ data.tar.gz: 2f6e25bfbc730c78467a0e1b635bc7c26143f67617324a3acbd05b2d7068cafe9e1ebf6e7b6abfd9442ffae0a4e2a3b0fdf5d22b5efe71113d81d3af34a7da5f
data/README.md CHANGED
@@ -15,13 +15,11 @@ WorkflowCore is originally designed for Business Process Management (BPM), in th
15
15
  - Task may tight with application features
16
16
  - May meet some special or weird requirements
17
17
 
18
- WorkflowCore is based on [Workflow Net](http://mlwiki.org/index.php/Workflow_Nets) technique, and only providing essential features for a workflow engine.
18
+ WorkflowCore is based on [Petri Net](http://mlwiki.org/index.php/Petri_Nets) technique, and only providing essential features for a workflow engine.
19
19
 
20
20
  ## Features
21
21
 
22
- ### Models to describe workflow net
23
-
24
- Workflow Net is a special case of [Petri net](http://mlwiki.org/index.php/Petri_Nets)
22
+ ### Models to describe Petri Net
25
23
 
26
24
  ![](_assets/workflow_net.png)
27
25
 
@@ -30,7 +28,7 @@ There are two kinds of nodes
30
28
  - Place (circles): represent the states of a system
31
29
  - Transition (squares): represent state changes
32
30
 
33
- WorkflowCore provides Place & Transition models that can represent a workflow net, and a Workflow model as root.
31
+ WorkflowCore provides Place & Transition models that can represent a Petri Net, and a Workflow model as root.
34
32
 
35
33
  ### Models to describe workflow instances
36
34
 
@@ -66,8 +64,8 @@ BTW, the dummy app is a full-featured app with production level codebase that yo
66
64
 
67
65
  ## Requirements
68
66
 
69
- - MRI 2.3+
70
- - Rails 5.0+
67
+ - MRI 2.5+
68
+ - Rails 6.0+
71
69
 
72
70
  ## Usage
73
71
 
@@ -144,7 +142,13 @@ Preparing database
144
142
 
145
143
  ```sh
146
144
  $ bin/rails db:migrate
147
- ```
145
+ ```
146
+
147
+ Import sample workflow
148
+
149
+ ```sh
150
+ $ bin/rails db:seed
151
+ ```
148
152
 
149
153
  Start the Rails server
150
154
 
@@ -8,9 +8,15 @@ module WorkflowCore
8
8
 
9
9
  belongs_to :workflow
10
10
 
11
- has_many :input_places, dependent: :nullify,
12
- foreign_key: "output_transition_id", class_name: "WorkflowCore::Place"
13
- has_many :output_places, dependent: :destroy,
14
- foreign_key: "input_transition_id", class_name: "WorkflowCore::Place"
11
+ has_many :input_places,
12
+ dependent: :nullify,
13
+ foreign_key: "output_transition_id",
14
+ class_name: "WorkflowCore::Place",
15
+ inverse_of: :output_transition
16
+ has_many :output_places,
17
+ dependent: :destroy,
18
+ foreign_key: "input_transition_id",
19
+ class_name: "WorkflowCore::Place",
20
+ inverse_of: :input_transition
15
21
  end
16
22
  end
@@ -6,7 +6,7 @@ module WorkflowCore
6
6
 
7
7
  self.table_name = "workflows"
8
8
 
9
- has_one :start_place, class_name: "WorkflowCore::Place", dependent: :destroy
9
+ belongs_to :start_place, class_name: "WorkflowCore::Place", dependent: :destroy, optional: true
10
10
 
11
11
  has_many :transitions, class_name: "WorkflowCore::Transition", dependent: :destroy
12
12
  has_many :places, class_name: "WorkflowCore::Place", dependent: :destroy
@@ -14,7 +14,8 @@ module WorkflowCore
14
14
  completed: 1,
15
15
  failed: 2,
16
16
  unexpected: 3,
17
- terminated: 4
17
+ terminated: 4,
18
+ draft: 10
18
19
  }
19
20
 
20
21
  serialize :payload
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateWorkflows < ActiveRecord::Migration[5.2]
3
+ class CreateWorkflows < ActiveRecord::Migration[6.0]
4
4
  def change
5
5
  create_table :workflows do |t|
6
6
  t.string :type, null: false
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateWorkflowTransitions < ActiveRecord::Migration[5.2]
3
+ class CreateWorkflowTransitions < ActiveRecord::Migration[6.0]
4
4
  def change
5
5
  create_table :workflow_transitions do |t|
6
6
  t.string :type, null: false
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateWorkflowPlaces < ActiveRecord::Migration[5.2]
3
+ class CreateWorkflowPlaces < ActiveRecord::Migration[6.0]
4
4
  def change
5
5
  create_table :workflow_places do |t|
6
6
  t.references :input_transition, foreign_key: { to_table: "workflow_transitions" }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateWorkflowInstances < ActiveRecord::Migration[5.2]
3
+ class CreateWorkflowInstances < ActiveRecord::Migration[6.0]
4
4
  def change
5
5
  create_table :workflow_instances do |t|
6
6
  t.text :payload
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateWorkflowTokens < ActiveRecord::Migration[5.2]
3
+ class CreateWorkflowTokens < ActiveRecord::Migration[6.0]
4
4
  def change
5
5
  create_table :workflow_tokens do |t|
6
6
  t.integer :status, null: false, default: 0
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddStartPlaceIdToWorkflows < ActiveRecord::Migration[6.0]
4
+ def change
5
+ change_table :workflows do |t|
6
+ t.references :start_place, foreign_key: { to_table: "workflow_places" }
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkflowCore
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workflow_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - jasl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-10 00:00:00.000000000 Z
11
+ date: 2020-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -49,10 +49,11 @@ files:
49
49
  - app/models/workflow_core/workflow.rb
50
50
  - app/models/workflow_core/workflow_instance.rb
51
51
  - db/migrate/20180910195950_create_workflows.rb
52
- - db/migrate/20180910200203_create_workflow_places.rb
53
- - db/migrate/20180910200454_create_workflow_transitions.rb
52
+ - db/migrate/20180910200203_create_workflow_transitions.rb
53
+ - db/migrate/20180910200454_create_workflow_places.rb
54
54
  - db/migrate/20180912223642_create_workflow_instances.rb
55
55
  - db/migrate/20180912223722_create_workflow_tokens.rb
56
+ - db/migrate/20191004190723_add_start_place_id_to_workflows.rb
56
57
  - lib/tasks/workflow_core_tasks.rake
57
58
  - lib/workflow_core.rb
58
59
  - lib/workflow_core/concerns/models/place.rb
@@ -81,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
82
  - !ruby/object:Gem::Version
82
83
  version: '0'
83
84
  requirements: []
84
- rubygems_version: 3.0.4
85
+ rubygems_version: 3.1.2
85
86
  signing_key:
86
87
  specification_version: 4
87
88
  summary: A Rails engine which providing essential infrastructure of workflow. It's