statesman 7.4.0 → 12.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +7 -0
  3. data/.github/workflows/tests.yml +112 -0
  4. data/.gitignore +65 -15
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +14 -1
  7. data/.rubocop_todo.yml +37 -28
  8. data/.ruby-version +1 -0
  9. data/CHANGELOG.md +262 -41
  10. data/CONTRIBUTING.md +23 -4
  11. data/Gemfile +4 -6
  12. data/README.md +243 -43
  13. data/docs/COMPATIBILITY.md +2 -2
  14. data/lib/generators/statesman/active_record_transition_generator.rb +1 -1
  15. data/lib/generators/statesman/generator_helpers.rb +12 -4
  16. data/lib/statesman/adapters/active_record.rb +84 -55
  17. data/lib/statesman/adapters/active_record_queries.rb +19 -7
  18. data/lib/statesman/adapters/active_record_transition.rb +5 -1
  19. data/lib/statesman/adapters/memory.rb +5 -1
  20. data/lib/statesman/adapters/type_safe_active_record_queries.rb +21 -0
  21. data/lib/statesman/callback.rb +2 -2
  22. data/lib/statesman/config.rb +3 -10
  23. data/lib/statesman/exceptions.rb +13 -7
  24. data/lib/statesman/guard.rb +1 -1
  25. data/lib/statesman/machine.rb +68 -0
  26. data/lib/statesman/version.rb +1 -1
  27. data/lib/statesman.rb +5 -5
  28. data/lib/tasks/statesman.rake +5 -5
  29. data/spec/generators/statesman/active_record_transition_generator_spec.rb +7 -1
  30. data/spec/generators/statesman/migration_generator_spec.rb +5 -1
  31. data/spec/spec_helper.rb +44 -7
  32. data/spec/statesman/adapters/active_record_queries_spec.rb +34 -12
  33. data/spec/statesman/adapters/active_record_spec.rb +176 -51
  34. data/spec/statesman/adapters/active_record_transition_spec.rb +5 -2
  35. data/spec/statesman/adapters/memory_spec.rb +0 -1
  36. data/spec/statesman/adapters/memory_transition_spec.rb +0 -1
  37. data/spec/statesman/adapters/shared_examples.rb +3 -4
  38. data/spec/statesman/adapters/type_safe_active_record_queries_spec.rb +206 -0
  39. data/spec/statesman/callback_spec.rb +0 -2
  40. data/spec/statesman/config_spec.rb +0 -2
  41. data/spec/statesman/exceptions_spec.rb +17 -4
  42. data/spec/statesman/guard_spec.rb +0 -2
  43. data/spec/statesman/machine_spec.rb +252 -15
  44. data/spec/statesman/utils_spec.rb +0 -2
  45. data/spec/support/active_record.rb +156 -24
  46. data/spec/support/exactly_query_databases.rb +35 -0
  47. data/statesman.gemspec +9 -10
  48. metadata +32 -59
  49. data/.circleci/config.yml +0 -187
data/.circleci/config.yml DELETED
@@ -1,187 +0,0 @@
1
- ---
2
- version: 2
3
-
4
- references:
5
- steps: &steps
6
- - checkout
7
-
8
- - type: shell
9
- name: Write RAILS_VERSION to a file so we can use it for caching purposes
10
- command: echo "$RAILS_VERSION" > ~/RAILS_VERSION.txt
11
-
12
- - type: cache-restore
13
- key: statesman-{{ checksum "Gemfile" }}-{{ checksum "~/RAILS_VERSION.txt" }}
14
-
15
- - run: gem install bundler -v 2.1.4
16
-
17
- - run: bundle install --path vendor/bundle
18
-
19
- - type: cache-save
20
- key: statesman-{{ checksum "Gemfile" }}-{{ checksum "~/RAILS_VERSION.txt" }}
21
- paths:
22
- - vendor/bundle
23
-
24
- - run: bundle exec rubocop
25
-
26
- - run: dockerize -wait tcp://localhost:$DATABASE_DEPENDENCY_PORT -timeout 1m
27
-
28
- - run: bundle exec rake
29
-
30
- - type: store_test_results
31
- path: /tmp/test-results
32
-
33
- jobs:
34
- build-ruby249-rails-524-mysql:
35
- docker:
36
- - image: circleci/ruby:2.4.9-node
37
- environment:
38
- - RAILS_VERSION=5.2.4
39
- - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
40
- - DATABASE_DEPENDENCY_PORT=3306
41
- - image: circleci/mysql:5.7.18
42
- environment:
43
- - MYSQL_ALLOW_EMPTY_PASSWORD=true
44
- - MYSQL_USER=root
45
- - MYSQL_PASSWORD=
46
- - MYSQL_DATABASE=statesman_test
47
- steps: *steps
48
- build-ruby249-rails-524-postgres:
49
- docker:
50
- - image: circleci/ruby:2.4.9-node
51
- environment:
52
- - RAILS_VERSION=5.2.4
53
- - DATABASE_URL=postgres://postgres@localhost/statesman_test
54
- - DATABASE_DEPENDENCY_PORT=5432
55
- - image: circleci/postgres:9.6
56
- environment:
57
- - POSTGRES_USER=postgres
58
- - POSTGRES_DB=statesman_test
59
- - POSTGRES_PASSWORD=statesman
60
- steps: *steps
61
-
62
- build-ruby265-rails-602-mysql:
63
- docker:
64
- - image: circleci/ruby:2.6.5-node
65
- environment:
66
- - RAILS_VERSION=6.0.2
67
- - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
68
- - DATABASE_DEPENDENCY_PORT=3306
69
- - image: circleci/mysql:5.7.18
70
- environment:
71
- - MYSQL_ALLOW_EMPTY_PASSWORD=true
72
- - MYSQL_USER=root
73
- - MYSQL_PASSWORD=
74
- - MYSQL_DATABASE=statesman_test
75
- steps: *steps
76
- build-ruby265-rails-602-postgres:
77
- docker:
78
- - image: circleci/ruby:2.6.5-node
79
- environment:
80
- - RAILS_VERSION=6.0.2
81
- - DATABASE_URL=postgres://postgres@localhost/statesman_test
82
- - DATABASE_DEPENDENCY_PORT=5432
83
- - image: circleci/postgres:9.6
84
- environment:
85
- - POSTGRES_USER=postgres
86
- - POSTGRES_DB=statesman_test
87
- - POSTGRES_PASSWORD=statesman
88
- steps: *steps
89
- build-ruby265-rails-master-mysql:
90
- docker:
91
- - image: circleci/ruby:2.6.5-node
92
- environment:
93
- - RAILS_VERSION=master
94
- - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
95
- - DATABASE_DEPENDENCY_PORT=3306
96
- - image: circleci/mysql:5.7.18
97
- environment:
98
- - MYSQL_ALLOW_EMPTY_PASSWORD=true
99
- - MYSQL_USER=root
100
- - MYSQL_PASSWORD=
101
- - MYSQL_DATABASE=statesman_test
102
- steps: *steps
103
- build-ruby265-rails-master-postgres:
104
- docker:
105
- - image: circleci/ruby:2.6.5-node
106
- environment:
107
- - RAILS_VERSION=master
108
- - DATABASE_URL=postgres://postgres@localhost/statesman_test
109
- - EXCLUDE_MONGOID=true
110
- - DATABASE_DEPENDENCY_PORT=5432
111
- - image: circleci/postgres:9.6
112
- environment:
113
- - POSTGRES_USER=postgres
114
- - POSTGRES_DB=statesman_test
115
- - POSTGRES_PASSWORD=statesman
116
- steps: *steps
117
-
118
- build-ruby270-rails-602-mysql:
119
- docker:
120
- - image: circleci/ruby:2.7.0-node
121
- environment:
122
- - RAILS_VERSION=6.0.2
123
- - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
124
- - DATABASE_DEPENDENCY_PORT=3306
125
- - image: circleci/mysql:5.7.18
126
- environment:
127
- - MYSQL_ALLOW_EMPTY_PASSWORD=true
128
- - MYSQL_USER=root
129
- - MYSQL_PASSWORD=
130
- - MYSQL_DATABASE=statesman_test
131
- steps: *steps
132
- build-ruby270-rails-602-postgres:
133
- docker:
134
- - image: circleci/ruby:2.7.0-node
135
- environment:
136
- - RAILS_VERSION=6.0.2
137
- - DATABASE_URL=postgres://postgres@localhost/statesman_test
138
- - DATABASE_DEPENDENCY_PORT=5432
139
- - image: circleci/postgres:9.6
140
- environment:
141
- - POSTGRES_USER=postgres
142
- - POSTGRES_DB=statesman_test
143
- - POSTGRES_PASSWORD=statesman
144
- steps: *steps
145
- build-ruby270-rails-master-mysql:
146
- docker:
147
- - image: circleci/ruby:2.7.0-node
148
- environment:
149
- - RAILS_VERSION=master
150
- - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
151
- - DATABASE_DEPENDENCY_PORT=3306
152
- - image: circleci/mysql:5.7.18
153
- environment:
154
- - MYSQL_ALLOW_EMPTY_PASSWORD=true
155
- - MYSQL_USER=root
156
- - MYSQL_PASSWORD=
157
- - MYSQL_DATABASE=statesman_test
158
- steps: *steps
159
- build-ruby270-rails-master-postgres:
160
- docker:
161
- - image: circleci/ruby:2.7.0-node
162
- environment:
163
- - RAILS_VERSION=master
164
- - DATABASE_URL=postgres://postgres@localhost/statesman_test
165
- - EXCLUDE_MONGOID=true
166
- - DATABASE_DEPENDENCY_PORT=5432
167
- - image: circleci/postgres:9.6
168
- environment:
169
- - POSTGRES_USER=postgres
170
- - POSTGRES_DB=statesman_test
171
- - POSTGRES_PASSWORD=statesman
172
- steps: *steps
173
-
174
- workflows:
175
- version: 2
176
- tests:
177
- jobs:
178
- - build-ruby249-rails-524-mysql
179
- - build-ruby249-rails-524-postgres
180
- - build-ruby265-rails-602-mysql
181
- - build-ruby265-rails-602-postgres
182
- - build-ruby265-rails-master-mysql
183
- - build-ruby265-rails-master-postgres
184
- - build-ruby270-rails-602-mysql
185
- - build-ruby270-rails-602-postgres
186
- - build-ruby270-rails-master-mysql
187
- - build-ruby270-rails-master-postgres