workflow 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f18fc03de3bf2f6eb79eb323a81ef12cc69f8d7eca47d8dea3f73e2678ce1ed
4
- data.tar.gz: af0214cc0f64dd31c06035f36510eceab3a8540d142286e41f7497fa91f6117f
3
+ metadata.gz: 4834f20238e73dbf0304747da6f098612e395c92a6b839908c7c0a613ad272b8
4
+ data.tar.gz: 40a8fa57362ed445be012847fe283db2b417225ea3db4ea4c02bcad957630b57
5
5
  SHA512:
6
- metadata.gz: 9454c54bb658d0cdec0208607314b5cdfbe5682ce958c6f4fcc22d8bf99e924181b933016ca00bd3f5d1e11f3e0ff869ee8aea5a5f09cb9fbe353a93cb2a6bd7
7
- data.tar.gz: c150bce69ed8d8dce936b364fadbb9ff223e976f8ab50c50aa3d41d25d5eae0ca4f00fe91e3c4a86001f9556f4c2ccb5c34398ca2ecdf2d1fbce37fc838e190f
6
+ metadata.gz: 9cb4cd4a9738529cdffc867d04716dbe0bce0df361e84fe55570563624441728e41d2bfec5639cbae6e64dbcf86f047abd73adb542140cb0ecdf92f92be39237
7
+ data.tar.gz: 1cbbddb5014d83e9ace2b03e2d5e60cf01acbc8f1579d942b68267d144b3513f01fb23797219450e44aca85ae476e4675d57e97fcb149043be16d951c17608c1
@@ -415,11 +415,6 @@ logging then you can use the universal `on_transition` hook:
415
415
  end
416
416
  end
417
417
 
418
- Please also have a look at the [advanced end to end
419
- example][advanced_hooks_and_validation_test].
420
-
421
- [advanced_hooks_and_validation_test]: http://github.com/geekq/workflow/blob/master/test/advanced_hooks_and_validation_test.rb
422
-
423
418
  ### on_error
424
419
 
425
420
  If you want to do custom exception handling internal to workflow, you can define an `on_error` hook in your workflow.
@@ -503,6 +498,10 @@ Development Setup
503
498
  Changelog
504
499
  ---------
505
500
 
501
+ ### New in the version 2.0.2
502
+
503
+ * finalize extraction of persistence adapters, remove remodel adapter
504
+
506
505
  ### New in the version 2.0.1
507
506
 
508
507
  * retire Ruby 2.3 since it has reached end of live
@@ -1,7 +1,6 @@
1
1
  require 'rubygems'
2
2
 
3
3
  require 'workflow/specification'
4
- require 'workflow/adapters/remodel'
5
4
 
6
5
  # See also README.markdown for documentation
7
6
  module Workflow
@@ -1,3 +1,3 @@
1
1
  module Workflow
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dobriakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-11 00:00:00.000000000 Z
11
+ date: 2019-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -95,13 +95,13 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.2'
97
97
  description: |
98
- Workflow is a finite-state-machine-inspired API for modeling and interacting
99
- with what we tend to refer to as 'workflow'.
98
+ Workflow is a finite-state-machine-inspired API for modeling and
99
+ interacting with what we tend to refer to as 'workflow'.
100
100
 
101
- * nice DSL to describe your states, events and transitions
102
- * various hooks for single transitions, entering state etc.
103
- * convenient access to the workflow specification: list states, possible events
104
- for particular state
101
+ * nice DSL to describe your states, events and transitions
102
+ * various hooks for single transitions, entering state etc.
103
+ * convenient access to the workflow specification: list states, possible events
104
+ for particular state
105
105
  email:
106
106
  - vladimir@geekq.net
107
107
  executables: []
@@ -111,8 +111,6 @@ extra_rdoc_files:
111
111
  files:
112
112
  - README.markdown
113
113
  - lib/workflow.rb
114
- - lib/workflow/adapters/active_record.rb
115
- - lib/workflow/adapters/remodel.rb
116
114
  - lib/workflow/draw.rb
117
115
  - lib/workflow/errors.rb
118
116
  - lib/workflow/event.rb
@@ -120,7 +118,7 @@ files:
120
118
  - lib/workflow/specification.rb
121
119
  - lib/workflow/state.rb
122
120
  - lib/workflow/version.rb
123
- homepage: http://www.geekq.net/workflow/
121
+ homepage: https://github.com/geekq/workflow
124
122
  licenses:
125
123
  - MIT
126
124
  metadata: {}
@@ -139,8 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
137
  - !ruby/object:Gem::Version
140
138
  version: '0'
141
139
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.7.6
140
+ rubygems_version: 3.0.1
144
141
  signing_key:
145
142
  specification_version: 4
146
143
  summary: A replacement for acts_as_state_machine.
@@ -1,71 +0,0 @@
1
- module Workflow
2
- module Adapter
3
- module ActiveRecord
4
- def self.included(klass)
5
- klass.send :include, Adapter::ActiveRecord::InstanceMethods
6
- klass.send :extend, Adapter::ActiveRecord::Scopes
7
- klass.before_validation :write_initial_state
8
- end
9
-
10
- module InstanceMethods
11
- def load_workflow_state
12
- read_attribute(self.class.workflow_column)
13
- end
14
-
15
- # On transition the new workflow state is immediately saved in the
16
- # database.
17
- def persist_workflow_state(new_value)
18
- # Rails 3.1 or newer
19
- update_column self.class.workflow_column, new_value
20
- end
21
-
22
- private
23
-
24
- # Motivation: even if NULL is stored in the workflow_state database column,
25
- # the current_state is correctly recognized in the Ruby code. The problem
26
- # arises when you want to SELECT records filtering by the value of initial
27
- # state. That's why it is important to save the string with the name of the
28
- # initial state in all the new records.
29
- def write_initial_state
30
- write_attribute self.class.workflow_column, current_state.to_s
31
- end
32
- end
33
-
34
- # This module will automatically generate ActiveRecord scopes based on workflow states.
35
- # The name of each generated scope will be something like `with_<state_name>_state`
36
- #
37
- # Examples:
38
- #
39
- # Article.with_pending_state # => ActiveRecord::Relation
40
- # Payment.without_refunded_state # => ActiveRecord::Relation
41
- #`
42
- # Example above just adds `where(:state_column_name => 'pending')` or
43
- # `where.not(:state_column_name => 'pending')` to AR query and returns
44
- # ActiveRecord::Relation.
45
- module Scopes
46
- def self.extended(object)
47
- class << object
48
- alias_method :workflow_without_scopes, :workflow unless method_defined?(:workflow_without_scopes)
49
- alias_method :workflow, :workflow_with_scopes
50
- end
51
- end
52
-
53
- def workflow_with_scopes(&specification)
54
- workflow_without_scopes(&specification)
55
- states = workflow_spec.states.values
56
-
57
- states.each do |state|
58
- define_singleton_method("with_#{state}_state") do
59
- where("#{table_name}.#{self.workflow_column.to_sym} = ?", state.to_s)
60
- end
61
-
62
- define_singleton_method("without_#{state}_state") do
63
- where.not("#{table_name}.#{self.workflow_column.to_sym} = ?", state.to_s)
64
- end
65
- end
66
- end
67
-
68
- end
69
- end
70
- end
71
- end
@@ -1,15 +0,0 @@
1
- module Workflow
2
- module Adapter
3
- module Remodel
4
- module InstanceMethods
5
- def load_workflow_state
6
- send(self.class.workflow_column)
7
- end
8
-
9
- def persist_workflow_state(new_value)
10
- update(self.class.workflow_column => new_value)
11
- end
12
- end
13
- end
14
- end
15
- end