statesman 7.4.0 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +7 -0
- data/.github/workflows/tests.yml +112 -0
- data/.gitignore +65 -15
- data/.rspec +1 -0
- data/.rubocop.yml +14 -1
- data/.rubocop_todo.yml +37 -28
- data/.ruby-version +1 -0
- data/CHANGELOG.md +262 -41
- data/CONTRIBUTING.md +23 -4
- data/Gemfile +4 -6
- data/README.md +243 -43
- data/docs/COMPATIBILITY.md +2 -2
- data/lib/generators/statesman/active_record_transition_generator.rb +1 -1
- data/lib/generators/statesman/generator_helpers.rb +12 -4
- data/lib/statesman/adapters/active_record.rb +84 -55
- data/lib/statesman/adapters/active_record_queries.rb +19 -7
- data/lib/statesman/adapters/active_record_transition.rb +5 -1
- data/lib/statesman/adapters/memory.rb +5 -1
- data/lib/statesman/adapters/type_safe_active_record_queries.rb +21 -0
- data/lib/statesman/callback.rb +2 -2
- data/lib/statesman/config.rb +3 -10
- data/lib/statesman/exceptions.rb +13 -7
- data/lib/statesman/guard.rb +1 -1
- data/lib/statesman/machine.rb +68 -0
- data/lib/statesman/version.rb +1 -1
- data/lib/statesman.rb +5 -5
- data/lib/tasks/statesman.rake +5 -5
- data/spec/generators/statesman/active_record_transition_generator_spec.rb +7 -1
- data/spec/generators/statesman/migration_generator_spec.rb +5 -1
- data/spec/spec_helper.rb +44 -7
- data/spec/statesman/adapters/active_record_queries_spec.rb +34 -12
- data/spec/statesman/adapters/active_record_spec.rb +176 -51
- data/spec/statesman/adapters/active_record_transition_spec.rb +5 -2
- data/spec/statesman/adapters/memory_spec.rb +0 -1
- data/spec/statesman/adapters/memory_transition_spec.rb +0 -1
- data/spec/statesman/adapters/shared_examples.rb +3 -4
- data/spec/statesman/adapters/type_safe_active_record_queries_spec.rb +206 -0
- data/spec/statesman/callback_spec.rb +0 -2
- data/spec/statesman/config_spec.rb +0 -2
- data/spec/statesman/exceptions_spec.rb +17 -4
- data/spec/statesman/guard_spec.rb +0 -2
- data/spec/statesman/machine_spec.rb +252 -15
- data/spec/statesman/utils_spec.rb +0 -2
- data/spec/support/active_record.rb +156 -24
- data/spec/support/exactly_query_databases.rb +35 -0
- data/statesman.gemspec +9 -10
- metadata +32 -59
- data/.circleci/config.yml +0 -187
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d49f534086023febd344f7eb73b162903a28e3fd77ee430856d42242aafda37c
|
4
|
+
data.tar.gz: aba9670be235de98143f0a2ae0d15b9b7b32c8a9699901049e5cd9d931e29981
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d68959bd95e90bd0a986de5dd7197d21ac5535a5500d5d528b599fd07d26611125ce7e926f33efb5140f2ecbffa1c78dbb66e6d5f2209eeabe95ee49a4a862f8
|
7
|
+
data.tar.gz: 449e98a18f512eaff9a1ea500f9415b016bc8e775f7e1b1a7b9ffc393038112b3689ff4e7d364cbff9be6d23e3c4768d373dda3df7339249b53aa7a9d2e33136
|
@@ -0,0 +1,112 @@
|
|
1
|
+
name: tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- "master"
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
concurrency:
|
10
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
11
|
+
cancel-in-progress: true
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
rubocop:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v3
|
18
|
+
- uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
bundler-cache: true
|
21
|
+
- run: bundle exec rubocop --extra-details --display-style-guide --parallel --force-exclusion
|
22
|
+
|
23
|
+
postgres:
|
24
|
+
strategy:
|
25
|
+
fail-fast: false
|
26
|
+
matrix:
|
27
|
+
ruby-version: ["3.0", "3.1", "3.2", "3.3"]
|
28
|
+
rails-version:
|
29
|
+
- "6.1.7.6"
|
30
|
+
- "7.0.8"
|
31
|
+
- "7.1.1"
|
32
|
+
- "main"
|
33
|
+
postgres-version: ["12", "13", "14", "15", "16"]
|
34
|
+
exclude:
|
35
|
+
- ruby-version: "3.2"
|
36
|
+
rails-version: "6.1.7.6"
|
37
|
+
- ruby-version: "3.3"
|
38
|
+
rails-version: "6.1.7.6"
|
39
|
+
runs-on: ubuntu-latest
|
40
|
+
services:
|
41
|
+
postgres:
|
42
|
+
image: postgres:${{ matrix.postgres-version }}
|
43
|
+
env:
|
44
|
+
POSTGRES_USER: postgres
|
45
|
+
POSTGRES_DB: statesman_test
|
46
|
+
POSTGRES_PASSWORD: statesman
|
47
|
+
ports:
|
48
|
+
- 5432:5432
|
49
|
+
options: >-
|
50
|
+
--health-cmd pg_isready
|
51
|
+
--health-interval 10s
|
52
|
+
--health-timeout 5s
|
53
|
+
--health-retries 10
|
54
|
+
env:
|
55
|
+
DATABASE_URL: postgres://postgres:statesman@localhost/statesman_test
|
56
|
+
DATABASE_DEPENDENCY_PORT: "5432"
|
57
|
+
steps:
|
58
|
+
- uses: actions/checkout@v3
|
59
|
+
- name: Set up Ruby
|
60
|
+
uses: ruby/setup-ruby@v1
|
61
|
+
with:
|
62
|
+
bundler-cache: true
|
63
|
+
ruby-version: "${{ matrix.ruby-version }}"
|
64
|
+
- name: Run specs
|
65
|
+
run: |
|
66
|
+
bundle exec rspec --profile --format progress --format RSpec::Github::Formatter
|
67
|
+
|
68
|
+
mysql:
|
69
|
+
strategy:
|
70
|
+
fail-fast: false
|
71
|
+
matrix:
|
72
|
+
ruby-version: ["3.0", "3.1", "3.2", "3.3"]
|
73
|
+
rails-version:
|
74
|
+
- "6.1.7.6"
|
75
|
+
- "7.0.8"
|
76
|
+
- "7.1.1"
|
77
|
+
- "main"
|
78
|
+
mysql-version: ["8.0", "8.2"]
|
79
|
+
exclude:
|
80
|
+
- ruby-version: "3.2"
|
81
|
+
rails-version: "6.1.7.6"
|
82
|
+
- ruby-version: "3.3"
|
83
|
+
rails-version: "6.1.7.6"
|
84
|
+
runs-on: ubuntu-latest
|
85
|
+
services:
|
86
|
+
mysql:
|
87
|
+
image: mysql:${{ matrix.mysql-version }}
|
88
|
+
env:
|
89
|
+
MYSQL_ROOT_PASSWORD: password
|
90
|
+
MYSQL_USER: foobar
|
91
|
+
MYSQL_PASSWORD: password
|
92
|
+
MYSQL_DATABASE: statesman_test
|
93
|
+
ports:
|
94
|
+
- "3306:3306"
|
95
|
+
options: >-
|
96
|
+
--health-cmd "mysqladmin ping"
|
97
|
+
--health-interval 10s
|
98
|
+
--health-timeout 5s
|
99
|
+
--health-retries 5
|
100
|
+
env:
|
101
|
+
DATABASE_URL: mysql2://foobar:password@127.0.0.1/statesman_test
|
102
|
+
DATABASE_DEPENDENCY_PORT: "3306"
|
103
|
+
steps:
|
104
|
+
- uses: actions/checkout@v3
|
105
|
+
- name: Set up Ruby
|
106
|
+
uses: ruby/setup-ruby@v1
|
107
|
+
with:
|
108
|
+
bundler-cache: true
|
109
|
+
ruby-version: "${{ matrix.ruby-version }}"
|
110
|
+
- name: Run specs
|
111
|
+
run: |
|
112
|
+
bundle exec rspec --profile --format progress --format RSpec::Github::Formatter
|
data/.gitignore
CHANGED
@@ -1,18 +1,68 @@
|
|
1
1
|
*.gem
|
2
2
|
*.rbc
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
7
48
|
Gemfile.lock
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
# .rubocop-https?--*
|
57
|
+
|
58
|
+
# VSCode
|
59
|
+
.vscode
|
60
|
+
|
61
|
+
# Local History for Visual Studio Code
|
62
|
+
.history/
|
63
|
+
|
64
|
+
# Built Visual Studio Code Extensions
|
65
|
+
*.vsix
|
66
|
+
|
67
|
+
# JetBrains
|
68
|
+
.idea
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
CHANGED
@@ -4,4 +4,17 @@ inherit_gem:
|
|
4
4
|
gc_ruboconfig: rubocop.yml
|
5
5
|
|
6
6
|
AllCops:
|
7
|
-
TargetRubyVersion:
|
7
|
+
TargetRubyVersion: 3.0
|
8
|
+
NewCops: enable
|
9
|
+
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Max: 60
|
12
|
+
|
13
|
+
Metrics/CyclomaticComplexity:
|
14
|
+
Max: 10
|
15
|
+
|
16
|
+
Metrics/PerceivedComplexity:
|
17
|
+
Max: 11
|
18
|
+
|
19
|
+
Gemspec/DevelopmentDependencies:
|
20
|
+
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
@@ -1,38 +1,42 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2021-08-09 15:32:40 UTC using RuboCop version 1.18.4.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: Include.
|
11
|
+
# Include: **/*.gemspec
|
9
12
|
Gemspec/RequiredRubyVersion:
|
10
|
-
|
13
|
+
Exclude:
|
14
|
+
- 'statesman.gemspec'
|
15
|
+
|
16
|
+
# Offense count: 1
|
17
|
+
Lint/MissingSuper:
|
18
|
+
Exclude:
|
19
|
+
- 'lib/statesman/adapters/active_record_queries.rb'
|
11
20
|
|
12
21
|
# Offense count: 5
|
22
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
13
23
|
Metrics/AbcSize:
|
14
|
-
Max:
|
24
|
+
Max: 20
|
25
|
+
|
26
|
+
# Offense count: 1
|
27
|
+
# Configuration parameters: IgnoredMethods.
|
28
|
+
Metrics/CyclomaticComplexity:
|
29
|
+
Max: 8
|
15
30
|
|
16
|
-
# Offense count:
|
17
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
31
|
+
# Offense count: 3
|
32
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
18
33
|
Metrics/MethodLength:
|
19
34
|
Max: 14
|
20
35
|
|
21
|
-
# Offense count:
|
22
|
-
#
|
23
|
-
# Configuration parameters: SkipBlocks, EnforcedStyle.
|
24
|
-
# SupportedStyles: described_class, explicit
|
25
|
-
RSpec/DescribedClass:
|
26
|
-
Exclude:
|
27
|
-
- 'spec/statesman/adapters/active_record_queries_spec.rb'
|
28
|
-
|
29
|
-
# Offense count: 7
|
30
|
-
# Configuration parameters: Max.
|
36
|
+
# Offense count: 11
|
37
|
+
# Configuration parameters: CountAsOne.
|
31
38
|
RSpec/ExampleLength:
|
32
|
-
|
33
|
-
- 'spec/statesman/adapters/active_record_spec.rb'
|
34
|
-
- 'spec/statesman/adapters/shared_examples.rb'
|
35
|
-
- 'spec/statesman/machine_spec.rb'
|
39
|
+
Max: 14
|
36
40
|
|
37
41
|
# Offense count: 7
|
38
42
|
RSpec/ExpectInHook:
|
@@ -40,11 +44,12 @@ RSpec/ExpectInHook:
|
|
40
44
|
- 'spec/statesman/adapters/active_record_spec.rb'
|
41
45
|
- 'spec/statesman/machine_spec.rb'
|
42
46
|
|
43
|
-
# Offense count:
|
44
|
-
|
47
|
+
# Offense count: 1
|
48
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
49
|
+
# Include: **/*_spec*rb*, **/spec/**/*
|
50
|
+
RSpec/FilePath:
|
45
51
|
Exclude:
|
46
|
-
- 'spec/statesman/
|
47
|
-
- 'spec/statesman/adapters/shared_examples.rb'
|
52
|
+
- 'spec/statesman/exceptions_spec.rb'
|
48
53
|
|
49
54
|
# Offense count: 1
|
50
55
|
# Configuration parameters: AssignmentOnly.
|
@@ -75,23 +80,27 @@ RSpec/MessageSpies:
|
|
75
80
|
Exclude:
|
76
81
|
- 'spec/statesman/callback_spec.rb'
|
77
82
|
|
78
|
-
# Offense count:
|
79
|
-
# Configuration parameters: AggregateFailuresByDefault.
|
83
|
+
# Offense count: 14
|
80
84
|
RSpec/MultipleExpectations:
|
81
85
|
Max: 3
|
82
86
|
|
83
|
-
# Offense count:
|
87
|
+
# Offense count: 49
|
84
88
|
RSpec/NestedGroups:
|
85
89
|
Max: 6
|
86
90
|
|
87
|
-
# Offense count:
|
91
|
+
# Offense count: 2
|
92
|
+
RSpec/RepeatedExampleGroupBody:
|
93
|
+
Exclude:
|
94
|
+
- 'spec/statesman/exceptions_spec.rb'
|
95
|
+
|
96
|
+
# Offense count: 12
|
88
97
|
RSpec/ScatteredSetup:
|
89
98
|
Exclude:
|
90
99
|
- 'spec/statesman/adapters/active_record_spec.rb'
|
91
100
|
- 'spec/statesman/adapters/shared_examples.rb'
|
92
101
|
- 'spec/statesman/machine_spec.rb'
|
93
102
|
|
94
|
-
# Offense count:
|
103
|
+
# Offense count: 7
|
95
104
|
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
96
105
|
RSpec/VerifiedDoubles:
|
97
106
|
Exclude:
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.3.0
|