auto_increment 1.6.2 → 1.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14ed27569367fada694d47fa228d8d0ae3774f5388d01d292ee6bb92548591a2
4
- data.tar.gz: e360967b97bec3c8cf83b8362319f5b1622c875a7190b82ff74db43fff9983b4
3
+ metadata.gz: 6e6fac57cfcbd6ca149f29207cd476b1962f324ec814f940614d945bbb4fe96b
4
+ data.tar.gz: 723f6146d6346ef0593f67b611f0f54fb42c0d973ee3cd390a8fedf4384c6b69
5
5
  SHA512:
6
- metadata.gz: 90558725fb565ed8dfb589c3b81210a87eb96dae11ee6252bf3fac7e664bdf9c93db378a3096caa97940de6ef5f7c0dd9c92f08f1d36e44d8431524f9de86e23
7
- data.tar.gz: e53fdeb1c95d043aa34866984c5859297c86bf6f8d66429bd1b18b6daf6b1374d979824c802a1884815df3e613930a0f4ae49853dc072e3f5406a8c0185411e1
6
+ metadata.gz: 5dbe5d91f2566e78b34fbbe610dfc831740b1433d255ab22f7c43c8d8eb39babb070559d2e70f67266ae475dcb2691cebb801b803346bae23fa6b83834bc24ea
7
+ data.tar.gz: f30c9187c8fd7b3dd97805841578e818278f50664552aa964d75ee408cc41b672c9f56112d1c800703c4ff2a81987dc7821e4a7a3f0c006a7277265b4f2c1ff4
@@ -0,0 +1,47 @@
1
+ name: CI
2
+ on:
3
+ workflow_dispatch:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - "*"
10
+ jobs:
11
+ standard:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ checks: write
15
+ contents: read
16
+ steps:
17
+ - name: Standard Ruby
18
+ uses: standardrb/standard-ruby-action@eecb3f730879f5b8830705348c2961e5aa26de78 # v1.5.0
19
+ with:
20
+ autofix: false
21
+ test:
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ ruby: ["3.3.11", "3.4.9", "4.0.5"]
26
+ gemfile: [rails_7_1, rails_7_2, rails_8_0, rails_8_1]
27
+ exclude:
28
+ - ruby: "3.3.11"
29
+ gemfile: rails_8_0
30
+ - ruby: "3.3.11"
31
+ gemfile: rails_8_1
32
+ - ruby: "4.0.5"
33
+ gemfile: rails_7_1
34
+ runs-on: ubuntu-latest
35
+ permissions:
36
+ contents: read
37
+ env:
38
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
39
+ steps:
40
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
41
+ with:
42
+ persist-credentials: false
43
+ - uses: ruby/setup-ruby@89f90524b88a01fe6e0b732220432cc6142926af # v1.313.0
44
+ with:
45
+ ruby-version: ${{ matrix.ruby }}
46
+ bundler-cache: true
47
+ - run: bundle exec rspec
data/.gitignore CHANGED
@@ -13,6 +13,7 @@
13
13
  !/log/.keep
14
14
  !/tmp/.keep
15
15
  /spec/db
16
+ !/spec/db/.keep
16
17
  /tags
17
18
  pkg
18
19
  *.ipr
@@ -22,4 +23,4 @@ pkg
22
23
  .byebug_history
23
24
  gemfiles/.bundle/
24
25
  .yardoc
25
- /doc
26
+ /doc
data/.rubocop.yml CHANGED
@@ -1,44 +1,10 @@
1
- Gemspec/RequiredRubyVersion:
2
- Enabled: false
3
-
4
- Metrics/AbcSize:
5
- Enabled: false
6
-
7
- Metrics/BlockLength:
8
- Enabled: false
9
-
10
- Metrics/BlockNesting:
11
- Enabled: false
12
-
13
- Metrics/ClassLength:
14
- Enabled: false
15
-
16
- Metrics/CollectionLiteralLength:
17
- Enabled: false
18
-
19
- Metrics/CyclomaticComplexity:
20
- Enabled: false
21
-
22
- Metrics/MethodLength:
23
- Enabled: false
24
-
25
- Metrics/ModuleLength:
26
- Enabled: false
27
-
28
- Metrics/ParameterLists:
29
- Enabled: false
30
-
31
- Metrics/PerceivedComplexity:
32
- Enabled: false
33
-
34
- Style/StringLiterals:
35
- Exclude:
36
- - "gemfiles/*"
37
-
38
- Style/FrozenStringLiteralComment:
39
- Exclude:
40
- - "gemfiles/*"
41
-
42
- AllCops:
43
- TargetRubyVersion: 3.2
44
- NewCops: enable
1
+ require:
2
+ - standard
3
+ - standard-custom
4
+ - standard-performance
5
+ - rubocop-performance
6
+
7
+ inherit_gem:
8
+ standard: config/base.yml
9
+ standard-custom: config/base.yml
10
+ standard-performance: config/base.yml
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.4.9
data/Appraisals CHANGED
@@ -1,15 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RAILS_VERSIONS = {
4
- '6_0' => '6.0.6.1',
5
- '6_1' => '6.1.7.6',
6
- '7_0' => '7.0.8',
7
- '7_1' => '7.1.2'
4
+ "7_1" => "7.1.6",
5
+ "7_2" => "7.2.3.1",
6
+ "8_0" => "8.0.5",
7
+ "8_1" => "8.1.3"
8
8
  }.freeze
9
9
 
10
10
  RAILS_VERSIONS.each do |name, version|
11
11
  appraise "rails_#{name}" do
12
- gem 'activerecord', version
13
- gem 'activesupport', version
12
+ gem "activerecord", version
13
+ gem "activesupport", version
14
+ group :development do
15
+ gem "standard"
16
+ end
14
17
  end
15
18
  end
data/CHANGELOG.md ADDED
@@ -0,0 +1,120 @@
1
+ # Changelog
2
+
3
+ ## [1.7.0] - 2026-06-28
4
+
5
+ ### Added
6
+
7
+ - Thread safety via `lock:` option, acquires a DB row lock when computing the next value
8
+ - Automatic type-aware default for `initial`, inferred from the database column type (`"1"` for string/text, `1` for integer)
9
+ - Deprecation warning when `initial` type doesn't match the database column type
10
+
11
+ ### Fixed
12
+
13
+ - Locked relation chaining with scopes (`lock: true` no longer breaks query chaining)
14
+ - String columns with integer `initial` now auto-detect column type and default correctly
15
+
16
+ ### Changed
17
+
18
+ - Incrementor API rewritten: `Incrementor.new(record, column, **options)` replaces the old positional hash
19
+ - Callback dispatch moved into `ActiveRecord::ClassMethods#auto_increment`
20
+ - Upgraded CI to GitHub Actions with scheduled workflow
21
+ - Added StandardRB (Ruby linting)
22
+ - Support for Ruby 3.3.5, 3.4.x, 4.0.x and Rails 7.1, 7.2, 8.0, 8.1
23
+ - Tests rewritten to verify behavior through the public API
24
+ - Bumped development dependencies (rexml, concurrent-ruby)
25
+
26
+ ## [1.6.2] - 2024-05-18
27
+
28
+ ### Fixed
29
+
30
+ - Bumped rexml from 3.2.6 to 3.2.8 for security
31
+
32
+ ## [1.6.1] - 2024-01-02
33
+
34
+ ### Changed
35
+
36
+ - Removed deprecation warning for `scope` parameter
37
+
38
+ ## [1.6.0] - 2024-01-02
39
+
40
+ ### Added
41
+
42
+ - Support for Rails 6.1.0 and 7.0.3.1
43
+
44
+ ### Deprecated
45
+
46
+ - `scope:` parameter is deprecated in favor of `model_scope:`
47
+
48
+ ### Changed
49
+
50
+ - Migrated CI from Travis to CircleCI
51
+ - Updated supported Rails versions
52
+
53
+ ## [1.5.1] - 2019-03-14
54
+
55
+ ### Added
56
+
57
+ - Support for Rails 6
58
+
59
+ ### Changed
60
+
61
+ - Updated Ruby versions to 2.5.4 and 2.6.2
62
+
63
+ ## [1.5.0] - 2018-01-21
64
+
65
+ ### Added
66
+
67
+ - `model_scope` option to apply ActiveRecord scopes before computing the maximum value
68
+ - Support for Rails 5.2
69
+
70
+ ### Changed
71
+
72
+ - Renamed `model_scopes` to `model_scope`
73
+
74
+ ## [1.4.1] - 2017-05-04
75
+
76
+ ### Added
77
+
78
+ - Support for Rails 5.1 via Appraisal
79
+
80
+ ## [1.4.0] - 2016-11-04
81
+
82
+ ### Added
83
+
84
+ - `before:` option to choose which callback to use (`:create`, `:save`, `:validation`)
85
+ - Rubocop linting
86
+
87
+ ## [1.3.0] - 2016-07-19
88
+
89
+ ### Added
90
+
91
+ - Support for Rails 5 via Appraisal
92
+
93
+ ## [1.2.0] - 2015-06-18
94
+
95
+ ### Changed
96
+
97
+ - Breaking: arguments split into separate `column` and `options` parameters
98
+ - Lock default changed to query object
99
+
100
+ ## [1.1.1] - 2015-05-05
101
+
102
+ ### Fixed
103
+
104
+ - Minor internal cleanup
105
+
106
+ ## [1.1.0] - 2015-03-26
107
+
108
+ ### Added
109
+
110
+ - `lock:` option for thread-safe increments
111
+ - Initial implementation of scoped sequences
112
+
113
+ ## [1.0.0] - 2014-04-15
114
+
115
+ ### Added
116
+
117
+ - Initial release
118
+ - Auto-increment integer columns with `before_create` callback
119
+ - Custom starting value via `initial:` option
120
+ - `force:` option to overwrite existing values
data/Gemfile CHANGED
@@ -1,5 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
+
7
+ group :development do
8
+ gem "appraisal"
9
+ gem "bundler"
10
+ gem "database_cleaner"
11
+ gem "fuubar"
12
+ gem "guard"
13
+ gem "guard-rspec"
14
+ gem "rake"
15
+ gem "rspec"
16
+ gem "rspec-nc"
17
+ gem "sqlite3", "~> 2.9.5"
18
+ gem "standard"
19
+ end
data/Gemfile.lock CHANGED
@@ -1,56 +1,61 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- auto_increment (1.6.0)
5
- activerecord (>= 6.0)
6
- activesupport (>= 6.0)
4
+ auto_increment (1.7.0)
5
+ activerecord (>= 7.1)
6
+ activesupport (>= 7.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (7.1.2)
12
- activesupport (= 7.1.2)
13
- activerecord (7.1.2)
14
- activemodel (= 7.1.2)
15
- activesupport (= 7.1.2)
11
+ activemodel (8.1.3)
12
+ activesupport (= 8.1.3)
13
+ activerecord (8.1.3)
14
+ activemodel (= 8.1.3)
15
+ activesupport (= 8.1.3)
16
16
  timeout (>= 0.4.0)
17
- activesupport (7.1.2)
17
+ activesupport (8.1.3)
18
18
  base64
19
19
  bigdecimal
20
- concurrent-ruby (~> 1.0, >= 1.0.2)
20
+ concurrent-ruby (~> 1.0, >= 1.3.1)
21
21
  connection_pool (>= 2.2.5)
22
22
  drb
23
23
  i18n (>= 1.6, < 2)
24
+ json
25
+ logger (>= 1.4.2)
24
26
  minitest (>= 5.1)
25
- mutex_m
26
- tzinfo (~> 2.0)
27
+ securerandom (>= 0.3)
28
+ tzinfo (~> 2.0, >= 2.0.5)
29
+ uri (>= 0.13.1)
27
30
  appraisal (2.5.0)
28
31
  bundler
29
32
  rake
30
33
  thor (>= 0.14.0)
31
- ast (2.4.2)
32
- base64 (0.2.0)
33
- bigdecimal (3.1.5)
34
+ ast (2.4.3)
35
+ base64 (0.3.0)
36
+ bigdecimal (4.1.2)
34
37
  coderay (1.1.3)
35
- concurrent-ruby (1.2.2)
36
- connection_pool (2.4.1)
37
- database_cleaner (2.0.2)
38
+ concurrent-ruby (1.3.7)
39
+ connection_pool (3.0.2)
40
+ database_cleaner (2.1.0)
38
41
  database_cleaner-active_record (>= 2, < 3)
39
- database_cleaner-active_record (2.1.0)
42
+ database_cleaner-active_record (2.2.2)
40
43
  activerecord (>= 5.a)
41
- database_cleaner-core (~> 2.0.0)
42
- database_cleaner-core (2.0.1)
43
- diff-lcs (1.5.0)
44
- drb (2.2.0)
45
- ruby2_keywords
46
- ffi (1.16.3)
47
- formatador (1.1.0)
44
+ database_cleaner-core (~> 2.0)
45
+ database_cleaner-core (2.1.0)
46
+ diff-lcs (1.6.2)
47
+ drb (2.2.3)
48
+ ffi (1.17.4)
49
+ ffi (1.17.4-x86_64-linux-gnu)
50
+ formatador (1.2.3)
51
+ reline
48
52
  fuubar (2.5.1)
49
53
  rspec-core (~> 3.0)
50
54
  ruby-progressbar (~> 1.4)
51
- guard (2.18.1)
55
+ guard (2.20.1)
52
56
  formatador (>= 0.2.4)
53
57
  listen (>= 2.7, < 4.0)
58
+ logger (~> 1.6)
54
59
  lumberjack (>= 1.0.12, < 2.0)
55
60
  nenv (~> 0.1)
56
61
  notiffany (~> 0.0)
@@ -62,80 +67,110 @@ GEM
62
67
  guard (~> 2.1)
63
68
  guard-compat (~> 1.1)
64
69
  rspec (>= 2.99.0, < 4.0)
65
- i18n (1.14.1)
70
+ i18n (1.14.8)
66
71
  concurrent-ruby (~> 1.0)
67
- json (2.7.1)
68
- language_server-protocol (3.17.0.3)
69
- listen (3.8.0)
72
+ io-console (0.8.2)
73
+ json (2.19.8)
74
+ language_server-protocol (3.17.0.5)
75
+ lint_roller (1.1.0)
76
+ listen (3.10.0)
77
+ logger
70
78
  rb-fsevent (~> 0.10, >= 0.10.3)
71
79
  rb-inotify (~> 0.9, >= 0.9.10)
72
- lumberjack (1.2.10)
73
- method_source (1.0.0)
74
- minitest (5.20.0)
75
- mutex_m (0.2.0)
80
+ logger (1.7.0)
81
+ lumberjack (1.4.2)
82
+ method_source (1.1.0)
83
+ mini_portile2 (2.8.9)
84
+ minitest (6.0.6)
85
+ drb (~> 2.0)
86
+ prism (~> 1.5)
76
87
  nenv (0.3.0)
77
88
  notiffany (0.1.3)
78
89
  nenv (~> 0.1)
79
90
  shellany (~> 0.0)
80
- parallel (1.24.0)
81
- parser (3.2.2.4)
91
+ parallel (1.28.0)
92
+ parser (3.3.11.1)
82
93
  ast (~> 2.4.1)
83
94
  racc
84
- pry (0.14.2)
95
+ prism (1.9.0)
96
+ pry (0.16.0)
85
97
  coderay (~> 1.1)
86
98
  method_source (~> 1.0)
87
- racc (1.7.3)
99
+ reline (>= 0.6.0)
100
+ racc (1.8.1)
88
101
  rainbow (3.1.1)
89
- rake (13.1.0)
102
+ rake (13.4.2)
90
103
  rb-fsevent (0.11.2)
91
- rb-inotify (0.10.1)
104
+ rb-inotify (0.11.1)
92
105
  ffi (~> 1.0)
93
- regexp_parser (2.8.3)
94
- rexml (3.2.8)
95
- strscan (>= 3.0.9)
96
- rspec (3.12.0)
97
- rspec-core (~> 3.12.0)
98
- rspec-expectations (~> 3.12.0)
99
- rspec-mocks (~> 3.12.0)
100
- rspec-core (3.12.2)
101
- rspec-support (~> 3.12.0)
102
- rspec-expectations (3.12.3)
106
+ regexp_parser (2.12.0)
107
+ reline (0.6.3)
108
+ io-console (~> 0.5)
109
+ rspec (3.13.2)
110
+ rspec-core (~> 3.13.0)
111
+ rspec-expectations (~> 3.13.0)
112
+ rspec-mocks (~> 3.13.0)
113
+ rspec-core (3.13.6)
114
+ rspec-support (~> 3.13.0)
115
+ rspec-expectations (3.13.5)
103
116
  diff-lcs (>= 1.2.0, < 2.0)
104
- rspec-support (~> 3.12.0)
105
- rspec-mocks (3.12.6)
117
+ rspec-support (~> 3.13.0)
118
+ rspec-mocks (3.13.8)
106
119
  diff-lcs (>= 1.2.0, < 2.0)
107
- rspec-support (~> 3.12.0)
120
+ rspec-support (~> 3.13.0)
108
121
  rspec-nc (0.3.0)
109
122
  rspec (>= 3)
110
123
  terminal-notifier (>= 1.4)
111
- rspec-support (3.12.1)
112
- rubocop (1.59.0)
124
+ rspec-support (3.13.7)
125
+ rubocop (1.84.2)
113
126
  json (~> 2.3)
114
- language_server-protocol (>= 3.17.0)
127
+ language_server-protocol (~> 3.17.0.2)
128
+ lint_roller (~> 1.1.0)
115
129
  parallel (~> 1.10)
116
- parser (>= 3.2.2.4)
130
+ parser (>= 3.3.0.2)
117
131
  rainbow (>= 2.2.2, < 4.0)
118
- regexp_parser (>= 1.8, < 3.0)
119
- rexml (>= 3.2.5, < 4.0)
120
- rubocop-ast (>= 1.30.0, < 2.0)
132
+ regexp_parser (>= 2.9.3, < 3.0)
133
+ rubocop-ast (>= 1.49.0, < 2.0)
121
134
  ruby-progressbar (~> 1.7)
122
- unicode-display_width (>= 2.4.0, < 3.0)
123
- rubocop-ast (1.30.0)
124
- parser (>= 3.2.1.0)
135
+ unicode-display_width (>= 2.4.0, < 4.0)
136
+ rubocop-ast (1.49.1)
137
+ parser (>= 3.3.7.2)
138
+ prism (~> 1.7)
139
+ rubocop-performance (1.26.1)
140
+ lint_roller (~> 1.1)
141
+ rubocop (>= 1.75.0, < 2.0)
142
+ rubocop-ast (>= 1.47.1, < 2.0)
125
143
  ruby-progressbar (1.13.0)
126
- ruby2_keywords (0.0.5)
144
+ securerandom (0.4.1)
127
145
  shellany (0.0.1)
128
- sqlite3 (1.4.2)
129
- strscan (3.1.0)
146
+ sqlite3 (2.9.5)
147
+ mini_portile2 (~> 2.8.0)
148
+ sqlite3 (2.9.5-x86_64-linux-gnu)
149
+ standard (1.54.0)
150
+ language_server-protocol (~> 3.17.0.2)
151
+ lint_roller (~> 1.0)
152
+ rubocop (~> 1.84.0)
153
+ standard-custom (~> 1.0.0)
154
+ standard-performance (~> 1.8)
155
+ standard-custom (1.0.2)
156
+ lint_roller (~> 1.0)
157
+ rubocop (~> 1.50)
158
+ standard-performance (1.9.0)
159
+ lint_roller (~> 1.1)
160
+ rubocop-performance (~> 1.26.0)
130
161
  terminal-notifier (2.0.0)
131
- thor (1.3.0)
132
- timeout (0.4.1)
162
+ thor (1.5.0)
163
+ timeout (0.6.1)
133
164
  tzinfo (2.0.6)
134
165
  concurrent-ruby (~> 1.0)
135
- unicode-display_width (2.5.0)
166
+ unicode-display_width (3.2.0)
167
+ unicode-emoji (~> 4.1)
168
+ unicode-emoji (4.2.0)
169
+ uri (1.1.1)
136
170
 
137
171
  PLATFORMS
138
172
  ruby
173
+ x86_64-linux
139
174
 
140
175
  DEPENDENCIES
141
176
  appraisal
@@ -148,8 +183,8 @@ DEPENDENCIES
148
183
  rake
149
184
  rspec
150
185
  rspec-nc
151
- rubocop
152
- sqlite3 (>= 1.3.13)
186
+ sqlite3 (~> 2.9.5)
187
+ standard
153
188
 
154
189
  BUNDLED WITH
155
190
  2.4.22
data/Guardfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- guard :rspec, cmd: 'bundle exec rspec' do
3
+ guard :rspec, cmd: "bundle exec rspec" do
4
4
  watch(%r{^spec/.+_spec\.rb$})
5
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
6
- watch('spec/spec_helper.rb') { 'spec' }
5
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
6
+ watch("spec/spec_helper.rb") { "spec" }
7
7
  end