state_machines-activemodel 0.8.0 → 0.10.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 +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +8 -26
- data/lib/state_machines/integrations/active_model/locale.rb +2 -0
- data/lib/state_machines/integrations/active_model/version.rb +3 -1
- data/lib/state_machines/integrations/active_model.rb +34 -81
- data/lib/state_machines-activemodel.rb +2 -0
- data/test/integration_test.rb +3 -1
- data/test/machine_by_default_test.rb +3 -1
- data/test/machine_errors_test.rb +3 -1
- data/test/machine_multiple_test.rb +3 -1
- data/test/machine_with_callbacks_test.rb +3 -1
- data/test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb +3 -1
- data/test/machine_with_dirty_attribute_and_state_events_test.rb +3 -1
- data/test/machine_with_dirty_attributes_and_custom_attribute_test.rb +3 -1
- data/test/machine_with_dirty_attributes_during_loopback_test.rb +3 -1
- data/test/machine_with_dirty_attributes_test.rb +3 -1
- data/test/machine_with_dynamic_initial_state_test.rb +3 -1
- data/test/machine_with_events_test.rb +3 -1
- data/test/machine_with_failed_after_callbacks_test.rb +3 -1
- data/test/machine_with_failed_before_callbacks_test.rb +3 -1
- data/test/machine_with_initialized_aliased_attribute_test.rb +35 -0
- data/test/machine_with_initialized_state_test.rb +3 -1
- data/test/machine_with_internationalization_test.rb +3 -1
- data/test/machine_with_model_state_attribute_test.rb +3 -1
- data/test/machine_with_non_model_state_attribute_undefined_test.rb +3 -1
- data/test/machine_with_state_driven_validations_test.rb +4 -2
- data/test/machine_with_states_test.rb +3 -1
- data/test/machine_with_static_initial_state_test.rb +3 -1
- data/test/machine_with_validations_and_custom_attribute_test.rb +3 -1
- data/test/machine_with_validations_test.rb +3 -1
- data/test/test_helper.rb +6 -7
- metadata +10 -24
- data/.gitignore +0 -22
- data/.travis.yml +0 -21
- data/Appraisals +0 -20
- data/Gemfile +0 -8
- data/Rakefile +0 -9
- data/gemfiles/active_model_5.1.gemfile +0 -11
- data/gemfiles/active_model_5.2.gemfile +0 -11
- data/gemfiles/active_model_6.0.gemfile +0 -11
- data/gemfiles/active_model_6.1.gemfile +0 -11
- data/gemfiles/active_model_edge.gemfile +0 -11
- data/state_machines-activemodel.gemspec +0 -28
- data/test/files/en.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a37766e74933c9b284c1bea7acc586937d437222fb51371a12118cb9c28873c
|
4
|
+
data.tar.gz: 05d7748697762082b5cd5c6a388cfbcdb62d7f54bdaf656587c7cdc9158b78f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49059888466d7e77da042aa4d3b296d029d3bbaf600ef70cf514322a04c14211460527444d08fd591a8b3e38a3039b1119c3c719d06bdc6363ab03dadf83b7c0
|
7
|
+
data.tar.gz: 787f045227838e8ce24c6b5448d991631ef1a35c90f078582f8f2fff66470760d90d0c05f2bc56c174dcb93f4c4662b137100d06ff27e44aefca98a4d4b7f11e
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+

|
2
2
|
[](https://codeclimate.com/github/state-machines/state_machines-activemodel)
|
3
3
|
|
4
4
|
# StateMachines ActiveModel Integration
|
@@ -23,7 +23,7 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Dependencies
|
25
25
|
|
26
|
-
Active Model
|
26
|
+
Active Model 7.1+
|
27
27
|
|
28
28
|
## Usage
|
29
29
|
|
@@ -36,19 +36,19 @@ class Vehicle
|
|
36
36
|
attr_accessor :state
|
37
37
|
define_attribute_methods [:state]
|
38
38
|
|
39
|
-
state_machine :
|
40
|
-
before_transition :
|
41
|
-
after_transition any
|
39
|
+
state_machine initial: :parked do
|
40
|
+
before_transition parked: any - :parked, do: :put_on_seatbelt
|
41
|
+
after_transition any: :parked do |vehicle, transition|
|
42
42
|
vehicle.seatbelt = 'off'
|
43
43
|
end
|
44
44
|
around_transition :benchmark
|
45
45
|
|
46
|
-
event :
|
47
|
-
transition :
|
46
|
+
event ignite: do
|
47
|
+
transition parked: :idling
|
48
48
|
end
|
49
49
|
|
50
50
|
state :first_gear, :second_gear do
|
51
|
-
|
51
|
+
validates :seatbelt_on, presence: true
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -62,24 +62,6 @@ class Vehicle
|
|
62
62
|
...
|
63
63
|
end
|
64
64
|
end
|
65
|
-
|
66
|
-
class VehicleObserver < ActiveModel::Observer
|
67
|
-
# Callback for :ignite event *before* the transition is performed
|
68
|
-
def before_ignite(vehicle, transition)
|
69
|
-
# log message
|
70
|
-
end
|
71
|
-
|
72
|
-
# Generic transition callback *after* the transition is performed
|
73
|
-
def after_transition(vehicle, transition)
|
74
|
-
Audit.log(vehicle, transition)
|
75
|
-
end
|
76
|
-
|
77
|
-
# Generic callback after the transition fails to perform
|
78
|
-
def after_failure_to_transition(vehicle, transition)
|
79
|
-
Audit.error(vehicle, transition)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
65
|
```
|
84
66
|
|
85
67
|
## Contributing
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_model'
|
2
4
|
require 'active_support/core_ext/hash/keys'
|
3
|
-
require 'active_support/core_ext/module/attribute_accessors
|
5
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
4
6
|
require 'state_machines'
|
5
7
|
require 'state_machines/integrations/base'
|
6
8
|
require 'state_machines/integrations/active_model/version'
|
@@ -25,9 +27,9 @@ module StateMachines
|
|
25
27
|
# attr_accessor :state
|
26
28
|
# define_attribute_methods [:state]
|
27
29
|
#
|
28
|
-
# state_machine :
|
30
|
+
# state_machine initial: :parked do
|
29
31
|
# event :ignite do
|
30
|
-
# transition :
|
32
|
+
# transition parked: :idling
|
31
33
|
# end
|
32
34
|
# end
|
33
35
|
# end
|
@@ -45,7 +47,7 @@ module StateMachines
|
|
45
47
|
# include ActiveModel::Validations
|
46
48
|
# attr_accessor :state
|
47
49
|
#
|
48
|
-
# state_machine :
|
50
|
+
# state_machine action: :save do
|
49
51
|
# ...
|
50
52
|
# end
|
51
53
|
#
|
@@ -83,7 +85,7 @@ module StateMachines
|
|
83
85
|
# state_machine do
|
84
86
|
# ...
|
85
87
|
# state :first_gear, :second_gear do
|
86
|
-
# validate {|vehicle| vehicle.speed_is_legal}
|
88
|
+
# validate { |vehicle| vehicle.speed_is_legal }
|
87
89
|
# end
|
88
90
|
# end
|
89
91
|
# end
|
@@ -115,38 +117,44 @@ module StateMachines
|
|
115
117
|
# Beware that public event attributes mean that events can be fired
|
116
118
|
# whenever mass-assignment is being used. If you want to prevent malicious
|
117
119
|
# users from tampering with events through URLs / forms, the attribute
|
118
|
-
# should be protected
|
120
|
+
# should be protected using Strong Parameters in your controllers:
|
119
121
|
#
|
120
122
|
# class Vehicle
|
121
|
-
# include ActiveModel::MassAssignmentSecurity
|
122
123
|
# attr_accessor :state
|
123
124
|
#
|
124
|
-
# attr_protected :state_event
|
125
|
-
# # attr_accessible ... # Alternative technique
|
126
|
-
#
|
127
125
|
# state_machine do
|
128
126
|
# ...
|
129
127
|
# end
|
130
128
|
# end
|
131
129
|
#
|
130
|
+
# # In your controller
|
131
|
+
# def vehicle_params
|
132
|
+
# params.require(:vehicle).permit(:attribute1, :attribute2) # Exclude :state_event
|
133
|
+
# end
|
134
|
+
#
|
132
135
|
# If you want to only have *some* events be able to fire via mass-assignment,
|
133
|
-
# you can build two state machines (one
|
136
|
+
# you can build two state machines (one private and one public) like so:
|
134
137
|
#
|
135
138
|
# class Vehicle
|
136
139
|
# attr_accessor :state
|
137
140
|
#
|
138
|
-
# attr_protected :state_event # Prevent access to events in the first machine
|
139
|
-
#
|
140
141
|
# state_machine do
|
141
142
|
# # Define private events here
|
142
143
|
# end
|
143
144
|
#
|
144
145
|
# # Public machine targets the same state as the private machine
|
145
|
-
# state_machine :public_state, :
|
146
|
+
# state_machine :public_state, attribute: :state do
|
146
147
|
# # Define public events here
|
147
148
|
# end
|
148
149
|
# end
|
149
150
|
#
|
151
|
+
# # In your controller
|
152
|
+
# def vehicle_params
|
153
|
+
# # Only permit events from the public state machine
|
154
|
+
# params.require(:vehicle).permit(:attribute1, :attribute2, :public_state_event)
|
155
|
+
# # The private state_event is not permitted
|
156
|
+
# end
|
157
|
+
#
|
150
158
|
# == Callbacks
|
151
159
|
#
|
152
160
|
# All before/after transition callbacks defined for ActiveModel models
|
@@ -159,7 +167,7 @@ module StateMachines
|
|
159
167
|
# include ActiveModel::Validations
|
160
168
|
# attr_accessor :state
|
161
169
|
#
|
162
|
-
# state_machine :
|
170
|
+
# state_machine initial: :parked do
|
163
171
|
# before_transition any => :idling do |vehicle|
|
164
172
|
# vehicle.put_on_seatbelt
|
165
173
|
# end
|
@@ -169,7 +177,7 @@ module StateMachines
|
|
169
177
|
# end
|
170
178
|
#
|
171
179
|
# event :ignite do
|
172
|
-
# transition :
|
180
|
+
# transition parked: :idling
|
173
181
|
# end
|
174
182
|
# end
|
175
183
|
#
|
@@ -181,62 +189,6 @@ module StateMachines
|
|
181
189
|
# Note, also, that the transition can be accessed by simply defining
|
182
190
|
# additional arguments in the callback block.
|
183
191
|
#
|
184
|
-
# == Observers
|
185
|
-
#
|
186
|
-
# In order to hook in observer support for your application, the
|
187
|
-
# ActiveModel::Observing feature must be included. Because of the way
|
188
|
-
# ActiveModel observers are designed, there is less flexibility around the
|
189
|
-
# specific transitions that can be hooked in. However, a large number of
|
190
|
-
# hooks *are* supported. For example, if a transition for a object's
|
191
|
-
# +state+ attribute changes the state from +parked+ to +idling+ via the
|
192
|
-
# +ignite+ event, the following observer methods are supported:
|
193
|
-
# * before/after/after_failure_to-_ignite_from_parked_to_idling
|
194
|
-
# * before/after/after_failure_to-_ignite_from_parked
|
195
|
-
# * before/after/after_failure_to-_ignite_to_idling
|
196
|
-
# * before/after/after_failure_to-_ignite
|
197
|
-
# * before/after/after_failure_to-_transition_state_from_parked_to_idling
|
198
|
-
# * before/after/after_failure_to-_transition_state_from_parked
|
199
|
-
# * before/after/after_failure_to-_transition_state_to_idling
|
200
|
-
# * before/after/after_failure_to-_transition_state
|
201
|
-
# * before/after/after_failure_to-_transition
|
202
|
-
#
|
203
|
-
# The following class shows an example of some of these hooks:
|
204
|
-
#
|
205
|
-
# class VehicleObserver < ActiveModel::Observer
|
206
|
-
# # Callback for :ignite event *before* the transition is performed
|
207
|
-
# def before_ignite(vehicle, transition)
|
208
|
-
# # log message
|
209
|
-
# end
|
210
|
-
#
|
211
|
-
# # Callback for :ignite event *after* the transition has been performed
|
212
|
-
# def after_ignite(vehicle, transition)
|
213
|
-
# # put on seatbelt
|
214
|
-
# end
|
215
|
-
#
|
216
|
-
# # Generic transition callback *before* the transition is performed
|
217
|
-
# def after_transition(vehicle, transition)
|
218
|
-
# Audit.log(vehicle, transition)
|
219
|
-
# end
|
220
|
-
#
|
221
|
-
# def after_failure_to_transition(vehicle, transition)
|
222
|
-
# Audit.error(vehicle, transition)
|
223
|
-
# end
|
224
|
-
# end
|
225
|
-
#
|
226
|
-
# More flexible transition callbacks can be defined directly within the
|
227
|
-
# model as described in StateMachine::Machine#before_transition
|
228
|
-
# and StateMachine::Machine#after_transition.
|
229
|
-
#
|
230
|
-
# To define a single observer for multiple state machines:
|
231
|
-
#
|
232
|
-
# class StateMachineObserver < ActiveModel::Observer
|
233
|
-
# observe Vehicle, Switch, Project
|
234
|
-
#
|
235
|
-
# def after_transition(object, transition)
|
236
|
-
# Audit.log(object, transition)
|
237
|
-
# end
|
238
|
-
# end
|
239
|
-
#
|
240
192
|
# == Internationalization
|
241
193
|
#
|
242
194
|
# Any error message that is generated from performing invalid transitions
|
@@ -306,9 +258,9 @@ module StateMachines
|
|
306
258
|
# include ActiveModel::Dirty
|
307
259
|
# attr_accessor :state
|
308
260
|
#
|
309
|
-
# state_machine :
|
261
|
+
# state_machine initial: :parked do
|
310
262
|
# event :park do
|
311
|
-
# transition :
|
263
|
+
# transition parked: :parked, ...
|
312
264
|
# end
|
313
265
|
# end
|
314
266
|
# end
|
@@ -320,7 +272,7 @@ module StateMachines
|
|
320
272
|
#
|
321
273
|
# class Vehicle
|
322
274
|
# ...
|
323
|
-
# state_machine :
|
275
|
+
# state_machine initial: :parked do
|
324
276
|
# before_transition all => same do |vehicle|
|
325
277
|
# vehicle.state_will_change!
|
326
278
|
#
|
@@ -342,7 +294,7 @@ module StateMachines
|
|
342
294
|
# module StateMachine::Integrations::MyORM
|
343
295
|
# include ActiveModel
|
344
296
|
#
|
345
|
-
# mattr_accessor(:defaults) { :
|
297
|
+
# mattr_accessor(:defaults) { { action: :persist } }
|
346
298
|
#
|
347
299
|
# def self.matches?(klass)
|
348
300
|
# defined?(::MyORM::Base) && klass <= ::MyORM::Base
|
@@ -374,10 +326,7 @@ module StateMachines
|
|
374
326
|
def invalidate(object, attribute, message, values = [])
|
375
327
|
if supports_validations?
|
376
328
|
attribute = self.attribute(attribute)
|
377
|
-
options = values.
|
378
|
-
h[key] = value
|
379
|
-
h
|
380
|
-
end
|
329
|
+
options = values.to_h { |key, value| [key, value] }
|
381
330
|
|
382
331
|
default_options = default_error_message_options(object, attribute, message)
|
383
332
|
object.errors.add(attribute, message, **options, **default_options)
|
@@ -387,7 +336,7 @@ module StateMachines
|
|
387
336
|
# Describes the current validation errors on the given object. If none
|
388
337
|
# are specific, then the default error is interpeted as a "halt".
|
389
338
|
def errors_for(object)
|
390
|
-
object.errors.empty? ? 'Transition halted' : object.errors.full_messages
|
339
|
+
object.errors.empty? ? 'Transition halted' : object.errors.full_messages.join(', ')
|
391
340
|
end
|
392
341
|
|
393
342
|
# Resets any errors previously added when invalidating the given object
|
@@ -405,6 +354,10 @@ module StateMachines
|
|
405
354
|
def define_state_initializer
|
406
355
|
define_helper :instance, <<-end_eval, __FILE__, __LINE__ + 1
|
407
356
|
def initialize(params = {})
|
357
|
+
params.transform_keys! do |key|
|
358
|
+
self.class.attribute_aliases[key.to_s] || key.to_s
|
359
|
+
end if self.class.respond_to?(:attribute_aliases)
|
360
|
+
|
408
361
|
self.class.state_machines.initialize_states(self, {}, params) { super }
|
409
362
|
end
|
410
363
|
end_eval
|
data/test/integration_test.rb
CHANGED
data/test/machine_errors_test.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class MachineWithInitializedAliasedAttributeTest < BaseTestCase
|
6
|
+
def test_should_match_original_attribute_value_with_attribute_methods
|
7
|
+
model = new_model do
|
8
|
+
include ActiveModel::AttributeMethods
|
9
|
+
alias_attribute :custom_status, :state
|
10
|
+
end
|
11
|
+
|
12
|
+
machine = StateMachines::Machine.new(model, initial: :parked, integration: :active_model)
|
13
|
+
machine.other_states(:started)
|
14
|
+
|
15
|
+
record = model.new(custom_status: 'started')
|
16
|
+
|
17
|
+
refute record.state?(:parked)
|
18
|
+
assert record.state?(:started)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_not_match_original_attribute_value_without_attribute_methods
|
22
|
+
model = new_model do
|
23
|
+
alias_attribute :custom_status, :state
|
24
|
+
end
|
25
|
+
|
26
|
+
machine = StateMachines::Machine.new(model, initial: :parked, integration: :active_model)
|
27
|
+
machine.other_states(:started)
|
28
|
+
|
29
|
+
record = model.new(custom_status: 'started')
|
30
|
+
|
31
|
+
assert record.state?(:parked)
|
32
|
+
refute record.state?(:started)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
|
3
5
|
class MachineWithStateDrivenValidationsTest < BaseTestCase
|
4
6
|
def setup
|
@@ -9,7 +11,7 @@ class MachineWithStateDrivenValidationsTest < BaseTestCase
|
|
9
11
|
|
10
12
|
@machine = StateMachines::Machine.new(@model)
|
11
13
|
@machine.state :first_gear, :second_gear do
|
12
|
-
|
14
|
+
validates :seatbelt, presence: true
|
13
15
|
end
|
14
16
|
@machine.other_states :parked
|
15
17
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'debug'
|
5
4
|
|
6
5
|
require 'state_machines-activemodel'
|
7
6
|
require 'minitest/autorun'
|
@@ -10,16 +9,16 @@ require 'active_support/all'
|
|
10
9
|
Minitest::Reporters.use! [Minitest::Reporters::ProgressReporter.new]
|
11
10
|
I18n.enforce_available_locales = true
|
12
11
|
|
13
|
-
class BaseTestCase <
|
12
|
+
class BaseTestCase < ActiveSupport::TestCase
|
14
13
|
protected
|
15
14
|
# Creates a new ActiveModel model (and the associated table)
|
16
15
|
def new_model(&block)
|
17
16
|
# Simple ActiveModel superclass
|
18
17
|
parent = Class.new do
|
19
18
|
def self.model_attribute(name)
|
20
|
-
define_method(name) { instance_variable_defined?("@#{name}") ? instance_variable_get("@#{name}") : nil }
|
19
|
+
define_method(name) { instance_variable_defined?(:"@#{name}") ? instance_variable_get(:"@#{name}") : nil }
|
21
20
|
define_method("#{name}=") do |value|
|
22
|
-
send("#{name}_will_change!") if self.class <= ActiveModel::Dirty && value != send(name)
|
21
|
+
send(:"#{name}_will_change!") if self.class <= ActiveModel::Dirty && value != send(name)
|
23
22
|
instance_variable_set("@#{name}", value)
|
24
23
|
end
|
25
24
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_machines-activemodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
8
8
|
- Aaron Pfeifer
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: state_machines
|
@@ -17,28 +16,28 @@ dependencies:
|
|
17
16
|
requirements:
|
18
17
|
- - ">="
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
19
|
+
version: 0.10.0
|
21
20
|
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - ">="
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
26
|
+
version: 0.10.0
|
28
27
|
- !ruby/object:Gem::Dependency
|
29
28
|
name: activemodel
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
31
|
- - ">="
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
33
|
+
version: '7.1'
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
38
|
- - ">="
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
40
|
+
version: '7.1'
|
42
41
|
- !ruby/object:Gem::Dependency
|
43
42
|
name: bundler
|
44
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,24 +116,12 @@ executables: []
|
|
117
116
|
extensions: []
|
118
117
|
extra_rdoc_files: []
|
119
118
|
files:
|
120
|
-
- ".gitignore"
|
121
|
-
- ".travis.yml"
|
122
|
-
- Appraisals
|
123
|
-
- Gemfile
|
124
119
|
- LICENSE.txt
|
125
120
|
- README.md
|
126
|
-
- Rakefile
|
127
|
-
- gemfiles/active_model_5.1.gemfile
|
128
|
-
- gemfiles/active_model_5.2.gemfile
|
129
|
-
- gemfiles/active_model_6.0.gemfile
|
130
|
-
- gemfiles/active_model_6.1.gemfile
|
131
|
-
- gemfiles/active_model_edge.gemfile
|
132
121
|
- lib/state_machines-activemodel.rb
|
133
122
|
- lib/state_machines/integrations/active_model.rb
|
134
123
|
- lib/state_machines/integrations/active_model/locale.rb
|
135
124
|
- lib/state_machines/integrations/active_model/version.rb
|
136
|
-
- state_machines-activemodel.gemspec
|
137
|
-
- test/files/en.yml
|
138
125
|
- test/integration_test.rb
|
139
126
|
- test/machine_by_default_test.rb
|
140
127
|
- test/machine_errors_test.rb
|
@@ -149,6 +136,7 @@ files:
|
|
149
136
|
- test/machine_with_events_test.rb
|
150
137
|
- test/machine_with_failed_after_callbacks_test.rb
|
151
138
|
- test/machine_with_failed_before_callbacks_test.rb
|
139
|
+
- test/machine_with_initialized_aliased_attribute_test.rb
|
152
140
|
- test/machine_with_initialized_state_test.rb
|
153
141
|
- test/machine_with_internationalization_test.rb
|
154
142
|
- test/machine_with_model_state_attribute_test.rb
|
@@ -163,7 +151,6 @@ homepage: https://github.com/state-machines/state_machines-activemodel
|
|
163
151
|
licenses:
|
164
152
|
- MIT
|
165
153
|
metadata: {}
|
166
|
-
post_install_message:
|
167
154
|
rdoc_options: []
|
168
155
|
require_paths:
|
169
156
|
- lib
|
@@ -171,19 +158,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
158
|
requirements:
|
172
159
|
- - ">="
|
173
160
|
- !ruby/object:Gem::Version
|
174
|
-
version:
|
161
|
+
version: 3.1.0
|
175
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
163
|
requirements:
|
177
164
|
- - ">="
|
178
165
|
- !ruby/object:Gem::Version
|
179
166
|
version: '0'
|
180
167
|
requirements: []
|
181
|
-
rubygems_version: 3.
|
182
|
-
signing_key:
|
168
|
+
rubygems_version: 3.6.7
|
183
169
|
specification_version: 4
|
184
170
|
summary: ActiveModel integration for State Machines
|
185
171
|
test_files:
|
186
|
-
- test/files/en.yml
|
187
172
|
- test/integration_test.rb
|
188
173
|
- test/machine_by_default_test.rb
|
189
174
|
- test/machine_errors_test.rb
|
@@ -198,6 +183,7 @@ test_files:
|
|
198
183
|
- test/machine_with_events_test.rb
|
199
184
|
- test/machine_with_failed_after_callbacks_test.rb
|
200
185
|
- test/machine_with_failed_before_callbacks_test.rb
|
186
|
+
- test/machine_with_initialized_aliased_attribute_test.rb
|
201
187
|
- test/machine_with_initialized_state_test.rb
|
202
188
|
- test/machine_with_internationalization_test.rb
|
203
189
|
- test/machine_with_model_state_attribute_test.rb
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
|
4
|
-
rvm:
|
5
|
-
- 2.5.8
|
6
|
-
- 2.6.6
|
7
|
-
- 2.7.2
|
8
|
-
- jruby
|
9
|
-
- rbx-2
|
10
|
-
|
11
|
-
gemfile:
|
12
|
-
- gemfiles/active_model_5.1.gemfile
|
13
|
-
- gemfiles/active_model_5.2.gemfile
|
14
|
-
- gemfiles/active_model_6.0.gemfile
|
15
|
-
- gemfiles/active_model_6.1.gemfile
|
16
|
-
- gemfiles/active_model_edge.gemfile
|
17
|
-
|
18
|
-
matrix:
|
19
|
-
allow_failures:
|
20
|
-
- rvm: jruby
|
21
|
-
- rvm: rbx-2
|
data/Appraisals
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# ActiveModel integrations
|
2
|
-
appraise 'active_model_5.1' do
|
3
|
-
gem 'activemodel', github: 'rails/rails', branch: '5-1-stable'
|
4
|
-
end
|
5
|
-
|
6
|
-
appraise 'active_model_5.2' do
|
7
|
-
gem 'activemodel', github: 'rails/rails', branch: '5-2-stable'
|
8
|
-
end
|
9
|
-
|
10
|
-
appraise 'active_model_6.0' do
|
11
|
-
gem 'activemodel', github: 'rails/rails', branch: '6-0-stable'
|
12
|
-
end
|
13
|
-
|
14
|
-
appraise 'active_model_6.1' do
|
15
|
-
gem 'activemodel', github: 'rails/rails', branch: '6-1-stable'
|
16
|
-
end
|
17
|
-
|
18
|
-
appraise 'active_model_edge' do
|
19
|
-
gem 'activemodel', github: 'rails/rails', branch: 'master'
|
20
|
-
end
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'state_machines/integrations/active_model/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'state_machines-activemodel'
|
8
|
-
spec.version = StateMachines::Integrations::ActiveModel::VERSION
|
9
|
-
spec.authors = ['Abdelkader Boudih', 'Aaron Pfeifer']
|
10
|
-
spec.email = %w(terminale@gmail.com aaron@pluginaweek.org)
|
11
|
-
spec.summary = 'ActiveModel integration for State Machines'
|
12
|
-
spec.description = 'Adds support for creating state machines for attributes on ActiveModel'
|
13
|
-
spec.homepage = 'https://github.com/state-machines/state_machines-activemodel'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.test_files = spec.files.grep(/^test\//)
|
18
|
-
spec.require_paths = ['lib']
|
19
|
-
spec.required_ruby_version = '>= 2.2.2'
|
20
|
-
spec.add_dependency 'state_machines', '>= 0.5.0'
|
21
|
-
spec.add_dependency 'activemodel', '>= 5.1'
|
22
|
-
|
23
|
-
spec.add_development_dependency 'bundler', '>= 1.6'
|
24
|
-
spec.add_development_dependency 'rake', '>= 10'
|
25
|
-
spec.add_development_dependency 'appraisal', '>= 1'
|
26
|
-
spec.add_development_dependency 'minitest', '~> 5.4'
|
27
|
-
spec.add_development_dependency 'minitest-reporters'
|
28
|
-
end
|