active_record_bitmask 0.0.6 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92ef09e4ac0ca5c2da0db1869dc52776f5d990292e9c921bf02e364f1535925c
4
- data.tar.gz: 5e48672686d4d15b10f547a2fccd0c017799dd259bf36f2d1184da9261bce2c8
3
+ metadata.gz: 64ab7df76d1fa3c85e97580355997027d965cf28ace42d4d7722fde9a137f1c9
4
+ data.tar.gz: 1570c8e12db122ef3aaed1db19b82bb847b206949e1f1ef691b88d120743ab67
5
5
  SHA512:
6
- metadata.gz: 99696c27cf5fdcfede8e64be3791da418276f6dbd7b1edcb960b5dec585aa14587e82bf686e635d60cbccd0fbc4ab0c88e39150a24504c98e974b07048a55825
7
- data.tar.gz: d3dfbe52f15833aada4cbe70559f93c3493511872a1af6f024c1f54d77c8697dab77f396debed19be074014bbe3e077442cfadb2e0a2da414a0126eecf89c07c
6
+ metadata.gz: d2975d669a61ff04be5401c434fa220620d6e082fc0097cf77c9f7dd56760e4160d5f8512062f49b4a4c8f25162af1adfe1cdd179df15ac4f2ab3f84085472bd
7
+ data.tar.gz: ce25db01ff1255e799c12788d43d63811d7138e2df1f8bb48672423d9096e6ea7c535be9d282f37c96df5de2fefcb877639ba2f7ac89d067d919afcf38ece486
@@ -0,0 +1,45 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ pull_request:
7
+ branches: ["main"]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ rubocop:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ ruby-version: ['3.1', '3.2', '3.3']
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby-version }}
25
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
26
+ - name: Run rubocop
27
+ run: bundle exec rubocop
28
+
29
+ test:
30
+ runs-on: ubuntu-latest
31
+ strategy:
32
+ matrix:
33
+ gemfile: ['6.1_stable', '7.0_stable', '7.1_stable', '7.2_stable']
34
+ ruby-version: ['3.1', '3.2', '3.3']
35
+ env:
36
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+ - name: Set up Ruby
40
+ uses: ruby/setup-ruby@v1
41
+ with:
42
+ ruby-version: ${{ matrix.ruby-version }}
43
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
44
+ - name: Run tests
45
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  /gemfiles/*.lock
11
11
  /gemfiles/.bundle
12
+ .ruby-version
data/.rubocop.yml CHANGED
@@ -1,9 +1,19 @@
1
1
  AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+ Include:
5
+ - 'Gemfile'
6
+ - 'Appraisals'
7
+ - 'Rakefile'
8
+ - 'gemfiles/**/*'
9
+ - 'lib/**/*'
10
+ - 'spec/**/*'
2
11
  Exclude:
3
12
  - '.bundle/**/*'
13
+ - 'vendor/**/*'
4
14
  - 'gemfiles/**/*'
5
15
  - Gemfile
6
- TargetRubyVersion: 2.6
16
+ TargetRubyVersion: 3.1
7
17
  DisplayCopNames: true
8
18
 
9
19
  Bundler:
@@ -87,3 +97,6 @@ Metrics/PerceivedComplexity:
87
97
  Lint/UselessAccessModifier:
88
98
  ContextCreatingMethods:
89
99
  - concerning
100
+
101
+ Lint/EmptyBlock:
102
+ Enabled: false
data/Appraisals CHANGED
@@ -1,26 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise '5.0-stable' do
4
- gem 'activerecord', '~> 5.0.0'
5
- gem 'sqlite3', '~> 1.3.6'
6
- end
7
-
8
- appraise '5.1-stable' do
9
- gem 'activerecord', '~> 5.1.0'
10
- end
11
-
12
- appraise '5.2-stable' do
13
- gem 'activerecord', '~> 5.2.0'
3
+ appraise '6.1-stable' do
4
+ gem 'activerecord', '~> 6.1.0'
5
+ gem 'sqlite3', '~> 1.7.0'
14
6
  end
15
7
 
16
- appraise '6.0-stable' do
17
- gem 'activerecord', '~> 6.0.0'
8
+ appraise '7.0-stable' do
9
+ gem 'activerecord', '~> 7.0.0'
10
+ gem 'sqlite3', '~> 1.7.0'
18
11
  end
19
12
 
20
- appraise '6.1-stable' do
21
- gem 'activerecord', '~> 6.1.0.rc1'
13
+ appraise '7.1-stable' do
14
+ gem 'activerecord', '~> 7.1.0'
15
+ gem 'sqlite3', '~> 1.7.0'
22
16
  end
23
17
 
24
- appraise '7.0-stable' do
25
- gem 'activerecord', '7.0.0.alpha2'
18
+ appraise '7.2-stable' do
19
+ gem 'activerecord', '~> 7.2.0'
26
20
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 2.0.0
2
+
3
+ * **Breaking Changes** Rails 6.0 is no longer supported. #28
4
+ * Support Rails 7.2.0 #27
5
+
6
+ ## 1.0.0
7
+
8
+ * **Breaking Changes** Rails 5.0, 5.1 and 5.2 are no longer supported. #23
9
+ * Changed the version of rails specified in appraisal to stable version. #20
10
+ * Migrate travis.ci to Github Actions #22
11
+ * Support ruby 3.2 #24
12
+
1
13
  ## 0.0.6
2
14
 
3
15
  * Deprecate `#attribute?(*args)` in favor of `#attribute_bitmask?(*args)`. #17
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ gemspec
4
4
 
5
5
  gem 'pry'
6
6
  # Don't update rubocop automatically because sometimes it fails test by breaking changes.
7
- gem 'rubocop', '0.86.0'
7
+ gem 'rubocop', '1.28.2'
8
8
  gem 'appraisal'
9
9
  gem 'rake'
10
10
  gem 'rspec'
@@ -14,7 +14,9 @@ Gem::Specification.new do |spec|
14
14
  spec.summary = 'Simple bitmask attribute support for ActiveRecord'
15
15
  spec.homepage = 'https://github.com/alpaca-tc/active_record_bitmask'
16
16
 
17
- spec.metadata = {
17
+ spec.required_ruby_version = '>= 3.1.0'
18
+
19
+ spec.metadata = {
18
20
  'homepage_uri' => 'https://github.com/alpaca-tc/active_record_bitmask',
19
21
  'changelog_uri' => 'https://github.com/alpaca-tc/active_record_bitmask/blob/master/CHANGELOG.md',
20
22
  'source_code_uri' => 'https://github.com/alpaca-tc/active_record_bitmask/',
@@ -26,5 +28,5 @@ Gem::Specification.new do |spec|
26
28
  end
27
29
  spec.require_paths = ['lib']
28
30
 
29
- spec.add_dependency 'activerecord', '>= 5.0'
31
+ spec.add_dependency 'activerecord', '>= 6.1'
30
32
  end
@@ -3,11 +3,11 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "pry"
6
- gem "rubocop", "0.86.0"
6
+ gem "rubocop", "1.28.2"
7
7
  gem "appraisal"
8
8
  gem "rake"
9
9
  gem "rspec"
10
- gem "sqlite3"
11
- gem "activerecord", "~> 6.1.0.rc1"
10
+ gem "sqlite3", "~> 1.7.0"
11
+ gem "activerecord", "~> 6.1.0"
12
12
 
13
13
  gemspec path: "../"
@@ -3,11 +3,11 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "pry"
6
- gem "rubocop", "0.86.0"
6
+ gem "rubocop", "1.28.2"
7
7
  gem "appraisal"
8
8
  gem "rake"
9
9
  gem "rspec"
10
- gem "sqlite3"
11
- gem "activerecord", "7.0.0.alpha2"
10
+ gem "sqlite3", "~> 1.7.0"
11
+ gem "activerecord", "~> 7.0.0"
12
12
 
13
13
  gemspec path: "../"
@@ -3,11 +3,11 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "pry"
6
- gem "rubocop", "0.86.0"
6
+ gem "rubocop", "1.28.2"
7
7
  gem "appraisal"
8
8
  gem "rake"
9
9
  gem "rspec"
10
- gem "sqlite3", "~> 1.3.6"
11
- gem "activerecord", "~> 5.0.0"
10
+ gem "sqlite3", "~> 1.7.0"
11
+ gem "activerecord", "~> 7.1.0"
12
12
 
13
13
  gemspec path: "../"
@@ -3,11 +3,11 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "pry"
6
- gem "rubocop", "0.86.0"
6
+ gem "rubocop", "1.28.2"
7
7
  gem "appraisal"
8
8
  gem "rake"
9
9
  gem "rspec"
10
10
  gem "sqlite3"
11
- gem "activerecord", "~> 6.0.0"
11
+ gem "activerecord", "~> 7.2.0"
12
12
 
13
13
  gemspec path: "../"
@@ -6,6 +6,7 @@ module ActiveRecordBitmask
6
6
  # @param map [ActiveRecordBitmask::Map]
7
7
  # @param sub_type [ActiveModel::Type::Value]
8
8
  def initialize(_name, map, sub_type)
9
+ super()
9
10
  @map = map
10
11
  @sub_type = sub_type
11
12
  end
@@ -51,25 +51,26 @@ module ActiveRecordBitmask
51
51
  private
52
52
 
53
53
  def define_bitmask_attribute(attribute, map)
54
- if ActiveRecord.gem_version >= Gem::Version.new('7.0.0.alpha1')
54
+ if ActiveRecord.gem_version >= Gem::Version.new('7.2.0')
55
+ # Greater than or equal to 7.0.0
56
+ decorate_attributes([attribute]) do |name, subtype|
57
+ ActiveRecordBitmask::BitmaskType.new(name, map, subtype)
58
+ end
59
+ elsif ActiveRecord.gem_version >= Gem::Version.new('7.0.0')
55
60
  # Greater than or equal to 7.0.0
56
61
  attribute(attribute) do |subtype|
57
62
  ActiveRecordBitmask::BitmaskType.new(attribute, map, subtype)
58
63
  end
59
- elsif ActiveRecord.gem_version >= Gem::Version.new('6.1.0')
64
+ else
60
65
  # Equal to 6.1.0
61
66
  decorate_attribute_type(attribute) do |subtype|
62
67
  ActiveRecordBitmask::BitmaskType.new(attribute, map, subtype)
63
68
  end
64
- else
65
- # Less than 6.1.0
66
- decorate_attribute_type(attribute, :bitmask) do |subtype|
67
- ActiveRecordBitmask::BitmaskType.new(attribute, map, subtype)
68
- end
69
69
  end
70
70
  end
71
71
 
72
72
  # rubocop:disable Metrics/CyclomaticComplexity
73
+ # rubocop:disable Metrics/PerceivedComplexity
73
74
  def define_bitmask_scopes(attribute)
74
75
  blank = [0, nil].freeze
75
76
 
@@ -127,6 +128,7 @@ module ActiveRecordBitmask
127
128
  }
128
129
  end
129
130
  # rubocop:enable Metrics/CyclomaticComplexity
131
+ # rubocop:enable Metrics/PerceivedComplexity
130
132
  end
131
133
  end
132
134
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordBitmask
4
- VERSION = '0.0.6'
4
+ VERSION = '2.0.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_bitmask
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alpaca-tc
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-29 00:00:00.000000000 Z
11
+ date: 2024-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,37 +16,35 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
27
- description:
26
+ version: '6.1'
27
+ description:
28
28
  email:
29
29
  - alpaca-tc@alpaca.tc
30
30
  executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".github/workflows/ci.yml"
34
35
  - ".gitignore"
35
36
  - ".rspec"
36
37
  - ".rubocop.yml"
37
- - ".travis.yml"
38
38
  - Appraisals
39
39
  - CHANGELOG.md
40
40
  - Gemfile
41
41
  - README.md
42
42
  - Rakefile
43
43
  - active_record_bitmask.gemspec
44
- - gemfiles/5.0_stable.gemfile
45
- - gemfiles/5.1_stable.gemfile
46
- - gemfiles/5.2_stable.gemfile
47
- - gemfiles/6.0_stable.gemfile
48
44
  - gemfiles/6.1_stable.gemfile
49
45
  - gemfiles/7.0_stable.gemfile
46
+ - gemfiles/7.1_stable.gemfile
47
+ - gemfiles/7.2_stable.gemfile
50
48
  - lib/active_record_bitmask.rb
51
49
  - lib/active_record_bitmask/attribute_methods.rb
52
50
  - lib/active_record_bitmask/attribute_methods/query.rb
@@ -62,7 +60,7 @@ metadata:
62
60
  changelog_uri: https://github.com/alpaca-tc/active_record_bitmask/blob/master/CHANGELOG.md
63
61
  source_code_uri: https://github.com/alpaca-tc/active_record_bitmask/
64
62
  bug_tracker_uri: https://github.com/alpaca-tc/active_record_bitmask/issues
65
- post_install_message:
63
+ post_install_message:
66
64
  rdoc_options: []
67
65
  require_paths:
68
66
  - lib
@@ -70,15 +68,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
68
  requirements:
71
69
  - - ">="
72
70
  - !ruby/object:Gem::Version
73
- version: '0'
71
+ version: 3.1.0
74
72
  required_rubygems_version: !ruby/object:Gem::Requirement
75
73
  requirements:
76
74
  - - ">="
77
75
  - !ruby/object:Gem::Version
78
76
  version: '0'
79
77
  requirements: []
80
- rubygems_version: 3.1.6
81
- signing_key:
78
+ rubygems_version: 3.3.26
79
+ signing_key:
82
80
  specification_version: 4
83
81
  summary: Simple bitmask attribute support for ActiveRecord
84
82
  test_files: []
data/.travis.yml DELETED
@@ -1,31 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.8
5
- - 2.6.6
6
- - 2.7.2
7
- - 3.0.0
8
- before_install: gem install bundler
9
- gemfile:
10
- - gemfiles/5.0_stable.gemfile
11
- - gemfiles/5.1_stable.gemfile
12
- - gemfiles/5.2_stable.gemfile
13
- - gemfiles/6.0_stable.gemfile
14
- - gemfiles/6.1_stable.gemfile
15
- matrix:
16
- exclude:
17
- - rvm: 2.5.8
18
- gemfile: gemfiles/6.1_stable.gemfile
19
- - rvm: 2.6.6
20
- gemfile: gemfiles/6.1_stable.gemfile
21
- - rvm: 2.7.2
22
- gemfile: gemfiles/6.1_stable.gemfile
23
- - rvm: 3.0.0
24
- gemfile: gemfiles/5.0_stable.gemfile
25
- - rvm: 3.0.0
26
- gemfile: gemfiles/5.1_stable.gemfile
27
- - rvm: 3.0.0
28
- gemfile: gemfiles/5.2_stable.gemfile
29
- script:
30
- - bundle exec rspec
31
- - bundle exec rubocop
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "pry"
6
- gem "rubocop", "0.86.0"
7
- gem "appraisal"
8
- gem "rake"
9
- gem "rspec"
10
- gem "sqlite3"
11
- gem "activerecord", "~> 5.1.0"
12
-
13
- gemspec path: "../"
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "pry"
6
- gem "rubocop", "0.86.0"
7
- gem "appraisal"
8
- gem "rake"
9
- gem "rspec"
10
- gem "sqlite3"
11
- gem "activerecord", "~> 5.2.0"
12
-
13
- gemspec path: "../"