workflow-join 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +51 -0
- data/lib/workflow/join/version.rb +1 -1
- data/workflow-join.gemspec +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f609a97329dc400e969449c824e52ad91413eee
|
4
|
+
data.tar.gz: f441e161a922f387b0b5ee908873c6b8b1db265e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b7762a647e1133c54eb90734c5a8af1e3e18522d1b486f316d25c9d753a27a3b0a0a65f83afe6a50fad229395de36900ffbbfb4960ef6681ec3986786a630a9
|
7
|
+
data.tar.gz: 936d6597d74068ba6f79339b1098be00bcead2854fb1f08f4c138bfb57b192c8a198e31271230d983cde2e54e63f2f6d1523df99a783dd2df106b4e3d48ba7dc
|
data/README.md
CHANGED
@@ -39,6 +39,8 @@ class Master
|
|
39
39
|
|
40
40
|
# before entering :after_meeting state, wait for @slave to enter :resolved state
|
41
41
|
guard :@slave, inner: :after_meeting, outer: :resolved
|
42
|
+
# OR: guard :slave, inner: :after_meeting, outer: :resolved
|
43
|
+
# OR: guard inner: :after_meeting, outer: :resolved, &:slave
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
@@ -54,6 +56,55 @@ class Slave
|
|
54
56
|
end
|
55
57
|
```
|
56
58
|
|
59
|
+
### `ActiveRecord` support
|
60
|
+
|
61
|
+
Introduce two new fields in each model, that uses workflow joins:
|
62
|
+
|
63
|
+
* `workflow_pending_transitions`,
|
64
|
+
* `workflow_pending_callbacks`
|
65
|
+
|
66
|
+
and enjoy:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
class Master < ActiveRecord::Base
|
70
|
+
has_one :slave
|
71
|
+
|
72
|
+
include Workflow
|
73
|
+
|
74
|
+
workflow do
|
75
|
+
state :meeting do
|
76
|
+
event :go, transitions_to: :after_meeting
|
77
|
+
end
|
78
|
+
state :after_meeting
|
79
|
+
|
80
|
+
# before entering :after_meeting state, wait for @slave to enter :resolved state
|
81
|
+
guard :slave, inner: :after_meeting, outer: :resolved
|
82
|
+
# OR: guard inner: :after_meeting, outer: :resolved, &:slave
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class Slave < ActiveRecord::Base
|
87
|
+
belongs_to :master
|
88
|
+
|
89
|
+
include Workflow
|
90
|
+
|
91
|
+
workflow do
|
92
|
+
state :unresolved do
|
93
|
+
event :resolve, transitions_to: :resolved
|
94
|
+
end
|
95
|
+
state :resolved
|
96
|
+
end
|
97
|
+
end
|
98
|
+
```
|
99
|
+
|
100
|
+
As a matter of fact, this gem tries to create the fields above on first usage,
|
101
|
+
but since it happens in the middle of class loading process, the whole
|
102
|
+
application start crashes. That is an intended behavior! The columns will be
|
103
|
+
created and simple application restart will enable the feature.
|
104
|
+
|
105
|
+
This part is hardly tested, though, that’s why the preferred way would be to
|
106
|
+
create columns manually.
|
107
|
+
|
57
108
|
## Development
|
58
109
|
|
59
110
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/workflow-join.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workflow-join
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksei Matiushkin
|
@@ -114,14 +114,20 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 3.2.1
|
118
|
+
- - "<"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 5.0.0
|
118
121
|
type: :runtime
|
119
122
|
prerelease: false
|
120
123
|
version_requirements: !ruby/object:Gem::Requirement
|
121
124
|
requirements:
|
122
125
|
- - ">="
|
123
126
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
127
|
+
version: 3.2.1
|
128
|
+
- - "<"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 5.0.0
|
125
131
|
description: Workflow extension that allows to fork workflows with other workflows
|
126
132
|
and join them at specific states.
|
127
133
|
email:
|