workflow-orchestrator 1.3.0
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 +20 -0
- data/.travis.yml +36 -0
- data/CHANGELOG.md +133 -0
- data/Gemfile +3 -0
- data/MIT-LICENSE +22 -0
- data/README.md +707 -0
- data/Rakefile +30 -0
- data/gemfiles/Gemfile.rails-3.x +12 -0
- data/gemfiles/Gemfile.rails-4.0 +14 -0
- data/gemfiles/Gemfile.rails-4.1 +14 -0
- data/gemfiles/Gemfile.rails-4.2 +14 -0
- data/gemfiles/Gemfile.rails-edge +14 -0
- data/lib/workflow/adapters/active_record.rb +75 -0
- data/lib/workflow/adapters/remodel.rb +15 -0
- data/lib/workflow/draw.rb +79 -0
- data/lib/workflow/errors.rb +20 -0
- data/lib/workflow/event.rb +38 -0
- data/lib/workflow/event_collection.rb +36 -0
- data/lib/workflow/specification.rb +83 -0
- data/lib/workflow/state.rb +44 -0
- data/lib/workflow/version.rb +3 -0
- data/lib/workflow.rb +307 -0
- data/orders_workflow.png +0 -0
- data/test/active_record_scopes_test.rb +56 -0
- data/test/active_record_scopes_with_values_test.rb +79 -0
- data/test/adapter_hook_test.rb +52 -0
- data/test/advanced_examples_test.rb +84 -0
- data/test/advanced_hooks_and_validation_test.rb +119 -0
- data/test/attr_protected_test.rb +107 -0
- data/test/before_transition_test.rb +36 -0
- data/test/couchtiny_example.rb +46 -0
- data/test/enum_values_in_memory_test.rb +23 -0
- data/test/enum_values_test.rb +30 -0
- data/test/incline_column_test.rb +54 -0
- data/test/inheritance_test.rb +56 -0
- data/test/main_test.rb +588 -0
- data/test/multiple_workflows_test.rb +84 -0
- data/test/new_versions/compare_states_test.rb +32 -0
- data/test/new_versions/persistence_test.rb +62 -0
- data/test/on_error_test.rb +52 -0
- data/test/on_unavailable_transition_test.rb +85 -0
- data/test/readme_example.rb +37 -0
- data/test/test_helper.rb +39 -0
- data/test/without_active_record_test.rb +54 -0
- data/workflow-orchestrator.gemspec +42 -0
- metadata +267 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3d08856d38dcf972b2753aa468ee0e70928c2f3a
|
4
|
+
data.tar.gz: 2ae08f12f24dfdd5f00ee08fc4318b446f1d7b05
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 077c796aa3b6287901be12b9d4cd1739d8183640954ae424b34c9d14e1ef310423ec6b21d8ba613f3d9c00c5e36ba07652252c5bf19ce0aa150d34995fc6ebb4
|
7
|
+
data.tar.gz: db018e57902cc8d96fd85663bc15653f9de57b1d02d636f4a61598f142bfdea7fa39af6b077fa0024491f252ab99860559440622c1b820bc1d726913afe35ed5
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
before_install:
|
2
|
+
- sudo apt-get install -qq graphviz
|
3
|
+
|
4
|
+
rvm:
|
5
|
+
- 2.0.0
|
6
|
+
gemfile:
|
7
|
+
- gemfiles/Gemfile.rails-edge
|
8
|
+
|
9
|
+
matrix:
|
10
|
+
include:
|
11
|
+
- rvm: 2.0.0
|
12
|
+
gemfile: gemfiles/Gemfile.rails-3.x
|
13
|
+
|
14
|
+
- rvm: 2.0.0
|
15
|
+
gemfile: gemfiles/Gemfile.rails-4.0
|
16
|
+
|
17
|
+
- rvm: 2.1.6
|
18
|
+
gemfile: gemfiles/Gemfile.rails-3.x
|
19
|
+
|
20
|
+
- rvm: 2.1.6
|
21
|
+
gemfile: gemfiles/Gemfile.rails-4.1
|
22
|
+
|
23
|
+
- rvm: 2.2.2
|
24
|
+
gemfile: gemfiles/Gemfile.rails-4.1
|
25
|
+
|
26
|
+
- rvm: 2.1.6
|
27
|
+
gemfile: gemfiles/Gemfile.rails-4.2
|
28
|
+
|
29
|
+
- rvm: 2.2.2
|
30
|
+
gemfile: gemfiles/Gemfile.rails-4.2
|
31
|
+
|
32
|
+
- rvm: 2.2.3
|
33
|
+
gemfile: gemfiles/Gemfile.rails-4.2
|
34
|
+
|
35
|
+
- rvm: 2.2.4
|
36
|
+
gemfile: gemfiles/Gemfile.rails-4.2
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
### Release 1.3.0
|
4
|
+
|
5
|
+
* Removed support for Ruby < 2.0.0.
|
6
|
+
If you still need this older versions despite security issues and missing updates, you can continue using
|
7
|
+
geekq/workflow 1.2.0 or older. In your Gemfile put
|
8
|
+
|
9
|
+
gem 'workflow', '~> 1.2.0'
|
10
|
+
* Improved callback method handling: #113 and #125
|
11
|
+
* Incorporated following pull requests from geekq/workflow :
|
12
|
+
* [#172](https://github.com/geekq/workflow/pull/172) Add documentation for without_name_state scopes
|
13
|
+
* [#112](https://github.com/geekq/workflow/pull/112) Negative class level and instance level scopes
|
14
|
+
* [#115](https://github.com/geekq/workflow/pull/115) Use syntax highlighting in README
|
15
|
+
* [#148](https://github.com/geekq/workflow/pull/148) Custom handling when an unavailable transition is called
|
16
|
+
* [#157](https://github.com/geekq/workflow/pull/157) Small Correction in README
|
17
|
+
* [#158](https://github.com/geekq/workflow/pull/158) Support for enumerated state values
|
18
|
+
* [#160](https://github.com/geekq/workflow/pull/160) Do not attempt to draw metadata
|
19
|
+
|
20
|
+
## Previous Releases (geekq/workflow)
|
21
|
+
|
22
|
+
### New in the version 1.2.0
|
23
|
+
|
24
|
+
* Fix issue #98 protected `on\_\*` callbacks in Ruby 2
|
25
|
+
* [#106](https://github.com/geekq/workflow/issues/106) Inherit exceptions from `StandardError` instead of `Exception`
|
26
|
+
* [#109](https://github.com/geekq/workflow/pull/109) Conditional event transitions, contributed by [damncabbage](http://robhoward.id.au/)
|
27
|
+
Please note: this introduces incompatible changes to the meta data API, see also #131.
|
28
|
+
* New policy for supporting other databases - extract to separate
|
29
|
+
gems. See the [README section above](#adapters-to-support-other-databases).
|
30
|
+
* [#111](https://github.com/geekq/workflow/pull/111) Custom Versions of Existing Adapters by [damncabbage](http://robhoward.id.au/)
|
31
|
+
|
32
|
+
|
33
|
+
### New in the version 1.1.0
|
34
|
+
|
35
|
+
* Tested with ActiveRecord 4.0 (Rails 4.0)
|
36
|
+
* Tested with Ruby 2.0
|
37
|
+
* automatically generated scopes with names based on state names
|
38
|
+
* clean workflow definition override for class inheritance - undefining
|
39
|
+
the old convinience methods, s. <http://git.io/FZO02A>
|
40
|
+
|
41
|
+
### New in the version 1.0.0
|
42
|
+
|
43
|
+
* **Support to private/protected callback methods.**
|
44
|
+
See also issues [#53](https://github.com/geekq/workflow/pull/53)
|
45
|
+
and [#58](https://github.com/geekq/workflow/pull/58). With the new
|
46
|
+
implementation:
|
47
|
+
|
48
|
+
* callback methods can be hidden (non public): both private methods
|
49
|
+
in the immediate class and protected methods somewhere in the class
|
50
|
+
hierarchy are supported
|
51
|
+
* no unintentional calls on `fail!` and other Kernel methods
|
52
|
+
* inheritance hierarchy with workflow is supported
|
53
|
+
|
54
|
+
* using Rails' 3.1 `update_column` whenever available so only the
|
55
|
+
workflow state column and not other pending attribute changes are
|
56
|
+
saved on state transition. Fallback to `update_attribute` for older
|
57
|
+
Rails and other ORMs. [commit](https://github.com/geekq/workflow/commit/7e091d8ded1aeeb0a86647bbf7d78ab3c9d0c458)
|
58
|
+
|
59
|
+
### New in the version 0.8.7
|
60
|
+
|
61
|
+
* switch from [jeweler][] to pure bundler for building gems
|
62
|
+
|
63
|
+
### New in the version 0.8.0
|
64
|
+
|
65
|
+
* check if a certain transition possible from the current state with
|
66
|
+
`can_....?`
|
67
|
+
* fix `workflow_state` persistence for multiple_workflows example
|
68
|
+
* add `before_transition` and `after_transition` hooks as suggested by
|
69
|
+
[kasperbn](https://github.com/kasperbn)
|
70
|
+
|
71
|
+
### New in the version 0.7.0
|
72
|
+
|
73
|
+
* fix issue#10 `Workflow::create_workflow_diagram` documentation and path
|
74
|
+
escaping
|
75
|
+
* fix issue#7 workflow_column does not work STI (single table
|
76
|
+
inheritance) ActiveRecord models
|
77
|
+
* fix issue#5 Diagram generation fails for models in modules
|
78
|
+
|
79
|
+
### New in the version 0.6.0
|
80
|
+
|
81
|
+
* enable multiple workflows by connecting workflow to object instances
|
82
|
+
(using metaclass) instead of connecting to a class, s. "Multiple
|
83
|
+
Workflows" section
|
84
|
+
|
85
|
+
### New in the version 0.5.0
|
86
|
+
|
87
|
+
* fix issue#3 change the behaviour of halt! to immediately raise an
|
88
|
+
exception. See also http://github.com/geekq/workflow/issues/#issue/3
|
89
|
+
|
90
|
+
### New in the version 0.4.0
|
91
|
+
|
92
|
+
* completely rewritten the documentation to match my branch
|
93
|
+
* switch to [jeweler][] for building gems
|
94
|
+
* use [gemcutter][] for gem distribution
|
95
|
+
* every described feature is backed up by an automated test
|
96
|
+
|
97
|
+
[jeweler]: http://github.com/technicalpickles/jeweler
|
98
|
+
[gemcutter]: http://gemcutter.org/gems/workflow
|
99
|
+
|
100
|
+
### New in the version 0.3.0
|
101
|
+
|
102
|
+
Intermixing of transition graph definition (states, transitions)
|
103
|
+
on the one side and implementation of the actions on the other side
|
104
|
+
for a bigger state machine can introduce clutter.
|
105
|
+
|
106
|
+
To reduce this clutter it is now possible to use state entry- and
|
107
|
+
exit- hooks defined through a naming convention. For example, if there
|
108
|
+
is a state `:pending`, then instead of using a
|
109
|
+
block:
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
state :pending do
|
113
|
+
on_entry do
|
114
|
+
# your implementation here
|
115
|
+
end
|
116
|
+
end
|
117
|
+
```
|
118
|
+
|
119
|
+
you can hook in by defining method
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
def on_pending_exit(new_state, event, *args)
|
123
|
+
# your implementation here
|
124
|
+
end
|
125
|
+
```
|
126
|
+
|
127
|
+
anywhere in your class. You can also use a simpler function signature
|
128
|
+
like `def on_pending_exit(*args)` if your are not interested in
|
129
|
+
arguments. Please note: `def on_pending_exit()` with an empty list
|
130
|
+
would not work.
|
131
|
+
|
132
|
+
If both a function with a name according to naming convention and the
|
133
|
+
`on_entry`/`on_exit` block are given, then only `on_entry`/`on_exit` block is used.
|
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Lorefnon
|
2
|
+
Copyright (c) 2010-2014 Vladimir Dobriakov
|
3
|
+
Copyright (c) 2008-2009 Vodafone
|
4
|
+
Copyright (c) 2007-2008 Ryan Allen, FlashDen Pty Ltd
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|