statesman 9.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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/devcontainer.json +31 -0
  3. data/.devcontainer/docker-compose.yml +39 -0
  4. data/.github/workflows/tests.yml +130 -0
  5. data/.gitignore +65 -15
  6. data/.rspec +2 -0
  7. data/.rubocop.yml +11 -1
  8. data/.rubocop_todo.yml +23 -38
  9. data/.ruby-version +1 -1
  10. data/CHANGELOG.md +229 -43
  11. data/CONTRIBUTING.md +14 -13
  12. data/Gemfile +18 -3
  13. data/README.md +203 -74
  14. data/docs/COMPATIBILITY.md +3 -3
  15. data/lib/generators/statesman/active_record_transition_generator.rb +1 -1
  16. data/lib/generators/statesman/generator_helpers.rb +2 -2
  17. data/lib/statesman/adapters/active_record.rb +69 -52
  18. data/lib/statesman/adapters/active_record_queries.rb +15 -7
  19. data/lib/statesman/adapters/active_record_transition.rb +5 -1
  20. data/lib/statesman/adapters/memory.rb +1 -1
  21. data/lib/statesman/adapters/type_safe_active_record_queries.rb +21 -0
  22. data/lib/statesman/callback.rb +2 -2
  23. data/lib/statesman/config.rb +3 -10
  24. data/lib/statesman/exceptions.rb +9 -7
  25. data/lib/statesman/guard.rb +1 -1
  26. data/lib/statesman/machine.rb +60 -0
  27. data/lib/statesman/version.rb +1 -1
  28. data/lib/statesman.rb +5 -5
  29. data/lib/tasks/statesman.rake +5 -5
  30. data/spec/generators/statesman/active_record_transition_generator_spec.rb +7 -1
  31. data/spec/generators/statesman/migration_generator_spec.rb +5 -1
  32. data/spec/spec_helper.rb +44 -7
  33. data/spec/statesman/adapters/active_record_queries_spec.rb +8 -10
  34. data/spec/statesman/adapters/active_record_spec.rb +144 -55
  35. data/spec/statesman/adapters/active_record_transition_spec.rb +5 -2
  36. data/spec/statesman/adapters/memory_spec.rb +0 -1
  37. data/spec/statesman/adapters/memory_transition_spec.rb +0 -1
  38. data/spec/statesman/adapters/shared_examples.rb +6 -7
  39. data/spec/statesman/adapters/type_safe_active_record_queries_spec.rb +206 -0
  40. data/spec/statesman/callback_spec.rb +0 -2
  41. data/spec/statesman/config_spec.rb +0 -2
  42. data/spec/statesman/exceptions_spec.rb +8 -4
  43. data/spec/statesman/guard_spec.rb +0 -2
  44. data/spec/statesman/machine_spec.rb +231 -19
  45. data/spec/statesman/utils_spec.rb +0 -2
  46. data/spec/support/active_record.rb +156 -29
  47. data/spec/support/exactly_query_databases.rb +35 -0
  48. data/statesman.gemspec +2 -17
  49. metadata +14 -238
  50. data/.circleci/config.yml +0 -127
data/.circleci/config.yml DELETED
@@ -1,127 +0,0 @@
1
- ---
2
- version: 2.1
3
-
4
- references:
5
- bundle_install: &bundle_install
6
- run:
7
- name: Bundle
8
- command: |
9
- gem install bundler --no-document && \
10
- bundle config set no-cache 'true' && \
11
- bundle config set jobs '4' && \
12
- bundle config set retry '3' && \
13
- bundle install
14
-
15
- cache_bundle: &cache_bundle
16
- save_cache:
17
- key: bundle-<< parameters.ruby_version >>-<< parameters.rails_version >>-{{ checksum "statesman.gemspec" }}-{{ checksum "Gemfile" }}
18
- paths:
19
- - vendor/bundle
20
-
21
- restore_bundle: &restore_bundle
22
- restore_cache:
23
- key: bundle-<< parameters.ruby_version >>-<< parameters.rails_version >>-{{ checksum "statesman.gemspec" }}-{{ checksum "Gemfile" }}
24
-
25
- steps: &steps
26
- - add_ssh_keys
27
- - checkout
28
- - run:
29
- name: "Add dependencies"
30
- command: |
31
- sudo apt-get update && sudo apt-get install -y sqlite3 libsqlite3-dev
32
- - *restore_bundle
33
- - *bundle_install
34
- - *cache_bundle
35
- - run: dockerize -wait tcp://localhost:$DATABASE_DEPENDENCY_PORT -timeout 1m
36
- - run:
37
- name: Run specs
38
- command: |
39
- bundle exec rspec $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) --profile --format progress --format RspecJunitFormatter -o /tmp/circle_artifacts/rspec.xml
40
- - run:
41
- name: "Rubocop"
42
- command: bundle exec rubocop --extra-details --display-style-guide --parallel --force-exclusion
43
- - store_artifacts:
44
- path: /tmp/circle_artifacts/
45
- - store_test_results:
46
- path: /tmp/circle_artifacts/
47
-
48
- ruby_versions: &ruby_versions
49
- - "2.5"
50
- - "2.6"
51
- - "2.7"
52
- - "3.0"
53
-
54
- rails_versions: &rails_versions
55
- - "5.2.6"
56
- - "6.0.4"
57
- - "6.1.4"
58
- - "main"
59
-
60
- mysql_versions: &mysql_versions
61
- - "5.7.18"
62
-
63
- psql_versions: &psql_versions
64
- - "9.6"
65
-
66
- jobs:
67
- rspec_mysql:
68
- working_directory: /mnt/ramdisk
69
- parameters:
70
- ruby_version:
71
- type: string
72
- rails_version:
73
- type: string
74
- mysql_version:
75
- type: string
76
- docker:
77
- - image: cimg/ruby:<< parameters.ruby_version >>
78
- environment:
79
- CIRCLE_TEST_REPORTS: /tmp/circle_artifacts/
80
- DATABASE_URL: mysql2://foobar:password@127.0.0.1/statesman_test
81
- DATABASE_DEPENDENCY_PORT: "3306"
82
- - image: circleci/mysql:<< parameters.mysql_version >>
83
- environment:
84
- MYSQL_ROOT_PASSWORD: password
85
- MYSQL_USER: foobar
86
- MYSQL_PASSWORD: password
87
- MYSQL_DATABASE: statesman_test
88
- steps: *steps
89
-
90
- rspec_postgres:
91
- working_directory: /mnt/ramdisk
92
- parameters:
93
- ruby_version:
94
- type: string
95
- rails_version:
96
- type: string
97
- psql_version:
98
- type: string
99
- docker:
100
- - image: cimg/ruby:<< parameters.ruby_version >>
101
- environment:
102
- CIRCLE_TEST_REPORTS: /tmp/circle_artifacts/
103
- DATABASE_URL: postgres://postgres@localhost/statesman_test
104
- DATABASE_DEPENDENCY_PORT: "5432"
105
- - image: circleci/postgres:<< parameters.psql_version >>
106
- environment:
107
- POSTGRES_USER: postgres
108
- POSTGRES_DB: statesman_test
109
- POSTGRES_PASSWORD: statesman
110
- steps: *steps
111
-
112
- workflows:
113
- version: 2
114
- tests:
115
- jobs:
116
- - rspec_mysql:
117
- matrix:
118
- parameters:
119
- mysql_version: *mysql_versions
120
- ruby_version: *ruby_versions
121
- rails_version: *rails_versions
122
- - rspec_postgres:
123
- matrix:
124
- parameters:
125
- psql_version: *psql_versions
126
- ruby_version: *ruby_versions
127
- rails_version: *rails_versions