statesman 3.0.0 → 3.1.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +388 -0
  3. data/.rubocop.yml +13 -1
  4. data/.rubocop_todo.yml +17 -0
  5. data/CHANGELOG.md +6 -0
  6. data/CONTRIBUTING.md +0 -7
  7. data/Gemfile +1 -1
  8. data/Guardfile +2 -2
  9. data/LICENSE.txt +1 -1
  10. data/README.md +38 -15
  11. data/Rakefile +9 -1
  12. data/lib/generators/statesman/active_record_transition_generator.rb +0 -4
  13. data/lib/generators/statesman/generator_helpers.rb +4 -0
  14. data/lib/generators/statesman/templates/active_record_transition_model.rb.erb +2 -2
  15. data/lib/generators/statesman/templates/create_migration.rb.erb +2 -2
  16. data/lib/generators/statesman/templates/update_migration.rb.erb +2 -2
  17. data/lib/statesman.rb +2 -1
  18. data/lib/statesman/adapters/active_record.rb +2 -2
  19. data/lib/statesman/config.rb +0 -1
  20. data/lib/statesman/machine.rb +3 -2
  21. data/lib/statesman/utils.rb +15 -0
  22. data/lib/statesman/version.rb +1 -1
  23. data/spec/generators/statesman/active_record_transition_generator_spec.rb +4 -4
  24. data/spec/generators/statesman/migration_generator_spec.rb +1 -1
  25. data/spec/generators/statesman/mongoid_transition_generator_spec.rb +2 -2
  26. data/spec/spec_helper.rb +2 -2
  27. data/spec/statesman/adapters/active_record_queries_spec.rb +2 -2
  28. data/spec/statesman/adapters/active_record_spec.rb +8 -1
  29. data/spec/statesman/callback_spec.rb +1 -1
  30. data/spec/statesman/machine_spec.rb +11 -11
  31. data/spec/statesman/utils_spec.rb +51 -0
  32. data/spec/support/active_record.rb +31 -22
  33. data/spec/support/generators_shared_examples.rb +2 -2
  34. data/statesman.gemspec +17 -14
  35. metadata +31 -14
  36. data/.travis.yml +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 776828e7a0c09b55f59d7b9efe5709f1ab3b95e8
4
- data.tar.gz: 8c95a4d4af92bf1a64f3f02fd3715b4a6816358b
3
+ metadata.gz: 9dde77bdcc9a2b9cde16e90f5d00e82a30d1efc7
4
+ data.tar.gz: '0927b94d3a461059051083ae3d62b6df62f07658'
5
5
  SHA512:
6
- metadata.gz: 0fe311fde00f43e4dfe1ebe1ba0eb74262e2d6b916ec0eb4560ca54f268c58534e2384af7a0164921b4270f4c19816e4bda34e4cfac8b7fbac5e8d5a689286a5
7
- data.tar.gz: c5c6ae72993e773438e3e620c2b8c4439fabb172bd0af19566cfb822f7d3c56da9f1652d48f929420cc7b5dd681779c107457d8087ceec9889d6a15fc4940e56
6
+ metadata.gz: f479c08a14edf813e36a035ffb3db9f1985ddffad74eebd6a9ff9ffa41b4a3bcc16d27f43f1048690f0b93acc4b286cf75184059903c5722d333a7bac0839c42
7
+ data.tar.gz: 210f9b2ceb2d079bb40540b4a68765397df10e31795e71edbe9204a413b9839b6ce2eecd1f335ef65258bcd2ffc58d4ed1bf42cf83ac71d6275da222a8e91367
@@ -0,0 +1,388 @@
1
+ version: 2
2
+
3
+ references:
4
+ steps: &steps
5
+ - checkout
6
+
7
+ - type: shell
8
+ name: Write RAILS_VERSION to a file so we can use it for caching purposes
9
+ command: echo "$RAILS_VERSION" > ~/RAILS_VERSION.txt
10
+
11
+ - type: cache-restore
12
+ key: statesman-{{ checksum "Gemfile" }}-{{ checksum "~/RAILS_VERSION.txt" }}
13
+
14
+ - run: gem install bundler
15
+
16
+ - run: bundle install --path vendor/bundle
17
+
18
+ - type: cache-save
19
+ key: statesman-{{ checksum "Gemfile" }}-{{ checksum "~/RAILS_VERSION.txt" }}
20
+ paths:
21
+ - vendor/bundle
22
+
23
+ - run: bundle exec rubocop
24
+
25
+ - run: dockerize -wait tcp://localhost:$DATABASE_DEPENDENCY_PORT -timeout 1m
26
+
27
+ - run: bundle exec rake
28
+
29
+ - type: store_test_results
30
+ path: /tmp/test-results
31
+
32
+ jobs:
33
+ build-ruby241-rails-429-mongo:
34
+ docker:
35
+ - image: circleci/ruby:2.4.1-node
36
+ environment:
37
+ - RAILS_VERSION=4.2.9
38
+ - DATABASE_DEPENDENCY_PORT=27017
39
+ - image: circleci/mongo:3.0.14
40
+ steps: *steps
41
+ build-ruby241-rails-429-mysql:
42
+ docker:
43
+ - image: circleci/ruby:2.4.1-node
44
+ environment:
45
+ - RAILS_VERSION=4.2.9
46
+ - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
47
+ - EXCLUDE_MONGOID=true
48
+ - DATABASE_DEPENDENCY_PORT=3306
49
+ - image: circleci/mysql:5.7.18
50
+ environment:
51
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
52
+ - MYSQL_USER=root
53
+ - MYSQL_PASSWORD=
54
+ - MYSQL_DATABASE=statesman_test
55
+ steps: *steps
56
+ build-ruby241-rails-429-postgres:
57
+ docker:
58
+ - image: circleci/ruby:2.4.1-node
59
+ environment:
60
+ - RAILS_VERSION=4.2.9
61
+ - DATABASE_URL=postgres://postgres@localhost/statesman_test
62
+ - EXCLUDE_MONGOID=true
63
+ - DATABASE_DEPENDENCY_PORT=5432
64
+ - image: circleci/postgres:9.6
65
+ environment:
66
+ - POSTGRES_USER=postgres
67
+ - POSTGRES_DB=statesman_test
68
+ steps: *steps
69
+ build-ruby241-rails-505-mongo:
70
+ docker:
71
+ - image: circleci/ruby:2.4.1-node
72
+ environment:
73
+ - RAILS_VERSION=5.0.5
74
+ - DATABASE_DEPENDENCY_PORT=27017
75
+ - image: circleci/mongo:3.0.14
76
+ steps: *steps
77
+ build-ruby241-rails-505-mysql:
78
+ docker:
79
+ - image: circleci/ruby:2.4.1-node
80
+ environment:
81
+ - RAILS_VERSION=5.0.5
82
+ - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
83
+ - EXCLUDE_MONGOID=true
84
+ - DATABASE_DEPENDENCY_PORT=3306
85
+ - image: circleci/mysql:5.7.18
86
+ environment:
87
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
88
+ - MYSQL_USER=root
89
+ - MYSQL_PASSWORD=
90
+ - MYSQL_DATABASE=statesman_test
91
+ steps: *steps
92
+ build-ruby241-rails-505-postgres:
93
+ docker:
94
+ - image: circleci/ruby:2.4.1-node
95
+ environment:
96
+ - RAILS_VERSION=5.0.5
97
+ - DATABASE_URL=postgres://postgres@localhost/statesman_test
98
+ - EXCLUDE_MONGOID=true
99
+ - DATABASE_DEPENDENCY_PORT=5432
100
+ - image: circleci/postgres:9.6
101
+ environment:
102
+ - POSTGRES_USER=postgres
103
+ - POSTGRES_DB=statesman_test
104
+ steps: *steps
105
+ build-ruby241-rails-513-mongo:
106
+ docker:
107
+ - image: circleci/ruby:2.4.1-node
108
+ environment:
109
+ - RAILS_VERSION=5.1.3
110
+ - DATABASE_DEPENDENCY_PORT=27017
111
+ - image: circleci/mongo:3.0.14
112
+ steps: *steps
113
+ build-ruby241-rails-513-mysql:
114
+ docker:
115
+ - image: circleci/ruby:2.4.1-node
116
+ environment:
117
+ - RAILS_VERSION=5.1.3
118
+ - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
119
+ - EXCLUDE_MONGOID=true
120
+ - DATABASE_DEPENDENCY_PORT=3306
121
+ - image: circleci/mysql:5.7.18
122
+ environment:
123
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
124
+ - MYSQL_USER=root
125
+ - MYSQL_PASSWORD=
126
+ - MYSQL_DATABASE=statesman_test
127
+ steps: *steps
128
+ build-ruby241-rails-513-postgres:
129
+ docker:
130
+ - image: circleci/ruby:2.4.1-node
131
+ environment:
132
+ - RAILS_VERSION=5.1.3
133
+ - DATABASE_URL=postgres://postgres@localhost/statesman_test
134
+ - EXCLUDE_MONGOID=true
135
+ - DATABASE_DEPENDENCY_PORT=5432
136
+ - image: circleci/postgres:9.6
137
+ environment:
138
+ - POSTGRES_USER=postgres
139
+ - POSTGRES_DB=statesman_test
140
+ steps: *steps
141
+ build-ruby233-rails-429-mongo:
142
+ docker:
143
+ - image: circleci/ruby:2.3.3-node
144
+ environment:
145
+ - RAILS_VERSION=4.2.9
146
+ - DATABASE_DEPENDENCY_PORT=27017
147
+ - image: circleci/mongo:3.0.14
148
+ steps: *steps
149
+ build-ruby233-rails-429-mysql:
150
+ docker:
151
+ - image: circleci/ruby:2.3.3-node
152
+ environment:
153
+ - RAILS_VERSION=4.2.9
154
+ - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
155
+ - EXCLUDE_MONGOID=true
156
+ - DATABASE_DEPENDENCY_PORT=3306
157
+ - image: circleci/mysql:5.7.18
158
+ environment:
159
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
160
+ - MYSQL_USER=root
161
+ - MYSQL_PASSWORD=
162
+ - MYSQL_DATABASE=statesman_test
163
+ steps: *steps
164
+ build-ruby233-rails-429-postgres:
165
+ docker:
166
+ - image: circleci/ruby:2.3.3-node
167
+ environment:
168
+ - RAILS_VERSION=4.2.9
169
+ - DATABASE_URL=postgres://postgres@localhost/statesman_test
170
+ - EXCLUDE_MONGOID=true
171
+ - DATABASE_DEPENDENCY_PORT=5432
172
+ - image: circleci/postgres:9.6
173
+ environment:
174
+ - POSTGRES_USER=postgres
175
+ - POSTGRES_DB=statesman_test
176
+ steps: *steps
177
+ build-ruby233-rails-505-mongo:
178
+ docker:
179
+ - image: circleci/ruby:2.3.3-node
180
+ environment:
181
+ - RAILS_VERSION=5.0.5
182
+ - DATABASE_DEPENDENCY_PORT=27017
183
+ - image: circleci/mongo:3.0.14
184
+ steps: *steps
185
+ build-ruby233-rails-505-mysql:
186
+ docker:
187
+ - image: circleci/ruby:2.3.3-node
188
+ environment:
189
+ - RAILS_VERSION=5.0.5
190
+ - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
191
+ - EXCLUDE_MONGOID=true
192
+ - DATABASE_DEPENDENCY_PORT=3306
193
+ - image: circleci/mysql:5.7.18
194
+ environment:
195
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
196
+ - MYSQL_USER=root
197
+ - MYSQL_PASSWORD=
198
+ - MYSQL_DATABASE=statesman_test
199
+ steps: *steps
200
+ build-ruby233-rails-505-postgres:
201
+ docker:
202
+ - image: circleci/ruby:2.3.3-node
203
+ environment:
204
+ - RAILS_VERSION=5.0.5
205
+ - DATABASE_URL=postgres://postgres@localhost/statesman_test
206
+ - EXCLUDE_MONGOID=true
207
+ - DATABASE_DEPENDENCY_PORT=5432
208
+ - image: circleci/postgres:9.6
209
+ environment:
210
+ - POSTGRES_USER=postgres
211
+ - POSTGRES_DB=statesman_test
212
+ steps: *steps
213
+ build-ruby233-rails-513-mongo:
214
+ docker:
215
+ - image: circleci/ruby:2.3.3-node
216
+ environment:
217
+ - RAILS_VERSION=5.1.3
218
+ - DATABASE_DEPENDENCY_PORT=27017
219
+ - image: circleci/mongo:3.0.14
220
+ steps: *steps
221
+ build-ruby233-rails-513-mysql:
222
+ docker:
223
+ - image: circleci/ruby:2.3.3-node
224
+ environment:
225
+ - RAILS_VERSION=5.1.3
226
+ - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
227
+ - EXCLUDE_MONGOID=true
228
+ - DATABASE_DEPENDENCY_PORT=3306
229
+ - image: circleci/mysql:5.7.18
230
+ environment:
231
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
232
+ - MYSQL_USER=root
233
+ - MYSQL_PASSWORD=
234
+ - MYSQL_DATABASE=statesman_test
235
+ steps: *steps
236
+ build-ruby233-rails-513-postgres:
237
+ docker:
238
+ - image: circleci/ruby:2.3.3-node
239
+ environment:
240
+ - RAILS_VERSION=5.1.3
241
+ - DATABASE_URL=postgres://postgres@localhost/statesman_test
242
+ - EXCLUDE_MONGOID=true
243
+ - DATABASE_DEPENDENCY_PORT=5432
244
+ - image: circleci/postgres:9.6
245
+ environment:
246
+ - POSTGRES_USER=postgres
247
+ - POSTGRES_DB=statesman_test
248
+ steps: *steps
249
+ build-ruby227-rails-429-mongo:
250
+ docker:
251
+ - image: circleci/ruby:2.2.7-node
252
+ environment:
253
+ - RAILS_VERSION=4.2.9
254
+ - DATABASE_DEPENDENCY_PORT=27017
255
+ - image: circleci/mongo:3.0.14
256
+ steps: *steps
257
+ build-ruby227-rails-429-mysql:
258
+ docker:
259
+ - image: circleci/ruby:2.2.7-node
260
+ environment:
261
+ - RAILS_VERSION=4.2.9
262
+ - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
263
+ - EXCLUDE_MONGOID=true
264
+ - DATABASE_DEPENDENCY_PORT=3306
265
+ - image: circleci/mysql:5.7.18
266
+ environment:
267
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
268
+ - MYSQL_USER=root
269
+ - MYSQL_PASSWORD=
270
+ - MYSQL_DATABASE=statesman_test
271
+ steps: *steps
272
+ build-ruby227-rails-429-postgres:
273
+ docker:
274
+ - image: circleci/ruby:2.2.7-node
275
+ environment:
276
+ - RAILS_VERSION=4.2.9
277
+ - DATABASE_URL=postgres://postgres@localhost/statesman_test
278
+ - EXCLUDE_MONGOID=true
279
+ - DATABASE_DEPENDENCY_PORT=5432
280
+ - image: circleci/postgres:9.6
281
+ environment:
282
+ - POSTGRES_USER=postgres
283
+ - POSTGRES_DB=statesman_test
284
+ steps: *steps
285
+ build-ruby227-rails-505-mongo:
286
+ docker:
287
+ - image: circleci/ruby:2.2.7-node
288
+ environment:
289
+ - RAILS_VERSION=5.0.5
290
+ - DATABASE_DEPENDENCY_PORT=27017
291
+ - image: circleci/mongo:3.0.14
292
+ steps: *steps
293
+ build-ruby227-rails-505-mysql:
294
+ docker:
295
+ - image: circleci/ruby:2.2.7-node
296
+ environment:
297
+ - RAILS_VERSION=5.0.5
298
+ - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
299
+ - EXCLUDE_MONGOID=true
300
+ - DATABASE_DEPENDENCY_PORT=3306
301
+ - image: circleci/mysql:5.7.18
302
+ environment:
303
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
304
+ - MYSQL_USER=root
305
+ - MYSQL_PASSWORD=
306
+ - MYSQL_DATABASE=statesman_test
307
+ steps: *steps
308
+ build-ruby227-rails-505-postgres:
309
+ docker:
310
+ - image: circleci/ruby:2.2.7-node
311
+ environment:
312
+ - RAILS_VERSION=5.0.5
313
+ - DATABASE_URL=postgres://postgres@localhost/statesman_test
314
+ - EXCLUDE_MONGOID=true
315
+ - DATABASE_DEPENDENCY_PORT=5432
316
+ - image: circleci/postgres:9.6
317
+ environment:
318
+ - POSTGRES_USER=postgres
319
+ - POSTGRES_DB=statesman_test
320
+ steps: *steps
321
+ build-ruby227-rails-513-mongo:
322
+ docker:
323
+ - image: circleci/ruby:2.2.7-node
324
+ environment:
325
+ - RAILS_VERSION=5.1.3
326
+ - DATABASE_DEPENDENCY_PORT=27017
327
+ - image: circleci/mongo:3.0.14
328
+ steps: *steps
329
+ build-ruby227-rails-513-mysql:
330
+ docker:
331
+ - image: circleci/ruby:2.2.7-node
332
+ environment:
333
+ - RAILS_VERSION=5.1.3
334
+ - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
335
+ - EXCLUDE_MONGOID=true
336
+ - DATABASE_DEPENDENCY_PORT=3306
337
+ - image: circleci/mysql:5.7.18
338
+ environment:
339
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
340
+ - MYSQL_USER=root
341
+ - MYSQL_PASSWORD=
342
+ - MYSQL_DATABASE=statesman_test
343
+ steps: *steps
344
+ build-ruby227-rails-513-postgres:
345
+ docker:
346
+ - image: circleci/ruby:2.2.7-node
347
+ environment:
348
+ - RAILS_VERSION=5.1.3
349
+ - DATABASE_URL=postgres://postgres@localhost/statesman_test
350
+ - EXCLUDE_MONGOID=true
351
+ - DATABASE_DEPENDENCY_PORT=5432
352
+ - image: circleci/postgres:9.6
353
+ environment:
354
+ - POSTGRES_USER=postgres
355
+ - POSTGRES_DB=statesman_test
356
+ steps: *steps
357
+
358
+ workflows:
359
+ version: 2
360
+ tests:
361
+ jobs:
362
+ - build-ruby241-rails-429-mongo
363
+ - build-ruby241-rails-429-mysql
364
+ - build-ruby241-rails-429-postgres
365
+ - build-ruby241-rails-505-mongo
366
+ - build-ruby241-rails-505-mysql
367
+ - build-ruby241-rails-505-postgres
368
+ - build-ruby241-rails-513-mongo
369
+ - build-ruby241-rails-513-mysql
370
+ - build-ruby241-rails-513-postgres
371
+ - build-ruby233-rails-429-mongo
372
+ - build-ruby233-rails-429-mysql
373
+ - build-ruby233-rails-429-postgres
374
+ - build-ruby233-rails-505-mongo
375
+ - build-ruby233-rails-505-mysql
376
+ - build-ruby233-rails-505-postgres
377
+ - build-ruby233-rails-513-mongo
378
+ - build-ruby233-rails-513-mysql
379
+ - build-ruby233-rails-513-postgres
380
+ - build-ruby227-rails-429-mongo
381
+ - build-ruby227-rails-429-mysql
382
+ - build-ruby227-rails-429-postgres
383
+ - build-ruby227-rails-505-mongo
384
+ - build-ruby227-rails-505-mysql
385
+ - build-ruby227-rails-505-postgres
386
+ - build-ruby227-rails-513-mongo
387
+ - build-ruby227-rails-513-mysql
388
+ - build-ruby227-rails-513-postgres
@@ -1,6 +1,9 @@
1
1
  # For all options see https://github.com/bbatsov/rubocop/tree/master/config
2
2
 
3
+ inherit_from: .rubocop_todo.yml
4
+
3
5
  AllCops:
6
+ DisplayCopNames: true
4
7
  Include:
5
8
  - Rakefile
6
9
  - statesman.gemfile
@@ -37,7 +40,7 @@ LineLength:
37
40
  GuardClause:
38
41
  Enabled: false
39
42
 
40
- SingleSpaceBeforeFirstArg:
43
+ Layout/SpaceBeforeFirstArg:
41
44
  Enabled: false
42
45
 
43
46
  DotPosition:
@@ -46,3 +49,12 @@ DotPosition:
46
49
  # Allow class and message or instance raises
47
50
  Style/RaiseArgs:
48
51
  Enabled: false
52
+
53
+ Metrics/BlockLength:
54
+ Exclude:
55
+ - spec/**/*
56
+
57
+ Style/FileName:
58
+ Exclude:
59
+ - Gemfile
60
+ - Guardfile
@@ -0,0 +1,17 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-08-18 17:09:48 +0100 using RuboCop version 0.49.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ # Configuration parameters: CountComments, ExcludedMethods.
11
+ Metrics/BlockLength:
12
+ Max: 42
13
+
14
+ # Offense count: 2
15
+ # Configuration parameters: CountComments.
16
+ Metrics/ModuleLength:
17
+ Max: 107
@@ -1,3 +1,9 @@
1
+ ## v3.1.0, 1 September 2017
2
+
3
+ - Add support for Rails 5.0.x and 5.1.x (patch by [@kenchan0130](https://github.com/kenchan0130) and [@timrogers](https://github.com/timrogers))
4
+ - Run tests in CircleCI instead of TravisCI (patch by [@timrogers](https://github.com/timrogers))
5
+ - Update Rubocop and fix offences (patch by [@timrogers](https://github.com/timrogers))
6
+
1
7
  ## v3.0.0, 3 July 2017
2
8
 
3
9
  *Breaking changes*