activerecord-simple_index_name 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e50274a424bd7bbeeed9d7513b5765f942f7c96be03a8f02e1c1500d019138c
4
- data.tar.gz: 4e5159fb7eb1b34b764bb11912095700e7499a065d0e591764c070f8b344a375
3
+ metadata.gz: cfe687f13f57f5ccc76c31edbd72d16148dfcee0943df043a733e32656e3f759
4
+ data.tar.gz: fd6ce85a38b133f2c74aeea9ac131bf191fb52fa0e877470b04ac32c5347d798
5
5
  SHA512:
6
- metadata.gz: cd4e7cd63434a6bc7b31d999f3ab4f6a4c838573ec2afafeec2cb6387d0275efd207e46e51a32758e100f35451ba3c754e28427ea81726b831b17acb286957ca
7
- data.tar.gz: 409675660eac35364d4310794e413425bae3f7103390031c9fead0a5b02a59dd0b9a24941fb714398847ac52f8c88b961f1999d1d88db114418a2753f34ec35d
6
+ metadata.gz: 056a3d0d3427acf88c7200e88a0e4b2b89d9373cdc49a10a06098d823787f7b0dea5fb9a41f2547c3e249c0727b323c8d297d376cca869d1e168e7391ef6f7c8
7
+ data.tar.gz: f6b065227d6181d283965717afc31a5b91e4cd882bd69c13106f3148c305711bb46c0cddb85c30d6223c3531a2ad99fd08625a9a3c9ea87b70c9e0260991cd95
@@ -0,0 +1,10 @@
1
+ # c.f. https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2
+ version: 2
3
+
4
+ updates:
5
+ - package-ecosystem: github-actions
6
+ directory: /
7
+ schedule:
8
+ interval: weekly
9
+ assignees:
10
+ - sue445
@@ -0,0 +1,62 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy static content to Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches:
8
+ - master
9
+
10
+ # Allows you to run this workflow manually from the Actions tab
11
+ workflow_dispatch:
12
+
13
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14
+ permissions:
15
+ contents: read
16
+ pages: write
17
+ id-token: write
18
+
19
+ # Allow one concurrent deployment
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: true
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ environment:
28
+ name: github-pages
29
+ url: ${{ steps.deployment.outputs.page_url }}
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v4
34
+
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ruby
38
+ bundler-cache: true
39
+
40
+ - run: bundle exec yard
41
+
42
+ - name: Setup Pages
43
+ uses: actions/configure-pages@v3
44
+ - name: Upload artifact
45
+ uses: actions/upload-pages-artifact@v2
46
+ with:
47
+ # Upload entire repository
48
+ path: './doc'
49
+ - name: Deploy to GitHub Pages
50
+ id: deployment
51
+ uses: actions/deploy-pages@main
52
+
53
+ - name: Slack Notification (not success)
54
+ uses: lazy-actions/slatify@master
55
+ if: "! success()"
56
+ continue-on-error: true
57
+ with:
58
+ job_name: "*pages*"
59
+ type: ${{ job.status }}
60
+ icon_emoji: ":octocat:"
61
+ url: ${{ secrets.SLACK_WEBHOOK }}
62
+ token: ${{ secrets.GITHUB_TOKEN }}
@@ -16,94 +16,106 @@ jobs:
16
16
  test:
17
17
  runs-on: ubuntu-latest
18
18
 
19
- container: ${{ matrix.ruby }}
20
-
21
19
  strategy:
22
20
  fail-fast: false
23
21
 
24
22
  matrix:
25
23
  ruby:
26
- - ruby:2.3
27
- - ruby:2.4
28
- - ruby:2.5
29
- - ruby:2.6
30
- - ruby:2.7
31
- - ruby:3.0
32
- - rubylang/ruby:master-nightly-bionic
24
+ - "2.3"
25
+ - "2.4"
26
+ - "2.5"
27
+ - "2.6"
28
+ - "2.7"
29
+ - "3.0"
30
+ - "3.1"
31
+ - "3.2"
33
32
  gemfile:
34
33
  - rails_5_0
35
34
  - rails_5_1
36
35
  - rails_5_2
37
36
  - rails_6_0
38
37
  - rails_6_1
39
- include:
40
- - ruby: rubylang/ruby:master-nightly-bionic
41
- allow_failures: "true"
38
+ - rails_7_0
39
+ - rails_7_1
42
40
 
43
41
  exclude:
44
42
  # Rails 6.0+ requires Ruby 2.5+
45
- - ruby: ruby:2.3
43
+ - ruby: "2.3"
46
44
  gemfile: rails_6_0
47
- - ruby: ruby:2.4
45
+ - ruby: "2.4"
48
46
  gemfile: rails_6_0
49
- - ruby: ruby:2.3
47
+ - ruby: "2.3"
50
48
  gemfile: rails_6_1
51
- - ruby: ruby:2.4
49
+ - ruby: "2.4"
52
50
  gemfile: rails_6_1
53
51
 
52
+ # Rails 7.0+ requires Ruby 2.7+
53
+ - ruby: "2.3"
54
+ gemfile: rails_7_0
55
+ - ruby: "2.4"
56
+ gemfile: rails_7_0
57
+ - ruby: "2.5"
58
+ gemfile: rails_7_0
59
+ - ruby: "2.6"
60
+ gemfile: rails_7_0
61
+ - ruby: "2.3"
62
+ gemfile: rails_7_1
63
+ - ruby: "2.4"
64
+ gemfile: rails_7_1
65
+ - ruby: "2.5"
66
+ gemfile: rails_7_1
67
+ - ruby: "2.6"
68
+ gemfile: rails_7_1
69
+
54
70
  # Rails 5.x doesn't work on Ruby 3.0+
55
- - ruby: ruby:3.0
71
+ - ruby: "3.0"
72
+ gemfile: rails_5_0
73
+ - ruby: "3.0"
74
+ gemfile: rails_5_1
75
+ - ruby: "3.0"
76
+ gemfile: rails_5_2
77
+ - ruby: "3.1"
56
78
  gemfile: rails_5_0
57
- - ruby: ruby:3.0
79
+ - ruby: "3.1"
58
80
  gemfile: rails_5_1
59
- - ruby: ruby:3.0
81
+ - ruby: "3.1"
82
+ gemfile: rails_5_2
83
+ - ruby: "3.2"
84
+ gemfile: rails_5_0
85
+ - ruby: "3.2"
86
+ gemfile: rails_5_1
87
+ - ruby: "3.2"
60
88
  gemfile: rails_5_2
61
89
 
62
90
  env:
63
91
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
64
92
 
65
93
  steps:
66
- - uses: actions/checkout@v2
67
-
68
- - run: apt-get update && apt-get install -y libsqlite3-dev
94
+ - uses: actions/checkout@v4
69
95
 
70
- - name: Cache vendor/bundle
71
- uses: actions/cache@v1
72
- id: cache_gem
96
+ - uses: ruby/setup-ruby@v1
73
97
  with:
74
- path: vendor/bundle
75
- key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ github.sha }}
76
- restore-keys: |
77
- v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ matrix.gemfile }}-
78
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
79
-
80
- - name: bundle update
81
- run: |
82
- set -xe
83
- bundle config path vendor/bundle
84
- bundle update --jobs $(nproc) --retry 3
85
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
98
+ ruby-version: ${{ matrix.ruby }}
99
+ bundler-cache: true
100
+ cache-version: ${{ matrix.gemfile }}
101
+
102
+ - run: bundle update --jobs $(nproc) --retry 3
86
103
 
87
104
  - name: Setup Code Climate Test Reporter
88
105
  uses: aktions/codeclimate-test-reporter@v1
89
106
  with:
90
107
  codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
91
108
  command: before-build
92
- if: matrix.ruby >= 'ruby:2.4'
93
109
  continue-on-error: true
94
110
 
95
- - name: Run test
96
- run: |
97
- set -xe
98
- bundle exec rspec
99
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
111
+ - run: bundle exec rspec
100
112
 
101
113
  - name: Teardown Code Climate Test Reporter
102
114
  uses: aktions/codeclimate-test-reporter@v1
103
115
  with:
104
116
  codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
105
117
  command: after-build
106
- if: matrix.ruby >= 'ruby:2.4' && always()
118
+ if: always()
107
119
  continue-on-error: true
108
120
 
109
121
  - name: Slack Notification (not success)
data/.yardopts ADDED
@@ -0,0 +1,2 @@
1
+ --markup markdown
2
+ --no-private
data/CHANGELOG.md CHANGED
@@ -1,7 +1,13 @@
1
1
  # Change Log
2
2
 
3
3
  ## Unreleased
4
- [full changelog](http://github.com/sue445/activerecord-simple_index_name/compare/v1.0.1...master)
4
+ [full changelog](http://github.com/sue445/activerecord-simple_index_name/compare/v1.1.0...master)
5
+
6
+ ## v1.1.0
7
+ [full changelog](http://github.com/sue445/activerecord-simple_index_name/compare/v1.0.1...v1.1.0)
8
+
9
+ * Support activerecord 7.1
10
+ * https://github.com/sue445/activerecord-simple_index_name/pull/88
5
11
 
6
12
  ## v1.0.1
7
13
  [full changelog](http://github.com/sue445/activerecord-simple_index_name/compare/v1.0.0...v1.0.1)
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in activerecord-simple_index_name.gemspec
4
4
  gemspec
5
+
6
+ eval_gemfile "./gemfiles/common.gemfile"
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
19
19
  spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
20
+ spec.metadata["documentation_uri"] = "https://sue445.github.io/activerecord-simple_index_name/"
20
21
  spec.metadata["rubygems_mfa_required"] = "true"
21
22
 
22
23
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -28,11 +29,11 @@ Gem::Specification.new do |spec|
28
29
  spec.add_dependency "activesupport", ">= 5.0.0"
29
30
 
30
31
  spec.add_development_dependency "bundler"
31
- spec.add_development_dependency "coveralls"
32
+ spec.add_development_dependency "coveralls_reborn"
32
33
  spec.add_development_dependency "rails"
33
34
  spec.add_development_dependency "rake"
34
35
  spec.add_development_dependency "rspec"
35
- spec.add_development_dependency "rspec-power_assert"
36
36
  spec.add_development_dependency "simplecov"
37
37
  spec.add_development_dependency "sqlite3"
38
+ spec.add_development_dependency "yard"
38
39
  end
@@ -0,0 +1,4 @@
1
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.6.0")
2
+ # minitest v5.16.0+ requires ruby 2.6.0+
3
+ gem "minitest", "< 5.16.0"
4
+ end
@@ -4,3 +4,5 @@ gem "rails", "~> 5.0.0"
4
4
  gem "sqlite3", "~> 1.3.6"
5
5
 
6
6
  gemspec path: '../'
7
+
8
+ eval_gemfile "./common.gemfile"
@@ -4,3 +4,5 @@ gem "rails", "~> 5.1.0"
4
4
  gem "sqlite3", "~> 1.3.6"
5
5
 
6
6
  gemspec path: '../'
7
+
8
+ eval_gemfile "./common.gemfile"
@@ -4,3 +4,5 @@ gem "rails", "~> 5.2.0"
4
4
  gem "sqlite3", "~> 1.3.6"
5
5
 
6
6
  gemspec path: '../'
7
+
8
+ eval_gemfile "./common.gemfile"
@@ -6,3 +6,5 @@ gem "rails", "~> 6.0.0"
6
6
  gem "sqlite3", "~> 1.4"
7
7
 
8
8
  gemspec path: '../'
9
+
10
+ eval_gemfile "./common.gemfile"
@@ -6,3 +6,5 @@ gem "rails", "~> 6.1.0"
6
6
  gem "sqlite3", "~> 1.4"
7
7
 
8
8
  gemspec path: '../'
9
+
10
+ eval_gemfile "./common.gemfile"
@@ -0,0 +1,12 @@
1
+ source "https://rubygems.org"
2
+
3
+ # NOTE: Ruby 3.1 + Rails 7.0.0 doesn't work
4
+ # c.f. https://gist.github.com/yahonda/2776d8d7b6ea7045359f38c10449937b
5
+ gem "rails", "~> 7.0.1"
6
+
7
+ # c.f. https://github.com/rails/rails/blob/v7.0.0/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L13
8
+ gem "sqlite3", "~> 1.4"
9
+
10
+ gemspec path: '../'
11
+
12
+ eval_gemfile "./common.gemfile"
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 7.1.0"
4
+
5
+ # c.f. https://github.com/rails/rails/blob/v7.1.0/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L14
6
+ gem "sqlite3", "~> 1.4"
7
+
8
+ gemspec path: '../'
9
+
10
+ eval_gemfile "./common.gemfile"
@@ -1,25 +1,5 @@
1
- module ActiveRecord
2
- module SimpleIndexName
3
- module ActiveRecordExt
4
- def index_name(table_name, options)
5
- if ActiveRecord::SimpleIndexName.current_shorten? && Hash === options && options[:column]
6
- Array.wrap(options[:column]) * "_and_"
7
- else
8
- super
9
- end
10
- end
11
-
12
- def rename_index(table_name, old_name, new_name)
13
- if ActiveRecord::SimpleIndexName.current_shorten? && old_name == new_name
14
- # nop
15
- else
16
- super
17
- end
18
- end
19
- end
20
- end
21
- end
22
-
23
- ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
24
- prepend ActiveRecord::SimpleIndexName::ActiveRecordExt
1
+ if ActiveRecord.version >= Gem::Version.create("7.1.0")
2
+ require "active_record/simple_index_name/active_record_ext_7_1"
3
+ else
4
+ require "active_record/simple_index_name/active_record_ext_7_0"
25
5
  end
@@ -0,0 +1,25 @@
1
+ module ActiveRecord
2
+ module SimpleIndexName
3
+ module ActiveRecordExt_7_0
4
+ def index_name(table_name, options)
5
+ if ActiveRecord::SimpleIndexName.current_shorten? && Hash === options && options[:column]
6
+ Array.wrap(options[:column]) * "_and_"
7
+ else
8
+ super
9
+ end
10
+ end
11
+
12
+ def rename_index(table_name, old_name, new_name)
13
+ if ActiveRecord::SimpleIndexName.current_shorten? && old_name == new_name
14
+ # nop
15
+ else
16
+ super
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
24
+ prepend ActiveRecord::SimpleIndexName::ActiveRecordExt_7_0
25
+ end
@@ -0,0 +1,41 @@
1
+ module ActiveRecord
2
+ module SimpleIndexName
3
+ module ActiveRecordExt_7_1
4
+ module SchemaStatements
5
+ def generate_index_name(table_name, column)
6
+ if ActiveRecord::SimpleIndexName.current_shorten?
7
+ Array.wrap(column) * "_and_"
8
+ else
9
+ super
10
+ end
11
+ end
12
+
13
+ def rename_index(table_name, old_name, new_name)
14
+ if ActiveRecord::SimpleIndexName.current_shorten? && old_name == new_name
15
+ # nop
16
+ else
17
+ super
18
+ end
19
+ end
20
+ end
21
+
22
+ module V7_0
23
+ def legacy_index_name(table_name, options)
24
+ if ActiveRecord::SimpleIndexName.current_shorten? && Hash === options && options[:column]
25
+ Array.wrap(options[:column]) * "_and_"
26
+ else
27
+ super
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ ActiveRecord::ConnectionAdapters::SchemaStatements.class_eval do
36
+ prepend ActiveRecord::SimpleIndexName::ActiveRecordExt_7_1::SchemaStatements
37
+ end
38
+
39
+ ActiveRecord::Migration::Compatibility::V7_0.class_eval do
40
+ prepend ActiveRecord::SimpleIndexName::ActiveRecordExt_7_1::V7_0
41
+ end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module SimpleIndexName
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-simple_index_name
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-19 00:00:00.000000000 Z
11
+ date: 2023-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: coveralls
56
+ name: coveralls_reborn
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec-power_assert
112
+ name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: simplecov
126
+ name: sqlite3
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: sqlite3
140
+ name: yard
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
@@ -158,9 +158,12 @@ extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
160
  - ".coveralls.yml"
161
+ - ".github/dependabot.yml"
162
+ - ".github/workflows/pages.yml"
161
163
  - ".github/workflows/test.yml"
162
164
  - ".gitignore"
163
165
  - ".rspec"
166
+ - ".yardopts"
164
167
  - CHANGELOG.md
165
168
  - Gemfile
166
169
  - LICENSE.txt
@@ -169,13 +172,18 @@ files:
169
172
  - activerecord-simple_index_name.gemspec
170
173
  - bin/console
171
174
  - bin/setup
175
+ - gemfiles/common.gemfile
172
176
  - gemfiles/rails_5_0.gemfile
173
177
  - gemfiles/rails_5_1.gemfile
174
178
  - gemfiles/rails_5_2.gemfile
175
179
  - gemfiles/rails_6_0.gemfile
176
180
  - gemfiles/rails_6_1.gemfile
181
+ - gemfiles/rails_7_0.gemfile
182
+ - gemfiles/rails_7_1.gemfile
177
183
  - lib/active_record/simple_index_name.rb
178
184
  - lib/active_record/simple_index_name/active_record_ext.rb
185
+ - lib/active_record/simple_index_name/active_record_ext_7_0.rb
186
+ - lib/active_record/simple_index_name/active_record_ext_7_1.rb
179
187
  - lib/active_record/simple_index_name/configuration.rb
180
188
  - lib/active_record/simple_index_name/disable_shorten.rb
181
189
  - lib/active_record/simple_index_name/enable_shorten.rb
@@ -190,6 +198,7 @@ metadata:
190
198
  homepage_uri: https://github.com/sue445/activerecord-simple_index_name
191
199
  source_code_uri: https://github.com/sue445/activerecord-simple_index_name
192
200
  changelog_uri: https://github.com/sue445/activerecord-simple_index_name/blob/master/CHANGELOG.md
201
+ documentation_uri: https://sue445.github.io/activerecord-simple_index_name/
193
202
  rubygems_mfa_required: 'true'
194
203
  post_install_message:
195
204
  rdoc_options: []
@@ -206,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
215
  - !ruby/object:Gem::Version
207
216
  version: '0'
208
217
  requirements: []
209
- rubygems_version: 3.2.22
218
+ rubygems_version: 3.4.10
210
219
  signing_key:
211
220
  specification_version: 4
212
221
  summary: Shorten index name