workflow 0.8.0 → 0.8.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.
- data/README.markdown +9 -2
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/workflow.rb +2 -2
- data/workflow.gemspec +59 -0
- metadata +8 -15
- data/.gitignore +0 -8
data/README.markdown
CHANGED
|
@@ -48,6 +48,10 @@ Here is the expression of this workflow using the API:
|
|
|
48
48
|
|
|
49
49
|
Nice, isn't it!
|
|
50
50
|
|
|
51
|
+
Note: the first state in the definition (`:new` in the example, but you
|
|
52
|
+
can name it as you wish) is used as the initial state - newly created
|
|
53
|
+
objects start their life cycle in that state.
|
|
54
|
+
|
|
51
55
|
Let's create an article instance and check in which state it is:
|
|
52
56
|
|
|
53
57
|
article = Article.new
|
|
@@ -91,8 +95,11 @@ Ruby 1.9
|
|
|
91
95
|
--------
|
|
92
96
|
|
|
93
97
|
Workflow gem does not work with some (but very widespread) Ruby 1.9
|
|
94
|
-
builds due to a known bug in Ruby 1.9. Either
|
|
95
|
-
|
|
98
|
+
builds due to a known bug in Ruby 1.9. Either
|
|
99
|
+
|
|
100
|
+
* use newer ruby build, 1.9.2-p136 and -p180 tested to work
|
|
101
|
+
* or compile your Ruby 1.9 from source
|
|
102
|
+
* or [comment out some lines in workflow](http://github.com/geekq/workflow/issues#issue/6)
|
|
96
103
|
(reduces functionality).
|
|
97
104
|
|
|
98
105
|
Examples
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.8.
|
|
1
|
+
0.8.1
|
data/lib/workflow.rb
CHANGED
|
@@ -134,7 +134,7 @@ module Workflow
|
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
define_method "can_#{event_name}?" do
|
|
137
|
-
return self.current_state.events.include?
|
|
137
|
+
return self.current_state.events.include?(event_name)
|
|
138
138
|
end
|
|
139
139
|
end
|
|
140
140
|
end
|
|
@@ -174,7 +174,7 @@ module Workflow
|
|
|
174
174
|
from = current_state
|
|
175
175
|
to = spec.states[event.transitions_to]
|
|
176
176
|
|
|
177
|
-
run_before_transition(
|
|
177
|
+
run_before_transition(from, to, name, *args)
|
|
178
178
|
return false if @halted
|
|
179
179
|
|
|
180
180
|
return_value = run_action(event.action, *args) || run_action_callback(event.name, *args)
|
data/workflow.gemspec
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = %q{workflow}
|
|
8
|
+
s.version = "0.8.1"
|
|
9
|
+
|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
+
s.authors = ["Vladimir Dobriakov"]
|
|
12
|
+
s.date = %q{2011-08-20}
|
|
13
|
+
s.description = %q{ Workflow is a finite-state-machine-inspired API for modeling and interacting
|
|
14
|
+
with what we tend to refer to as 'workflow'.
|
|
15
|
+
|
|
16
|
+
* nice DSL to describe your states, events and transitions
|
|
17
|
+
* robust integration with ActiveRecord and non relational data stores
|
|
18
|
+
* various hooks for single transitions, entering state etc.
|
|
19
|
+
* convenient access to the workflow specification: list states, possible events
|
|
20
|
+
for particular state
|
|
21
|
+
}
|
|
22
|
+
s.email = %q{vladimir@geekq.net}
|
|
23
|
+
s.extra_rdoc_files = [
|
|
24
|
+
"README.markdown"
|
|
25
|
+
]
|
|
26
|
+
s.files = [
|
|
27
|
+
"MIT-LICENSE",
|
|
28
|
+
"README.markdown",
|
|
29
|
+
"Rakefile",
|
|
30
|
+
"VERSION",
|
|
31
|
+
"lib/workflow.rb",
|
|
32
|
+
"test/advanced_hooks_and_validation_test.rb",
|
|
33
|
+
"test/before_transition_test.rb",
|
|
34
|
+
"test/couchtiny_example.rb",
|
|
35
|
+
"test/main_test.rb",
|
|
36
|
+
"test/multiple_workflows_test.rb",
|
|
37
|
+
"test/readme_example.rb",
|
|
38
|
+
"test/test_helper.rb",
|
|
39
|
+
"test/without_active_record_test.rb",
|
|
40
|
+
"workflow.gemspec",
|
|
41
|
+
"workflow.rb"
|
|
42
|
+
]
|
|
43
|
+
s.homepage = %q{http://www.geekq.net/workflow/}
|
|
44
|
+
s.require_paths = ["lib"]
|
|
45
|
+
s.rubyforge_project = %q{workflow}
|
|
46
|
+
s.rubygems_version = %q{1.3.6}
|
|
47
|
+
s.summary = %q{A replacement for acts_as_state_machine.}
|
|
48
|
+
|
|
49
|
+
if s.respond_to? :specification_version then
|
|
50
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
51
|
+
s.specification_version = 3
|
|
52
|
+
|
|
53
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
54
|
+
else
|
|
55
|
+
end
|
|
56
|
+
else
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 8
|
|
8
|
-
-
|
|
9
|
-
version: 0.8.
|
|
8
|
+
- 1
|
|
9
|
+
version: 0.8.1
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Vladimir Dobriakov
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date:
|
|
17
|
+
date: 2011-08-20 00:00:00 +02:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies: []
|
|
20
20
|
|
|
@@ -27,7 +27,6 @@ extensions: []
|
|
|
27
27
|
extra_rdoc_files:
|
|
28
28
|
- README.markdown
|
|
29
29
|
files:
|
|
30
|
-
- .gitignore
|
|
31
30
|
- MIT-LICENSE
|
|
32
31
|
- README.markdown
|
|
33
32
|
- Rakefile
|
|
@@ -41,14 +40,15 @@ files:
|
|
|
41
40
|
- test/readme_example.rb
|
|
42
41
|
- test/test_helper.rb
|
|
43
42
|
- test/without_active_record_test.rb
|
|
43
|
+
- workflow.gemspec
|
|
44
44
|
- workflow.rb
|
|
45
45
|
has_rdoc: true
|
|
46
46
|
homepage: http://www.geekq.net/workflow/
|
|
47
47
|
licenses: []
|
|
48
48
|
|
|
49
49
|
post_install_message:
|
|
50
|
-
rdoc_options:
|
|
51
|
-
|
|
50
|
+
rdoc_options: []
|
|
51
|
+
|
|
52
52
|
require_paths:
|
|
53
53
|
- lib
|
|
54
54
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -72,12 +72,5 @@ rubygems_version: 1.3.6
|
|
|
72
72
|
signing_key:
|
|
73
73
|
specification_version: 3
|
|
74
74
|
summary: A replacement for acts_as_state_machine.
|
|
75
|
-
test_files:
|
|
76
|
-
|
|
77
|
-
- test/main_test.rb
|
|
78
|
-
- test/before_transition_test.rb
|
|
79
|
-
- test/test_helper.rb
|
|
80
|
-
- test/without_active_record_test.rb
|
|
81
|
-
- test/multiple_workflows_test.rb
|
|
82
|
-
- test/readme_example.rb
|
|
83
|
-
- test/advanced_hooks_and_validation_test.rb
|
|
75
|
+
test_files: []
|
|
76
|
+
|