statesman 1.0.0.beta2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -3
- data/README.md +2 -0
- data/lib/statesman/adapters/active_record.rb +1 -1
- data/lib/statesman/adapters/active_record_queries.rb +1 -1
- data/lib/statesman/callback.rb +3 -3
- data/lib/statesman/machine.rb +3 -3
- data/lib/statesman/version.rb +1 -1
- data/spec/support/active_record.rb +2 -2
- data/statesman.gemspec +3 -3
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0139bf848dacbe81fcca09b0efcbe931d773125
|
4
|
+
data.tar.gz: ef0b4400a4629ed4bebf641e5161e17b27901485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 514b488888819643db51e1618b2109d6150aab9b4aa2bd7b5f21ac324523a0a4facc6a442e99ef7d486199bc140b9dc53eaa0d1ff0ffa5ed49fb988ac5d1dc06
|
7
|
+
data.tar.gz: 293d1464c01cb538666dc1f84393054209cbd6f0f243e48945bcf8d023b9076b0767805dcb89cf9017b1be23be80bc314e8442fff8c4e6131c891cb103b1d16c
|
data/.rubocop.yml
CHANGED
@@ -10,9 +10,6 @@ AllCops:
|
|
10
10
|
StringLiterals:
|
11
11
|
Enabled: false
|
12
12
|
|
13
|
-
LineEndConcatenation:
|
14
|
-
Enabled: false
|
15
|
-
|
16
13
|
Documentation:
|
17
14
|
Enabled: false
|
18
15
|
|
@@ -24,6 +21,9 @@ MethodLength:
|
|
24
21
|
CountComments: false # count full line comments?
|
25
22
|
Max: 15
|
26
23
|
|
24
|
+
AbcSize:
|
25
|
+
Max: 25
|
26
|
+
|
27
27
|
# Don't require utf-8 encoding comment
|
28
28
|
Encoding:
|
29
29
|
Enabled: false
|
data/README.md
CHANGED
@@ -5,6 +5,8 @@ A statesmanlike state machine library for Ruby 1.9.3 and 2.0.
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/statesman.png)](http://badge.fury.io/rb/statesman)
|
6
6
|
[![Build Status](https://travis-ci.org/gocardless/statesman.png?branch=master)](https://travis-ci.org/gocardless/statesman)
|
7
7
|
[![Code Climate](https://codeclimate.com/github/gocardless/statesman.png)](https://codeclimate.com/github/gocardless/statesman)
|
8
|
+
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/gocardless/statesman?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
9
|
+
|
8
10
|
|
9
11
|
Statesman is a little different from other state machine libraries which tack
|
10
12
|
state behaviour directly onto a model. A statesman state machine is defined as a
|
@@ -28,7 +28,7 @@ module Statesman
|
|
28
28
|
create_transition(from, to, metadata)
|
29
29
|
rescue ::ActiveRecord::RecordNotUnique => e
|
30
30
|
if e.message.include?('sort_key') &&
|
31
|
-
|
31
|
+
e.message.include?(@transition_class.table_name)
|
32
32
|
raise TransitionConflictError, e.message
|
33
33
|
else raise
|
34
34
|
end
|
data/lib/statesman/callback.rb
CHANGED
@@ -28,9 +28,9 @@ module Statesman
|
|
28
28
|
|
29
29
|
def matches(from, to)
|
30
30
|
matches_all_transitions ||
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
matches_to_state(from, to) ||
|
32
|
+
matches_from_state(from, to) ||
|
33
|
+
matches_both_states(from, to)
|
34
34
|
end
|
35
35
|
|
36
36
|
def matches_all_transitions
|
data/lib/statesman/machine.rb
CHANGED
@@ -162,7 +162,7 @@ module Statesman
|
|
162
162
|
|
163
163
|
def validate_initial_state(state)
|
164
164
|
unless initial_state.nil?
|
165
|
-
raise InvalidStateError, "Cannot set initial state to '#{state}', "
|
165
|
+
raise InvalidStateError, "Cannot set initial state to '#{state}', " \
|
166
166
|
"already defined as #{initial_state}."
|
167
167
|
end
|
168
168
|
end
|
@@ -182,8 +182,8 @@ module Statesman
|
|
182
182
|
})
|
183
183
|
@object = object
|
184
184
|
@transition_class = options[:transition_class]
|
185
|
-
@storage_adapter = adapter_class(@transition_class)
|
186
|
-
|
185
|
+
@storage_adapter = adapter_class(@transition_class).new(
|
186
|
+
@transition_class, object, self)
|
187
187
|
send(:after_initialize) if respond_to? :after_initialize
|
188
188
|
end
|
189
189
|
|
data/lib/statesman/version.rb
CHANGED
@@ -18,8 +18,8 @@ class MyActiveRecordModel < ActiveRecord::Base
|
|
18
18
|
has_many :my_active_record_model_transitions
|
19
19
|
|
20
20
|
def state_machine
|
21
|
-
@state_machine ||= MyStateMachine
|
22
|
-
|
21
|
+
@state_machine ||= MyStateMachine.new(
|
22
|
+
self, transition_class: MyActiveRecordModelTransition)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
data/statesman.gemspec
CHANGED
@@ -21,10 +21,10 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec", "~> 3.1"
|
24
|
-
spec.add_development_dependency "rspec-its", "~> 1.
|
24
|
+
spec.add_development_dependency "rspec-its", "~> 1.1"
|
25
25
|
spec.add_development_dependency "guard-rspec", "~> 4.3"
|
26
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
27
|
-
spec.add_development_dependency "guard-rubocop", "~> 1.
|
26
|
+
spec.add_development_dependency "rubocop", "~> 0.27"
|
27
|
+
spec.add_development_dependency "guard-rubocop", "~> 1.2"
|
28
28
|
spec.add_development_dependency "sqlite3", "~> 1.3"
|
29
29
|
spec.add_development_dependency "mongoid", "~> 4.0"
|
30
30
|
spec.add_development_dependency "activerecord", "~> 4.1"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statesman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Marr
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -59,14 +59,14 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - ~>
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '1.
|
62
|
+
version: '1.1'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '1.
|
69
|
+
version: '1.1'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: guard-rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,28 +87,28 @@ dependencies:
|
|
87
87
|
requirements:
|
88
88
|
- - ~>
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '0.
|
90
|
+
version: '0.27'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - ~>
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0.
|
97
|
+
version: '0.27'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: guard-rubocop
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - ~>
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '1.
|
104
|
+
version: '1.2'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - ~>
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '1.
|
111
|
+
version: '1.2'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: sqlite3
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,9 +240,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
240
240
|
version: '0'
|
241
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
242
|
requirements:
|
243
|
-
- - '
|
243
|
+
- - '>='
|
244
244
|
- !ruby/object:Gem::Version
|
245
|
-
version:
|
245
|
+
version: '0'
|
246
246
|
requirements: []
|
247
247
|
rubyforge_project:
|
248
248
|
rubygems_version: 2.4.1
|
@@ -268,3 +268,4 @@ test_files:
|
|
268
268
|
- spec/support/active_record.rb
|
269
269
|
- spec/support/generators_shared_examples.rb
|
270
270
|
- spec/support/mongoid.rb
|
271
|
+
has_rdoc:
|