statesman 12.0.0 → 13.0.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/.devcontainer/devcontainer.json +31 -0
- data/.devcontainer/docker-compose.yml +39 -0
- data/.github/workflows/tests.yml +42 -20
- data/.rspec +1 -0
- data/.rubocop.yml +1 -4
- data/.rubocop_todo.yml +23 -38
- data/.ruby-version +1 -1
- data/CHANGELOG.md +185 -51
- data/CONTRIBUTING.md +14 -13
- data/Gemfile +15 -1
- data/README.md +136 -77
- data/docs/COMPATIBILITY.md +3 -3
- data/lib/statesman/adapters/active_record.rb +0 -2
- data/lib/statesman/adapters/active_record_queries.rb +1 -1
- data/lib/statesman/callback.rb +2 -2
- data/lib/statesman/config.rb +1 -1
- data/lib/statesman/guard.rb +1 -1
- data/lib/statesman/machine.rb +8 -0
- data/lib/statesman/version.rb +1 -1
- data/lib/statesman.rb +1 -1
- data/spec/statesman/adapters/active_record_queries_spec.rb +2 -2
- data/spec/statesman/adapters/active_record_spec.rb +8 -6
- data/spec/statesman/adapters/shared_examples.rb +4 -3
- data/spec/statesman/adapters/type_safe_active_record_queries_spec.rb +1 -1
- data/spec/statesman/machine_spec.rb +81 -9
- data/spec/support/active_record.rb +2 -2
- data/statesman.gemspec +1 -15
- metadata +7 -202
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,42 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
<!-- markdownlint-disable no-duplicate-heading -->
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## v13.0.0 29th August 2025
|
9
|
+
|
10
|
+
### Changes
|
11
|
+
|
12
|
+
- Remove support for Rails 6.1 and 7, add support for Rails 8
|
13
|
+
- Remove support for PostgreSQL < 13, add support for PostgreSQL 17
|
14
|
+
- Remove support for Ruby 3.0, 3.1, add support for Ruby 3.4 and 3.5
|
15
|
+
|
16
|
+
## v12.1.0 5th January 2024
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
|
20
|
+
- Fixed autoloading the VERSION constants
|
21
|
+
- Fixed Ensuring inheritance issues with STI tabled
|
22
|
+
- Enabled gaplock protection when using trilogy mysql adapter
|
23
|
+
|
24
|
+
### Added
|
25
|
+
|
26
|
+
- Added Ruby 3.3 to build matrix
|
27
|
+
- Added optional initial transition
|
28
|
+
|
1
29
|
## v12.0.0 30th November 2023
|
2
30
|
|
3
|
-
###
|
31
|
+
### Added
|
32
|
+
|
4
33
|
- Added multi-database support [#522](https://github.com/gocardless/statesman/pull/522)
|
5
34
|
- This now uses the correct ActiveRecord connection for the model or transition in a multi-database environment
|
6
35
|
|
7
36
|
## v11.0.0 3rd November 2023
|
8
37
|
|
9
38
|
### Changed
|
39
|
+
|
10
40
|
- Updated to support ActiveRecord > 7.2
|
11
41
|
- Remove support for:
|
12
42
|
- Ruby; 2.7
|
@@ -15,44 +45,55 @@
|
|
15
45
|
|
16
46
|
## v10.2.3 2nd Aug 2023
|
17
47
|
|
18
|
-
###
|
48
|
+
### Fixed
|
49
|
+
|
19
50
|
- Fixed calls to reloading internal cache is the state_machine was made private / protected
|
20
51
|
|
21
52
|
## v10.2.2 21st April 2023
|
22
53
|
|
23
54
|
### Changed
|
24
|
-
|
55
|
+
|
56
|
+
- Calling `active_record.reload` resets the adapter's internal cache
|
25
57
|
|
26
58
|
## v10.2.1 3rd April 2023
|
27
59
|
|
28
|
-
###
|
60
|
+
### Fixed
|
61
|
+
|
29
62
|
- Fixed an edge case where `adapter.reset` were failing if the cache is empty
|
30
63
|
|
31
64
|
## v10.2.0 3rd April 2023
|
32
65
|
|
33
|
-
###
|
66
|
+
### Fixed
|
67
|
+
|
34
68
|
- Fixed caching of `last_transition` [#505](https://github.com/gocardless/statesman/pull/505)
|
35
69
|
|
36
70
|
## v10.1.0 10th March 2023
|
37
71
|
|
38
|
-
###
|
72
|
+
### Changed
|
73
|
+
|
39
74
|
- Add the source location of the guard callback to `Statesman::GuardFailedError`
|
40
75
|
|
41
76
|
## v10.0.0 17th May 2022
|
42
77
|
|
43
|
-
###
|
78
|
+
### Added
|
79
|
+
|
44
80
|
- Added support for Ruby 3.1 [#462](https://github.com/gocardless/statesman/pull/462)
|
45
|
-
- Removed support for Ruby 2.5 and 2.6 [#462](https://github.com/gocardless/statesman/pull/462)
|
46
81
|
- Added `remove_state` and `remove_transitions` methods to `Statesman::Machine` [#464](https://github.com/gocardless/statesman/pull/464)
|
47
82
|
|
83
|
+
### Changed
|
84
|
+
|
85
|
+
- Removed support for Ruby 2.5 and 2.6 [#462](https://github.com/gocardless/statesman/pull/462)
|
86
|
+
|
48
87
|
## v9.0.1 4th February 2021
|
49
88
|
|
50
89
|
### Changed
|
90
|
+
|
51
91
|
- Deprecate `ActiveRecord::Base.default_timezone` in favour of `ActiveRecord.default_timezone` [#446](https://github.com/gocardless/statesman/pull/446)
|
52
92
|
|
53
93
|
## v9.0.0 9th August 2021
|
54
94
|
|
55
95
|
### Added
|
96
|
+
|
56
97
|
- Added Ruby 3.0 support
|
57
98
|
|
58
99
|
### Breaking changes
|
@@ -62,19 +103,20 @@
|
|
62
103
|
## v8.0.3 8th June 2021
|
63
104
|
|
64
105
|
### Added
|
106
|
+
|
65
107
|
- Implement `Machine#last_transition_to`, to find the last transition to a given state
|
66
108
|
[#438](https://github.com/gocardless/statesman/pull/438)
|
67
109
|
|
68
110
|
## v8.0.2 30th March 2021
|
69
111
|
|
70
|
-
###
|
112
|
+
### Fixed
|
71
113
|
|
72
114
|
- Fixed a bug where the `history` of a model was left in an incorrect state after a transition
|
73
115
|
conflict [#433](https://github.com/gocardless/statesman/pull/433)
|
74
116
|
|
75
117
|
## v8.0.1 20th January 2021
|
76
118
|
|
77
|
-
###
|
119
|
+
### Fixed
|
78
120
|
|
79
121
|
- Fixed `no implicit conversion of nil into String` error when quoting null values
|
80
122
|
[#427](https://github.com/gocardless/statesman/pull/427)
|
@@ -118,43 +160,57 @@
|
|
118
160
|
|
119
161
|
## v7.1.0, 10th Feb 2020
|
120
162
|
|
163
|
+
### Fixed
|
164
|
+
|
121
165
|
- Fix `to_s` on `TransitionFailedError` & `GuardFailedError`. `.message` and
|
122
|
-
|
166
|
+
`.to_s` diverged when `from` and `to` accessors where added in v4.1.3
|
123
167
|
|
124
168
|
## v7.0.1, 8th Jan 2020
|
125
169
|
|
170
|
+
### Fixed
|
171
|
+
|
126
172
|
- Fix deprecation warning with Ruby 2.7 [#386](https://github.com/gocardless/statesman/pull/386)
|
127
173
|
|
128
174
|
## v7.0.0, 8th Jan 2020
|
129
175
|
|
130
|
-
|
176
|
+
### Breaking changes
|
131
177
|
|
132
178
|
- Drop official support for Rails 4.2, 5.0 and 5.1, following our [compatibility
|
133
179
|
policy](https://github.com/gocardless/statesman/blob/master/docs/COMPATIBILITY.md).
|
134
180
|
|
135
181
|
## v6.0.0, 20th December 2019
|
136
182
|
|
137
|
-
|
183
|
+
### Breaking changes
|
138
184
|
|
139
185
|
- Drop official support for Ruby 2.2 and 2.3 following our [compatibility
|
140
186
|
policy](https://github.com/gocardless/statesman/blob/master/docs/COMPATIBILITY.md).
|
141
187
|
|
142
188
|
## v5.2.0, 17th December 2019
|
143
189
|
|
190
|
+
### Changed
|
191
|
+
|
144
192
|
- Issue `most_recent_transition_join` query as a single-line string [#381](https://github.com/gocardless/statesman/pull/381)
|
145
193
|
|
146
194
|
## v5.1.0, 22th November 2019
|
147
195
|
|
196
|
+
### Fixed
|
197
|
+
|
148
198
|
- Correct `Statesman::Adapters::ActiveRecordQueries` error text [@Bramjetten](https://github.com/gocardless/statesman/pull/376)
|
149
199
|
- Removes duplicate `map` call [Isaac Seymour](https://github.com/gocardless/statesman/pull/362)
|
200
|
+
|
201
|
+
### Changed
|
202
|
+
|
150
203
|
- Update changelog with instructions of how to use `ActiveRecordQueries` added
|
151
204
|
in v5.0.0
|
152
205
|
- Pass exception into `after_transition_failure` and `after_guard_failure` callbacks [@credric-cordenier](https://github.com/gocardless/statesman/pull/378)
|
153
206
|
|
154
207
|
## v5.0.0, 11th November 2019
|
155
208
|
|
209
|
+
### Added
|
210
|
+
|
156
211
|
- Adds new syntax and restrictions to ActiveRecordQueries [PR#358](https://github.com/gocardless/statesman/pull/358). With the introduction of this, defining `self.transition_class` or `self.initial_state` is deprecated and will be removed in the next major release.
|
157
212
|
Change
|
213
|
+
|
158
214
|
```ruby
|
159
215
|
include Statesman::Adapters::ActiveRecordQueries
|
160
216
|
def self.initial_state
|
@@ -164,7 +220,9 @@
|
|
164
220
|
MyTransition
|
165
221
|
end
|
166
222
|
```
|
223
|
+
|
167
224
|
to
|
225
|
+
|
168
226
|
```ruby
|
169
227
|
include Statesman::Adapters::ActiveRecordQueries[
|
170
228
|
initial_state: :initial,
|
@@ -174,72 +232,102 @@
|
|
174
232
|
|
175
233
|
## v4.1.4, 11th November 2019
|
176
234
|
|
235
|
+
### Changed
|
236
|
+
|
177
237
|
- Reverts the breaking changes from [PR#358](https://github.com/gocardless/statesman/pull/358) & `v4.1.3` that where included in the last minor release. If you have changed your code to work with these changes `v5.0.0` will be a copy of `v4.1.3` with a bugfix applied.
|
178
238
|
|
179
239
|
## v4.1.3, 6th November 2019
|
180
240
|
|
241
|
+
### Added
|
242
|
+
|
181
243
|
- Add accessible from / to state attributes on the `TransitionFailedError` to avoid parsing strings [@ahjmorton](https://github.com/gocardless/statesman/pull/367)
|
182
244
|
- Add `after_transition_failure` mechanism [@credric-cordenier](https://github.com/gocardless/statesman/pull/366)
|
183
245
|
|
184
246
|
## v4.1.2, 17th August 2019
|
185
247
|
|
248
|
+
### Added
|
249
|
+
|
186
250
|
- Add support for Rails 6 [@greysteil](https://github.com/gocardless/statesman/pull/360)
|
187
251
|
|
188
252
|
## v4.1.1, 6th July 2019
|
189
253
|
|
254
|
+
### Fixed
|
255
|
+
|
190
256
|
- Fix statesman index detection for indexes that start t-z [@hmarr](https://github.com/gocardless/statesman/pull/354)
|
191
257
|
- Correct access of metadata via `state_machine` [@glenpike](https://github.com/gocardless/statesman/pull/349)
|
192
258
|
|
193
259
|
## v4.1.0, 10 April 2019
|
194
260
|
|
195
|
-
|
261
|
+
### Changed
|
262
|
+
|
263
|
+
- Add better support for mysql (and others) in `transition_conflict_error?` [@greysteil](https://github.com/greysteil) (<https://github.com/gocardless/statesman/pull/342>)
|
196
264
|
|
197
265
|
## v4.0.0, 22 February 2019
|
198
266
|
|
199
|
-
|
267
|
+
### Fixed
|
268
|
+
|
200
269
|
- Fixes an issue with `after_commit` transition blocks that where being
|
201
|
-
|
270
|
+
executed even if the transaction rolled back. ([patch](https://github.com/gocardless/statesman/pull/338) by [@matid](https://github.com/matid))
|
271
|
+
|
272
|
+
### Changed
|
273
|
+
|
274
|
+
- Forces Statesman to use a new transactions with `requires_new: true` (<https://github.com/gocardless/statesman/pull/249>)
|
202
275
|
|
203
276
|
## v3.5.0, 2 November 2018
|
204
277
|
|
278
|
+
### Changed
|
279
|
+
|
205
280
|
- Expose `most_recent_transition_join` - ActiveRecords `or` requires that both
|
206
|
-
|
207
|
-
|
281
|
+
sides of the query match up. Exposing this methods makes things easier if
|
282
|
+
one side of the `or` uses `in_state` or `not_in_state`. (patch by [@adambutler](https://github.com/adambutler))
|
208
283
|
- Various Readme and CI related changes.
|
209
284
|
|
210
285
|
## v3.4.1, 14 February 2018 ❤️
|
211
286
|
|
287
|
+
### Added
|
288
|
+
|
212
289
|
- Support ActiveRecord transition classes which don't include `Statesman::Adapters::ActiveRecordTransition`, and thus don't have a `.updated_timestamp_column` method (see #310 for further details) (patch by [@timrogers](https://github.com/timrogers))
|
213
290
|
|
214
291
|
## v3.4.0, 12 February 2018
|
215
292
|
|
293
|
+
### Changed
|
294
|
+
|
216
295
|
- When unsetting the `most_recent` flag during a transition, don't assume that transitions have an `updated_at` attribute, but rather allow the "updated timestamp column" to be re-configured or disabled entirely (patch by [@timrogers](https://github.com/timrogers))
|
217
296
|
|
218
297
|
## v3.3.0, 5 January 2018
|
219
298
|
|
299
|
+
### Changed
|
300
|
+
|
220
301
|
- Touch `updated_at` on transitions when unsetting `most_recent` flag (patch by [@NGMarmaduke](https://github.com/NGMarmaduke))
|
221
302
|
- Fix `force_reload` for ActiveRecord models with loaded transitions (patch by [@jacobpgn](https://github.com/))
|
222
303
|
|
223
304
|
## v3.2.0, 27 November 2017
|
224
305
|
|
306
|
+
### Added
|
307
|
+
|
225
308
|
- Allow specifying metadata with `Machine#allowed_transitions` (patch by [@vvondra](https://github.com/vvondra))
|
226
309
|
|
227
310
|
## v3.1.0, 1 September 2017
|
228
311
|
|
312
|
+
### Added
|
313
|
+
|
229
314
|
- Add support for Rails 5.0.x and 5.1.x (patch by [@kenchan0130](https://github.com/kenchan0130) and [@timrogers](https://github.com/timrogers))
|
315
|
+
|
316
|
+
### Changed
|
317
|
+
|
230
318
|
- Run tests in CircleCI instead of TravisCI (patch by [@timrogers](https://github.com/timrogers))
|
231
319
|
- Update Rubocop and fix offences (patch by [@timrogers](https://github.com/timrogers))
|
232
320
|
|
233
321
|
## v3.0.0, 3 July 2017
|
234
322
|
|
235
|
-
|
323
|
+
### Breaking changes
|
236
324
|
|
237
325
|
- Drop support for Rails < 4.2
|
238
326
|
- Drop support for Ruby < 2.2
|
239
327
|
|
240
328
|
For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
241
329
|
|
242
|
-
|
330
|
+
### Changed
|
243
331
|
|
244
332
|
- Better handling of custom transition association names (patch by [@greysteil](https://github.com/greysteil))
|
245
333
|
- Add foreign keys to transition table generator (patch by [@greysteil](https://github.com/greysteil))
|
@@ -247,6 +335,8 @@ For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
|
247
335
|
|
248
336
|
## v2.0.1, 29 March 2016
|
249
337
|
|
338
|
+
### Added
|
339
|
+
|
250
340
|
- Add support for Rails 5 (excluding Mongoid adapter)
|
251
341
|
|
252
342
|
## v2.0.0, 5 January 2016
|
@@ -255,7 +345,7 @@ For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
|
255
345
|
|
256
346
|
## v2.0.0.rc1, 23 December 2015
|
257
347
|
|
258
|
-
|
348
|
+
### Breaking changes
|
259
349
|
|
260
350
|
- Unset most_recent after before transitions
|
261
351
|
- TL;DR: set `autosave: false` on the `has_many` association between your parent and transition model and this change will almost certainly not affect your integration
|
@@ -273,7 +363,7 @@ For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
|
273
363
|
- To keep Statesman lightweight we've moved event functionality into the `statesman-events` gem
|
274
364
|
- If you are using events, add `statesman-events` to your gemfile and include `Statesman::Events` in your state machines
|
275
365
|
|
276
|
-
|
366
|
+
### Changed
|
277
367
|
|
278
368
|
- Add after_destroy hook to ActiveRecord transition model templates
|
279
369
|
- Add `in_state?` instance method to `Statesman::Machine`
|
@@ -281,56 +371,73 @@ For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
|
281
371
|
|
282
372
|
## v1.3.1, 2 July 2015
|
283
373
|
|
374
|
+
### Changed
|
375
|
+
|
284
376
|
- Fix `in_state` queries with a custom `transition_name` (patch by [0tsuki](https://github.com/0tsuki))
|
285
377
|
- Fix `backfill_most_recent` rake task for databases that support partial indexes (patch by [greysteil](https://github.com/greysteil))
|
286
378
|
|
287
379
|
## v1.3.0, 20 June 2015
|
288
380
|
|
381
|
+
### Changed
|
382
|
+
|
289
383
|
- Rename `last_transition` alias in `ActiveRecordQueries` to `most_recent_#{model_name}`, to allow merging of two such queries (patch by [@isaacseymour](https://github.com/isaacseymour))
|
290
384
|
|
291
385
|
## v1.2.5, 17 June 2015
|
292
386
|
|
387
|
+
### Changed
|
388
|
+
|
293
389
|
- Make `backfill_most_recent` rake task db-agnostic (patch by [@timothyp](https://github.com/timothyp))
|
294
390
|
|
295
391
|
## v1.2.4, 16 June 2015
|
296
392
|
|
393
|
+
### Changed
|
394
|
+
|
297
395
|
- Clarify error messages when misusing `Statesman::Adapters::ActiveRecordTransition` (patch by [@isaacseymour](https://github.com/isaacseymour))
|
298
396
|
|
299
397
|
## v1.2.3, 14 April 2015
|
300
398
|
|
399
|
+
### Changed
|
400
|
+
|
301
401
|
- Fix use of most_recent column in MySQL (partial indexes aren't supported) (patch by [@greysteil](https://github.com/greysteil))
|
302
402
|
|
303
403
|
## v1.2.2, 24 March 2015
|
304
404
|
|
405
|
+
### Added
|
406
|
+
|
305
407
|
- Add support for namespaced transition models (patch by [@DanielWright](https://github.com/DanielWright))
|
306
408
|
|
307
409
|
## v1.2.1, 24 March 2015
|
308
410
|
|
411
|
+
### Added
|
412
|
+
|
309
413
|
- Add support for Postgres 9.4's `jsonb` column type (patch by [@isaacseymour](https://github.com/isaacseymour))
|
310
414
|
|
311
415
|
## v1.2.0, 18 March 2015
|
312
416
|
|
313
|
-
|
417
|
+
### Added
|
314
418
|
|
315
419
|
- Add a `most_recent` column to transition tables to greatly speed up queries (ActiveRecord adapter only).
|
316
420
|
- All queries are backwards-compatible, so everything still works without the new column.
|
317
421
|
- The upgrade path is:
|
318
422
|
- Generate and run a migration for adding the column, by running `rails generate statesman:add_most_recent <ParentModel> <TransitionModel>`.
|
319
|
-
- Backfill the `most_recent` column on old records by running `rake statesman:backfill_most_recent[ParentModel]
|
423
|
+
- Backfill the `most_recent` column on old records by running `rake statesman:backfill_most_recent[ParentModel]`.
|
320
424
|
- Add constraints and indexes to the transition table that make use of the new field, by running `rails g statesman:add_constraints_to_most_recent <ParentModel> <TransitionModel>`.
|
321
425
|
- The upgrade path has been designed to be zero-downtime, even on large tables. As a result, please note that queries will only use the `most_recent` field after the constraints have been added.
|
322
|
-
- `ActiveRecordQueries.{not_,}in_state` now accepts an array of states.
|
323
426
|
|
427
|
+
### Changed
|
428
|
+
|
429
|
+
- `ActiveRecordQueries.{not_,}in_state` now accepts an array of states.
|
324
430
|
|
325
431
|
## v1.1.0, 9 December 2014
|
326
|
-
|
432
|
+
|
433
|
+
### Fixed
|
327
434
|
|
328
435
|
- Support for Rails 4.2.0.rc2:
|
329
436
|
- Remove use of serialized_attributes when using 4.2+. (patch by [@greysteil](https://github.com/greysteil))
|
330
437
|
- Use reflect_on_association rather than directly using the reflections hash. (patch by [@timrogers](https://github.com/timrogers))
|
331
438
|
- Fix `ActiveRecordQueries.in_state` when `Model.initial_state` is defined as a symbol. (patch by [@isaacseymour](https://github.com/isaacseymour))
|
332
439
|
|
333
|
-
|
440
|
+
### Changed
|
334
441
|
|
335
442
|
- Transition metadata now defaults to `{}` rather than `nil`. (patch by [@greysteil](https://github.com/greysteil))
|
336
443
|
|
@@ -339,99 +446,126 @@ For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
|
339
446
|
No changes from v1.0.0.beta2
|
340
447
|
|
341
448
|
## v1.0.0.beta2, 10 October 2014
|
342
|
-
|
449
|
+
|
450
|
+
### Breaking changes
|
343
451
|
|
344
452
|
- Rename `ActiveRecordModel` to `ActiveRecordQueries`, to reflect the fact that it mixes in some helpful scopes, but is not required.
|
345
453
|
|
346
454
|
## v1.0.0.beta1, 9 October 2014
|
347
|
-
|
455
|
+
|
456
|
+
### Breaking changes
|
348
457
|
|
349
458
|
- Classes which include `ActiveRecordModel` must define an `initial_state` class method.
|
350
459
|
|
351
|
-
|
460
|
+
### Fixed
|
352
461
|
|
353
|
-
- `ActiveRecordModel.in_state` and `ActiveRecordModel.not_in_state` now handle
|
462
|
+
- `ActiveRecordModel.in_state` and `ActiveRecordModel.not_in_state` now handle initial states correctly (patch by [@isaacseymour](https://github.com/isaacseymour))
|
354
463
|
|
355
|
-
|
464
|
+
### Added
|
356
465
|
|
357
466
|
- Transition tables created by generated migrations have `NOT NULL` constraints on `to_state`, `sort_key` and foreign key columns (patch by [@greysteil](https://github.com/greysteil))
|
358
467
|
- `before_transition` and `after_transition` allow an array of to states (patch by [@isaacseymour](https://github.com/isaacseymour))
|
359
468
|
|
360
469
|
## v0.8.3, 2 September 2014
|
361
|
-
|
470
|
+
|
471
|
+
### Fixed
|
362
472
|
|
363
473
|
- Optimisation for Machine#available_events (patch by [@pacso](https://github.com/pacso))
|
364
474
|
|
365
475
|
## v0.8.2, 2 September 2014
|
366
|
-
|
476
|
+
|
477
|
+
### Fixed
|
367
478
|
|
368
479
|
- Stop generating a default value for the metadata column if using MySQL.
|
369
480
|
|
370
481
|
## v0.8.1, 19 August 2014
|
371
|
-
|
482
|
+
|
483
|
+
### Fixed
|
372
484
|
|
373
485
|
- Adds check in Machine#transition to make sure the 'to' state is not an empty array (patch by [@barisbalic](https://github.com/barisbalic))
|
374
486
|
|
375
487
|
## v0.8.0, 29 June 2014
|
376
|
-
|
488
|
+
|
489
|
+
### Added
|
377
490
|
|
378
491
|
- Events. Machines can now define events as a logical grouping of transitions (patch by [@iurimatias](https://github.com/iurimatias))
|
379
492
|
- Retries. Individual transitions can be executed with a retry policy by wrapping the method call in a `Machine.retry_conflicts {}` block (patch by [@greysteil](https://github.com/greysteil))
|
380
493
|
|
381
494
|
## v0.7.0, 25 June 2014
|
382
|
-
|
495
|
+
|
496
|
+
### Added
|
383
497
|
|
384
498
|
- `Adapters::ActiveRecord` now handles `ActiveRecord::RecordNotUnique` errors explicitly and re-raises with a `Statesman::TransitionConflictError` if it is due to duplicate sort_keys (patch by [@greysteil](https://github.com/greysteil))
|
385
499
|
|
386
500
|
## v0.6.1, 21 May 2014
|
387
|
-
|
501
|
+
|
502
|
+
### Fixed
|
503
|
+
|
388
504
|
- Fixes an issue where the wrong transition was passed to after_transition callbacks for the second and subsequent transition of a given state machine (patch by [@alan](https://github.com/alan))
|
389
505
|
|
390
506
|
## v0.6.0, 19 May 2014
|
391
|
-
|
507
|
+
|
508
|
+
### Added
|
509
|
+
|
392
510
|
- Generators now handle namespaced classes (patch by [@hrmrebecca](https://github.com/hrmrebecca))
|
393
511
|
|
394
|
-
|
512
|
+
### Changed
|
513
|
+
|
395
514
|
- `Machine#transition_to` now only swallows Statesman generated errors. An exception in your guard or callback will no longer be caught by Statesman (patch by [@paulspringett](https://github.com/paulspringett))
|
396
515
|
|
397
516
|
## v0.5.0, 27 March 2014
|
398
|
-
|
517
|
+
|
518
|
+
### Added
|
519
|
+
|
399
520
|
- Scope methods. Adds a module which can be mixed in to an ActiveRecord model to provide `.in_state` and `.not_in_state` query scopes.
|
400
521
|
- Adds `Machine#after_initialize` hook (patch by [@att14](https://github.com/att14))
|
401
522
|
|
402
|
-
|
523
|
+
### Fixed
|
524
|
+
|
403
525
|
- Added MongoidTransition to the autoload statements, fixing [#29](https://github.com/gocardless/statesman/issues/29) (patch by [@tomclose](https://github.com/tomclose))
|
404
526
|
|
405
527
|
## v0.4.0, 27 February 2014
|
406
|
-
|
528
|
+
|
529
|
+
### Added
|
530
|
+
|
407
531
|
- Adds after_commit flag to after_transition for callbacks to be executed after the transaction has been
|
408
|
-
committed on the ActiveRecord adapter. These callbacks will still be executed on non transactional adapters.
|
532
|
+
committed on the ActiveRecord adapter. These callbacks will still be executed on non transactional adapters.
|
409
533
|
|
410
534
|
## v0.3.0, 20 February 2014
|
411
|
-
|
535
|
+
|
536
|
+
### Added
|
537
|
+
|
412
538
|
- Adds Machine#allowed_transitions method (patch by [@prikha](https://github.com/prikha))
|
413
539
|
|
414
540
|
## v0.2.1, 31 December 2013
|
415
|
-
|
541
|
+
|
542
|
+
### Fixed
|
543
|
+
|
416
544
|
- Don't add attr_accessible to generated transition model if running in Rails 4
|
417
545
|
|
418
546
|
## v0.2.0, 16 December 2013
|
419
|
-
|
547
|
+
|
548
|
+
### Added
|
549
|
+
|
420
550
|
- Adds Ruby 1.9.3 support (patch by [@jakehow](https://github.com/jakehow))
|
421
551
|
- All Mongo dependent tests are tagged so they can be excluded from test runs
|
422
552
|
|
423
|
-
|
553
|
+
### Changed
|
554
|
+
|
424
555
|
- Specs now crash immediately if Mongo is not running
|
425
556
|
|
426
557
|
## v0.1.0, 5 November 2013
|
427
558
|
|
428
|
-
|
559
|
+
### Added
|
560
|
+
|
429
561
|
- Adds Mongoid adapter and generators (patch by [@dluxemburg](https://github.com/dluxemburg))
|
430
562
|
|
431
|
-
|
563
|
+
### Changed
|
564
|
+
|
432
565
|
- Replaces `config#transition_class` with `Statesman::Adapters::ActiveRecordTransition` mixin. (inspired by [@cjbell88](https://github.com/cjbell88))
|
433
566
|
- Renames the active record transition generator from `statesman:transition` to `statesman:active_record_transition`.
|
434
567
|
- Moves to using `require_relative` internally where possible to avoid stomping on application load paths.
|
435
568
|
|
436
|
-
## v0.0.1, 28 October 2013
|
569
|
+
## v0.0.1, 28 October 2013
|
570
|
+
|
437
571
|
- Initial release
|
data/CONTRIBUTING.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
1
3
|
Thanks for taking an interest in contributing to Statesman, here are a few
|
2
4
|
ways you can help make this project better!
|
3
5
|
|
4
|
-
##
|
6
|
+
## Submitting pull requests
|
5
7
|
|
6
|
-
- Generally we welcome new features but please first open an issue where we
|
8
|
+
- Generally we welcome new features but please first open an issue where we
|
7
9
|
can discuss whether it fits with our vision for the project.
|
8
10
|
- Any new feature or bug fix needs an accompanying test case.
|
9
11
|
- No need to add to the changelog, we will take care of updating it as we make
|
@@ -17,23 +19,22 @@ request passes by running `rubocop`.
|
|
17
19
|
|
18
20
|
## Documentation
|
19
21
|
|
20
|
-
Please add a section to the readme for any new feature additions or
|
21
|
-
changes.
|
22
|
+
Please add a section to [the readme](README.md) for any new feature additions or behavioural changes.
|
22
23
|
|
23
24
|
## Releasing
|
24
25
|
|
25
|
-
We publish new versions of Stateman using [RubyGems](https://guides.rubygems.org/publishing/). Once
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
$ gem build statesman.gemspec
|
26
|
+
We publish new versions of Stateman using [RubyGems](https://guides.rubygems.org/publishing/). Once the relevant changes have been merged and `VERSION` has been appropriately bumped to the new version, we run the following command.
|
27
|
+
|
28
|
+
```sh
|
29
|
+
gem build statesman.gemspec
|
30
30
|
```
|
31
|
-
|
32
|
-
new version. For example, if we are releasing version 9.0.0, the file would be
|
31
|
+
|
32
|
+
This builds a `.gem` file locally that will be named something like `statesman-X` where `X` is the new version. For example, if we are releasing version 9.0.0, the file would be
|
33
33
|
`statesman-9.0.0.gem`.
|
34
34
|
|
35
35
|
To publish, run `gem push` with the new `.gem` file we just generated. This requires a OTP that is currently only available
|
36
36
|
to GoCardless engineers. For example, if we were to continue to publish version 9.0.0, we would run:
|
37
|
-
|
38
|
-
|
37
|
+
|
38
|
+
```sh
|
39
|
+
gem push statesman-9.0.0.gem
|
39
40
|
```
|
data/Gemfile
CHANGED
@@ -8,9 +8,23 @@ if ENV['RAILS_VERSION'] == 'main'
|
|
8
8
|
gem "rails", git: "https://github.com/rails/rails", branch: "main"
|
9
9
|
elsif ENV['RAILS_VERSION']
|
10
10
|
gem "rails", "~> #{ENV['RAILS_VERSION']}"
|
11
|
+
else
|
12
|
+
gem "rails", "~> 8.0"
|
11
13
|
end
|
12
14
|
|
13
|
-
group :development do
|
15
|
+
group :development, :test do
|
16
|
+
gem "ammeter", "~> 1.1"
|
17
|
+
gem "bundler", "~> 2"
|
18
|
+
gem "gc_ruboconfig", "~> 5.0.0"
|
19
|
+
gem "mysql2", ">= 0.4", "< 0.6"
|
20
|
+
gem "pg", ">= 0.18", "<= 1.7"
|
14
21
|
gem "pry"
|
22
|
+
gem "rake", "~> 13.3.0"
|
23
|
+
gem "rspec", "~> 3.1"
|
24
|
+
gem "rspec-github", "~> 3.0.0"
|
25
|
+
gem "rspec-its", "~> 2.0"
|
26
|
+
gem "rspec-rails", "~> 8.0"
|
27
|
+
gem "sqlite3", "~> 2.7.3"
|
15
28
|
gem "test-unit", "~> 3.3"
|
29
|
+
gem "timecop", "~> 0.9.1"
|
16
30
|
end
|