workflow 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ class Order < ActiveRecord::Base
14
14
  include Workflow
15
15
  workflow do
16
16
  state :submitted do
17
- event :accept, :transitions_to => :accepted, :meta => {:doc_weight => 8} do |reviewer, args|
17
+ event :accept, :transitions_to => :accepted, :meta => {:weight => 8} do |reviewer, args|
18
18
  end
19
19
  end
20
20
  state :accepted do
@@ -31,7 +31,7 @@ class LegacyOrder < ActiveRecord::Base
31
31
 
32
32
  workflow do
33
33
  state :submitted do
34
- event :accept, :transitions_to => :accepted, :meta => {:doc_weight => 8} do |reviewer, args|
34
+ event :accept, :transitions_to => :accepted, :meta => {:weight => 8} do |reviewer, args|
35
35
  end
36
36
  end
37
37
  state :accepted do
@@ -438,8 +438,9 @@ class MainTest < ActiveRecordTestCase
438
438
  test 'diagram generation' do
439
439
  begin
440
440
  $stdout = StringIO.new('', 'w')
441
- Workflow::create_workflow_diagram(Order, '/tmp')
442
- assert_match(/open.+\.pdf/, $stdout.string,
441
+ require 'workflow/draw'
442
+ Workflow::Draw::workflow_diagram(Order, :path => '/tmp')
443
+ assert_match(/run the following/, $stdout.string,
443
444
  'PDF should be generate and a hint be given to the user.')
444
445
  ensure
445
446
  $stdout = STDOUT
@@ -519,7 +520,7 @@ class MainTest < ActiveRecordTestCase
519
520
  test 'workflow graph generation' do
520
521
  Dir.chdir('/tmp') do
521
522
  capture_streams do
522
- Workflow::create_workflow_diagram(Order, '/tmp')
523
+ Workflow::Draw::workflow_diagram(Order, :path => '/tmp')
523
524
  end
524
525
  end
525
526
  end
@@ -527,7 +528,7 @@ class MainTest < ActiveRecordTestCase
527
528
  test 'workflow graph generation in a path with spaces' do
528
529
  `mkdir -p '/tmp/Workflow test'`
529
530
  capture_streams do
530
- Workflow::create_workflow_diagram(Order, '/tmp/Workflow test')
531
+ Workflow::Draw::workflow_diagram(Order, :path => '/tmp/Workflow test')
531
532
  end
532
533
  end
533
534
 
@@ -5,7 +5,7 @@ class ComparableStatesOrder
5
5
  include Workflow
6
6
  workflow do
7
7
  state :submitted do
8
- event :accept, :transitions_to => :accepted, :meta => {:doc_weight => 8} do |reviewer, args|
8
+ event :accept, :transitions_to => :accepted, :meta => {:weight => 8} do |reviewer, args|
9
9
  end
10
10
  end
11
11
  state :accepted do
@@ -21,6 +21,7 @@ class CompareStatesTest < Test::Unit::TestCase
21
21
  o = ComparableStatesOrder.new
22
22
  o.accept!
23
23
  assert_equal :accepted, o.current_state.name
24
+ assert o.current_state == :accepted
24
25
  assert o.current_state < :shipped
25
26
  assert o.current_state > :submitted
26
27
  assert_raise ArgumentError do
@@ -27,5 +27,6 @@ Gem::Specification.new do |gem|
27
27
  gem.add_development_dependency 'sqlite3'
28
28
  gem.add_development_dependency 'mocha'
29
29
  gem.add_development_dependency 'rake'
30
+ gem.add_development_dependency 'ruby-graphviz', ['>= 1.0']
30
31
  end
31
32
 
metadata CHANGED
@@ -1,88 +1,122 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Vladimir Dobriakov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-28 00:00:00.000000000 Z
11
+ date: 2014-01-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rdoc
16
- requirement: &7744380 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.12'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *7744380
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '3.12'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: bundler
27
- requirement: &7771320 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: 1.0.0
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *7771320
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: activerecord
38
- requirement: &7767500 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *7767500
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: sqlite3
49
- requirement: &7789480 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *7789480
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: mocha
60
- requirement: &7788080 !ruby/object:Gem::Requirement
61
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
62
72
  requirements:
63
- - - ! '>='
73
+ - - '>='
64
74
  - !ruby/object:Gem::Version
65
75
  version: '0'
66
76
  type: :development
67
77
  prerelease: false
68
- version_requirements: *7788080
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rake
71
- requirement: &7784180 !ruby/object:Gem::Requirement
72
- none: false
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
73
93
  requirements:
74
- - - ! '>='
94
+ - - '>='
75
95
  - !ruby/object:Gem::Version
76
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: ruby-graphviz
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '1.0'
77
104
  type: :development
78
105
  prerelease: false
79
- version_requirements: *7784180
80
- description: ! " Workflow is a finite-state-machine-inspired API for modeling and
81
- interacting\n with what we tend to refer to as 'workflow'.\n\n * nice DSL
82
- to describe your states, events and transitions\n * robust integration with ActiveRecord
83
- and non relational data stores\n * various hooks for single transitions, entering
84
- state etc.\n * convenient access to the workflow specification: list states,
85
- possible events\n for particular state\n"
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '1.0'
111
+ description: |2
112
+ Workflow is a finite-state-machine-inspired API for modeling and interacting
113
+ with what we tend to refer to as 'workflow'.
114
+
115
+ * nice DSL to describe your states, events and transitions
116
+ * robust integration with ActiveRecord and non relational data stores
117
+ * various hooks for single transitions, entering state etc.
118
+ * convenient access to the workflow specification: list states, possible events
119
+ for particular state
86
120
  email:
87
121
  - vladimir@geekq.net
88
122
  executables: []
@@ -97,13 +131,25 @@ files:
97
131
  - README.markdown
98
132
  - Rakefile
99
133
  - gemfiles/Gemfile.rails-2.3.x
134
+ - gemfiles/Gemfile.rails-3.x
135
+ - gemfiles/Gemfile.rails-edge
100
136
  - lib/workflow.rb
137
+ - lib/workflow/adapters/active_record.rb
138
+ - lib/workflow/adapters/remodel.rb
139
+ - lib/workflow/draw.rb
140
+ - lib/workflow/errors.rb
141
+ - lib/workflow/event.rb
142
+ - lib/workflow/specification.rb
143
+ - lib/workflow/state.rb
101
144
  - lib/workflow/version.rb
145
+ - orders_workflow.png
146
+ - test/active_record_scopes_test.rb
102
147
  - test/advanced_examples_test.rb
103
148
  - test/advanced_hooks_and_validation_test.rb
104
149
  - test/attr_protected_test.rb
105
150
  - test/before_transition_test.rb
106
151
  - test/couchtiny_example.rb
152
+ - test/inheritance_test.rb
107
153
  - test/main_test.rb
108
154
  - test/multiple_workflows_test.rb
109
155
  - test/new_versions/compare_states_test.rb
@@ -113,43 +159,37 @@ files:
113
159
  - test/test_helper.rb
114
160
  - test/without_active_record_test.rb
115
161
  - workflow.gemspec
116
- - workflow.rb
117
162
  homepage: http://www.geekq.net/workflow/
118
163
  licenses: []
164
+ metadata: {}
119
165
  post_install_message:
120
166
  rdoc_options: []
121
167
  require_paths:
122
168
  - lib
123
169
  required_ruby_version: !ruby/object:Gem::Requirement
124
- none: false
125
170
  requirements:
126
- - - ! '>='
171
+ - - '>='
127
172
  - !ruby/object:Gem::Version
128
173
  version: '0'
129
- segments:
130
- - 0
131
- hash: 666989584691565007
132
174
  required_rubygems_version: !ruby/object:Gem::Requirement
133
- none: false
134
175
  requirements:
135
- - - ! '>='
176
+ - - '>='
136
177
  - !ruby/object:Gem::Version
137
178
  version: '0'
138
- segments:
139
- - 0
140
- hash: 666989584691565007
141
179
  requirements: []
142
180
  rubyforge_project:
143
- rubygems_version: 1.8.10
181
+ rubygems_version: 2.0.0
144
182
  signing_key:
145
- specification_version: 3
183
+ specification_version: 4
146
184
  summary: A replacement for acts_as_state_machine.
147
185
  test_files:
186
+ - test/active_record_scopes_test.rb
148
187
  - test/advanced_examples_test.rb
149
188
  - test/advanced_hooks_and_validation_test.rb
150
189
  - test/attr_protected_test.rb
151
190
  - test/before_transition_test.rb
152
191
  - test/couchtiny_example.rb
192
+ - test/inheritance_test.rb
153
193
  - test/main_test.rb
154
194
  - test/multiple_workflows_test.rb
155
195
  - test/new_versions/compare_states_test.rb
@@ -1 +0,0 @@
1
- Dir["#{File.dirname(__FILE__)}/lib/*.rb"].each { |rb| require rb }