acts_as_hashids 0.1.9 → 0.2.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: 3596c432648776928bf2fe96c990526a1e19b11f044944c0a79685f29b5e8265
4
- data.tar.gz: 5cffe582bcdc4e4e24f003d60ac1628027663e37e05762206e734763b63ed524
3
+ metadata.gz: 77914d64a62009531c31d89747f3dee76d259b2f7491f900a1efbb15fc2198de
4
+ data.tar.gz: 0612efc8ff01d70718107b65f192516644844433b452b3637f94aba5e12b0fcf
5
5
  SHA512:
6
- metadata.gz: 77c7368b389110f15973ab0de7023ac2b3d5aa263ba1e3ca09ebbf1528ac10c047697a9f37b5fea84301fe4639be99d214fce2ab996a003651cde8d32eca0736
7
- data.tar.gz: d2d6098dad02a66f9c1c3c8b973d06383bb108a3f302a39f5ac8262926ae1da7cb2299c6a0c49e0edf898df55ac892c0bc0b5bcf3849463ea0cc67ca4879ddf0
6
+ metadata.gz: cd1b61ab4289683f61f3b350135c00849213679055fb14e0de342289be75d8883354b33b95c0a3549fe0a41b786207b70b383c560664cc10038f4116099cf7a3
7
+ data.tar.gz: cf4cecd1d6e2881e628bb2c34072fff7c7578912633830eaef7ecd2c46ba136e141dffaefc1c1d4018f6a2f6b390048e91097a9d6d81b3a10352df80e0ae22a9
@@ -0,0 +1,76 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "master" ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ "master" ]
20
+ schedule:
21
+ - cron: '40 0 * * 3'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Use only 'java' to analyze code written in Java, Kotlin or both
38
+ # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
39
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
40
+
41
+ steps:
42
+ - name: Checkout repository
43
+ uses: actions/checkout@v3
44
+
45
+ # Initializes the CodeQL tools for scanning.
46
+ - name: Initialize CodeQL
47
+ uses: github/codeql-action/init@v2
48
+ with:
49
+ languages: ${{ matrix.language }}
50
+ # If you wish to specify custom queries, you can do so here or in a config file.
51
+ # By default, queries listed here will override any specified in a config file.
52
+ # Prefix the list here with "+" to use these queries and those in the config file.
53
+
54
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
55
+ # queries: security-extended,security-and-quality
56
+
57
+
58
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
59
+ # If this step fails, then you should remove it and run the build manually (see below)
60
+ - name: Autobuild
61
+ uses: github/codeql-action/autobuild@v2
62
+
63
+ # ℹ️ Command-line programs to run using the OS shell.
64
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
65
+
66
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
67
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
68
+
69
+ # - run: |
70
+ # echo "Run, Build Application using script"
71
+ # ./location_of_script_within_repo/buildscript.sh
72
+
73
+ - name: Perform CodeQL Analysis
74
+ uses: github/codeql-action/analyze@v2
75
+ with:
76
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,23 @@
1
+ name: Lint
2
+ on:
3
+ push:
4
+ branches: [ main ]
5
+ pull_request:
6
+ branches: [ main ]
7
+ jobs:
8
+ lint:
9
+ runs-on: ubuntu-20.04
10
+ steps:
11
+ - uses: actions/checkout@v3
12
+ - name: Set up Ruby
13
+ uses: ruby/setup-ruby@v1.131.0
14
+ with:
15
+ ruby-version: 3.2
16
+ bundler-cache: true
17
+ - name: Install dependencies
18
+ env:
19
+ ACTIVE_RECORD_VERSION: 7.0
20
+ run: bundle install --jobs 3 --retry 3
21
+ - name: Run tests
22
+ run: bundle exec rubocop -D
23
+
@@ -0,0 +1,45 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches: [ main ]
5
+ pull_request:
6
+ branches: [ main ]
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-20.04
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ ruby_version: ["2.7.5", "3.0.3", "3.1.0", "3.2.0"]
14
+ active_record_version: ["6.0", "6.1", "7.0"]
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ - name: Set up Ruby
18
+ uses: ruby/setup-ruby@v1.131.0
19
+ with:
20
+ ruby-version: ${{ matrix.ruby_version }}
21
+ bundler-cache: true
22
+ - name: Install dependencies
23
+ env:
24
+ ACTIVE_RECORD_VERSION: ${{ matrix.active_record_version }}
25
+ run: bundle install --jobs 3 --retry 3
26
+ - name: Run tests
27
+ env:
28
+ CI: '1'
29
+ run: bundle exec rspec
30
+ - name: Coveralls Parallel
31
+ uses: coverallsapp/github-action@1.1.3
32
+ with:
33
+ github-token: ${{ secrets.github_token }}
34
+ flag-name: run-${{ matrix.ruby_version }}-${{ matrix.active_record_version }}
35
+ parallel: true
36
+ finish:
37
+ needs: test
38
+ runs-on: ubuntu-20.04
39
+ steps:
40
+ - name: Coveralls Finished
41
+ uses: coverallsapp/github-action@1.1.3
42
+ with:
43
+ github-token: ${{ secrets.github_token }}
44
+ parallel-finished: true
45
+
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  *.db
11
11
  *.gem
12
+ vendor/
data/.rubocop.yml CHANGED
@@ -1,18 +1,12 @@
1
1
  require: rubocop-rspec
2
2
  AllCops:
3
- TargetRubyVersion: 2.3
3
+ TargetRubyVersion: 2.7
4
4
  Exclude:
5
5
  - 'bin/**/*'
6
6
  - 'tmp/**/*'
7
7
  - "vendor/**/*"
8
8
  Metrics/AbcSize:
9
9
  Max: 40
10
- Metrics/LineLength:
11
- Max: 125
12
- AllowURI: true
13
- URISchemes:
14
- - http
15
- - https
16
10
  Metrics/MethodLength:
17
11
  Max: 20
18
12
  Metrics/CyclomaticComplexity:
@@ -21,18 +15,36 @@ Metrics/PerceivedComplexity:
21
15
  Max: 10
22
16
  Metrics/BlockLength:
23
17
  Enabled: false
24
- Documentation:
18
+ Style/Documentation:
25
19
  Enabled: false
26
20
  Style/SignalException:
27
21
  EnforcedStyle: only_raise
28
- Layout/IndentHash:
22
+ Layout/LineLength:
23
+ Max: 125
24
+ AllowURI: true
25
+ URISchemes:
26
+ - http
27
+ - https
28
+ Layout/FirstHashElementIndentation:
29
29
  EnforcedStyle: consistent
30
- Layout/IndentArray:
30
+ Layout/FirstArrayElementIndentation:
31
31
  EnforcedStyle: consistent
32
32
  Layout/EndAlignment:
33
33
  EnforcedStyleAlignWith: variable
34
34
  Lint/InheritException:
35
35
  Enabled: false
36
+ Lint/SendWithMixinArgument:
37
+ Enabled: false
38
+ Lint/RaiseException:
39
+ Enabled: false
40
+ Lint/StructNewOverride:
41
+ Enabled: false
42
+ Style/HashEachMethods:
43
+ Enabled: false
44
+ Style/HashTransformKeys:
45
+ Enabled: false
46
+ Style/HashTransformValues:
47
+ Enabled: false
36
48
  Style/FrozenStringLiteralComment:
37
49
  Enabled: false
38
50
  RSpec/AnyInstance:
data/README.md CHANGED
@@ -122,8 +122,8 @@ Copyright (c) 2014 Daisuke Taniwaki. See [LICENSE](LICENSE) for details.
122
122
  [gem-link]: http://badge.fury.io/rb/acts_as_hashids
123
123
  [download-image]:https://img.shields.io/gem/dt/acts_as_hashids.svg
124
124
  [download-link]:https://rubygems.org/gems/acts_as_hashids
125
- [build-image]: https://www.travis-ci.com/dtaniwaki/acts_as_hashids.svg
126
- [build-link]: http://travis-ci.com/dtaniwaki/acts_as_hashids
125
+ [build-image]: https://github.com/dtaniwaki/acts_as_hashids/actions/workflows/test.yml/badge.svg
126
+ [build-link]: https://github.com/dtaniwaki/acts_as_hashids/actions/workflows/test.yml
127
127
  [cov-image]: https://coveralls.io/repos/dtaniwaki/acts_as_hashids/badge.png
128
128
  [cov-link]: https://coveralls.io/r/dtaniwaki/acts_as_hashids
129
129
  [gpa-image]: https://codeclimate.com/github/dtaniwaki/acts_as_hashids.png
@@ -19,17 +19,17 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.required_ruby_version = ['>= 2.2.2', '< 3.0']
22
+ spec.required_ruby_version = ['>= 2.3.0', '< 3.3']
23
23
 
24
- spec.add_runtime_dependency 'activerecord', '>= 4.0', '< 6.1'
24
+ spec.add_runtime_dependency 'activerecord', '>= 4.0', '< 7.1'
25
25
  spec.add_runtime_dependency 'hashids', '~> 1.0'
26
26
 
27
27
  spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.5'
28
- spec.add_development_dependency 'coveralls', '~> 0.8'
29
28
  spec.add_development_dependency 'rake', '~> 10.0'
30
29
  spec.add_development_dependency 'rspec', '~> 3.0'
31
- spec.add_development_dependency 'rubocop', '~> 0.54.0'
30
+ spec.add_development_dependency 'rubocop', '~> 0.81.0'
32
31
  spec.add_development_dependency 'rubocop-rspec', '~> 1.24.0'
33
- spec.add_development_dependency 'simplecov', '~> 0.11'
32
+ spec.add_development_dependency 'simplecov', '~> 0.21.0'
33
+ spec.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
34
34
  spec.add_development_dependency 'sqlite3', '~> 1.3'
35
35
  end
@@ -14,12 +14,10 @@ module ActsAsHashids
14
14
  return detect(&block) if block.present? && respond_to?(:detect)
15
15
 
16
16
  encoded_ids = Array(ids).map do |id|
17
- begin
18
- id = id.to_i if Integer(id)
19
- hashids.encode(id)
20
- rescue TypeError, ArgumentError
21
- id
22
- end
17
+ id = id.to_i if Integer(id)
18
+ hashids.encode(id)
19
+ rescue TypeError, ArgumentError
20
+ id
23
21
  end
24
22
 
25
23
  encoded_ids = encoded_ids.flatten
@@ -59,10 +57,10 @@ module ActsAsHashids
59
57
  where(primary_key => decoded_ids)
60
58
  end
61
59
 
62
- def has_many(*args, &block) # rubocop:disable Style/PredicateName
60
+ def has_many(*args, &block) # rubocop:disable Naming/PredicateName
63
61
  options = args.extract_options!
64
62
  options[:extend] = (options[:extend] || []).concat([FinderMethods])
65
- super(*args, options, &block)
63
+ super(*args, **options, &block)
66
64
  end
67
65
 
68
66
  def relation
@@ -1,3 +1,3 @@
1
1
  module ActsAsHashids
2
- VERSION = '0.1.9'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -2,15 +2,28 @@ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
2
2
 
3
3
  # Test Coverage
4
4
  require 'codeclimate-test-reporter'
5
- require 'coveralls'
6
5
  require 'simplecov'
7
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
8
- Coveralls::SimpleCov::Formatter,
9
- SimpleCov::Formatter::HTMLFormatter,
10
- CodeClimate::TestReporter::Formatter
11
- ])
12
- SimpleCov.minimum_coverage 50
13
- SimpleCov.start
6
+
7
+ SimpleCov.start 'rails' do
8
+ if ENV['CI']
9
+ require 'simplecov-lcov'
10
+
11
+ SimpleCov::Formatter::LcovFormatter.config do |c|
12
+ c.report_with_single_file = true
13
+ c.single_report_path = './coverage/lcov.info'
14
+ end
15
+
16
+ formatter SimpleCov::Formatter::MultiFormatter.new([
17
+ SimpleCov::Formatter::LcovFormatter,
18
+ CodeClimate::TestReporter::Formatter
19
+ ])
20
+ else
21
+ formatter SimpleCov::Formatter::HTMLFormatter
22
+ end
23
+
24
+ minimum_coverage 50
25
+ add_filter ['railtie.rb', 'version.rb']
26
+ end
14
27
 
15
28
  require 'active_record'
16
29
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_hashids
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dtaniwaki
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-07 00:00:00.000000000 Z
11
+ date: 2023-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.1'
22
+ version: '7.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.1'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: hashids
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -58,20 +58,6 @@ dependencies:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0.5'
61
- - !ruby/object:Gem::Dependency
62
- name: coveralls
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '0.8'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '0.8'
75
61
  - !ruby/object:Gem::Dependency
76
62
  name: rake
77
63
  requirement: !ruby/object:Gem::Requirement
@@ -106,14 +92,14 @@ dependencies:
106
92
  requirements:
107
93
  - - "~>"
108
94
  - !ruby/object:Gem::Version
109
- version: 0.54.0
95
+ version: 0.81.0
110
96
  type: :development
111
97
  prerelease: false
112
98
  version_requirements: !ruby/object:Gem::Requirement
113
99
  requirements:
114
100
  - - "~>"
115
101
  - !ruby/object:Gem::Version
116
- version: 0.54.0
102
+ version: 0.81.0
117
103
  - !ruby/object:Gem::Dependency
118
104
  name: rubocop-rspec
119
105
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +120,28 @@ dependencies:
134
120
  requirements:
135
121
  - - "~>"
136
122
  - !ruby/object:Gem::Version
137
- version: '0.11'
123
+ version: 0.21.0
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 0.21.0
131
+ - !ruby/object:Gem::Dependency
132
+ name: simplecov-lcov
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: 0.8.0
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '0.11'
144
+ version: 0.8.0
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: sqlite3
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -166,10 +166,12 @@ extensions: []
166
166
  extra_rdoc_files: []
167
167
  files:
168
168
  - ".gem_release.yml"
169
+ - ".github/workflows/codeql.yml"
170
+ - ".github/workflows/rubocop.yml"
171
+ - ".github/workflows/test.yml"
169
172
  - ".gitignore"
170
173
  - ".rspec"
171
174
  - ".rubocop.yml"
172
- - ".travis.yml"
173
175
  - Gemfile
174
176
  - LICENSE
175
177
  - README.md
@@ -190,7 +192,7 @@ homepage: https://github.com/dtaniwaki/acts_as_hashids
190
192
  licenses:
191
193
  - MIT
192
194
  metadata: {}
193
- post_install_message:
195
+ post_install_message:
194
196
  rdoc_options: []
195
197
  require_paths:
196
198
  - lib
@@ -198,18 +200,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
200
  requirements:
199
201
  - - ">="
200
202
  - !ruby/object:Gem::Version
201
- version: 2.2.2
203
+ version: 2.3.0
202
204
  - - "<"
203
205
  - !ruby/object:Gem::Version
204
- version: '3.0'
206
+ version: '3.3'
205
207
  required_rubygems_version: !ruby/object:Gem::Requirement
206
208
  requirements:
207
209
  - - ">="
208
210
  - !ruby/object:Gem::Version
209
211
  version: '0'
210
212
  requirements: []
211
- rubygems_version: 3.1.2
212
- signing_key:
213
+ rubygems_version: 3.1.6
214
+ signing_key:
213
215
  specification_version: 4
214
216
  summary: Use Youtube-Like ID in ActiveRecord seamlessly.
215
217
  test_files:
data/.travis.yml DELETED
@@ -1,48 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- rvm:
4
- - 2.4
5
- - 2.5
6
- - 2.6
7
- - 2.7
8
- env:
9
- jobs:
10
- -
11
- - ACTIVE_RECORD_VERSION=4.0.0 SQLITE3_VERSION=1.3.13
12
- - ACTIVE_RECORD_VERSION=4.1.0 SQLITE3_VERSION=1.3.13
13
- - ACTIVE_RECORD_VERSION=4.2.0 SQLITE3_VERSION=1.3.13
14
- - ACTIVE_RECORD_VERSION=5.0.0 SQLITE3_VERSION=1.3.13
15
- - ACTIVE_RECORD_VERSION=6.0.0
16
- matrix:
17
- allow_failures:
18
- - rvm: 2.4
19
- env: ACTIVE_RECORD_VERSION=4.0.0 SQLITE3_VERSION=1.3.13
20
- - rvm: 2.4
21
- env: ACTIVE_RECORD_VERSION=4.1.0 SQLITE3_VERSION=1.3.13
22
- - rvm: 2.5
23
- env: ACTIVE_RECORD_VERSION=4.0.0 SQLITE3_VERSION=1.3.13
24
- - rvm: 2.5
25
- env: ACTIVE_RECORD_VERSION=4.1.0 SQLITE3_VERSION=1.3.13
26
- - rvm: 2.6
27
- env: ACTIVE_RECORD_VERSION=4.0.0 SQLITE3_VERSION=1.3.13
28
- - rvm: 2.6
29
- env: ACTIVE_RECORD_VERSION=4.1.0 SQLITE3_VERSION=1.3.13
30
- - rvm: 2.7
31
- env: ACTIVE_RECORD_VERSION=4.0.0 SQLITE3_VERSION=1.3.13
32
- - rvm: 2.7
33
- env: ACTIVE_RECORD_VERSION=4.1.0 SQLITE3_VERSION=1.3.13
34
- - rvm: 2.7
35
- env: ACTIVE_RECORD_VERSION=4.2.0 SQLITE3_VERSION=1.3.13
36
- - rvm: 2.4
37
- env: ACTIVE_RECORD_VERSION=6.0.0
38
- before_install:
39
- - gem update --system
40
- - gem --version
41
- install:
42
- - gem install bundler
43
- - bundle --version
44
- - bundle install --jobs=3 --retry=3
45
- script:
46
- - 'bundle exec rake'
47
- notifications:
48
- email: false