modis 4.0.1 → 4.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: 90338a93da41f45150c96831168e346edc9c408aa587bd7e1d82cb6e735e1b5b
4
- data.tar.gz: 87894188fb86b5f4f5f5586990a99744a3c88eedda54e1e1bb5d588df3c33db7
3
+ metadata.gz: f75b1f2591f788a511391d33f34ee1700d4c5aac164d46b7c41c0022afe1c6c8
4
+ data.tar.gz: 36ae08b35f2cc34166322ff2933d42717fd826779501eb135e815fccfaddecd5
5
5
  SHA512:
6
- metadata.gz: b80e7a9f7d6b546f100a03d0b49f0d6f095832cc97aeaea6fd4edb23428fd741c9851e76e1ad011d785e478f4f0bbd77eea31e77c2c420df447506ec328fc114
7
- data.tar.gz: c43be4893954d2826f6f31c39c2a035bce50907f32fe224a475b4f0b71d038a42379c13132192297271ab30ad4922abcabec463db4832f40f9c5c2ac293aedb0
6
+ metadata.gz: ff27792407942c2b3618ae6751e0397ba7c510d7852a758eb9e21219c8d111ebf3b0f28c2be3db40ec846de20bda4a9dc53d65051e1ad15d5ccfe6b6f3588118
7
+ data.tar.gz: 9ec6aaf991906929d9101ebf502bfd0f4d669af5c70df4b04b835ea714cc6602497a291aeb03f84ca436785aa0b0601a0404f1c44e79e147fe457f372f8527a7
@@ -0,0 +1,67 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ env:
10
+ CI: "true"
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-22.04
15
+
16
+ services:
17
+ redis:
18
+ image: redis
19
+ options: >-
20
+ --health-cmd "redis-cli ping"
21
+ --health-interval 10s
22
+ --health-timeout 5s
23
+ --health-retries 5
24
+ ports:
25
+ # Maps port 6379 on service container to the host
26
+ - 6379:6379
27
+
28
+ strategy:
29
+ matrix:
30
+ gemfile: ['rails_5.2', 'rails_6.0', 'rails_6.1', 'rails_7.0']
31
+
32
+ ruby: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1']
33
+
34
+ exclude:
35
+ # Rails 5.2 requires Ruby < 3.0
36
+ # https://github.com/rails/rails/issues/40938
37
+ - ruby: '3.0'
38
+ gemfile: 'rails_5.2'
39
+ - ruby: '3.1'
40
+ gemfile: 'rails_5.2'
41
+ # Rails >= 6 requires Ruby >= 2.5
42
+ - ruby: '2.4'
43
+ gemfile: 'rails_6.0'
44
+ - ruby: '2.4'
45
+ gemfile: 'rails_6.1'
46
+ # Rails >= 7 requires Ruby >= 2.7
47
+ - ruby: '2.4'
48
+ gemfile: 'rails_7.0'
49
+ - ruby: '2.5'
50
+ gemfile: 'rails_7.0'
51
+ - ruby: '2.6'
52
+ gemfile: 'rails_7.0'
53
+
54
+ env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
55
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
56
+
57
+ steps:
58
+ - uses: actions/checkout@v2
59
+
60
+ - name: Set up Ruby
61
+ uses: ruby/setup-ruby@v1
62
+ with:
63
+ ruby-version: ${{ matrix.ruby }}
64
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
65
+
66
+ - name: Run tests
67
+ run: bundle exec rake
@@ -0,0 +1,3 @@
1
+ user=rpush
2
+ project=modis
3
+ future-release=v4.1.0
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.5
1
+ 3.1.3
data/Appraisals CHANGED
@@ -1,20 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise 'rails-4.2' do
4
- gem 'activemodel', '~> 4.2.0'
5
- gem 'activesupport', '~> 4.2.0'
6
- end
7
-
8
- appraise 'rails-5.0' do
9
- gem 'activemodel', '~> 5.0.0'
10
- gem 'activesupport', '~> 5.0.0'
11
- end
12
-
13
- appraise 'rails-5.1' do
14
- gem 'activemodel', '~> 5.1.0'
15
- gem 'activesupport', '~> 5.1.0'
16
- end
17
-
18
3
  appraise 'rails-5.2' do
19
4
  gem 'activemodel', '~> 5.2.0'
20
5
  gem 'activesupport', '~> 5.2.0'
@@ -24,3 +9,13 @@ appraise 'rails-6.0' do
24
9
  gem 'activemodel', '~> 6.0.0'
25
10
  gem 'activesupport', '~> 6.0.0'
26
11
  end
12
+
13
+ appraise 'rails-6.1' do
14
+ gem 'activemodel', '~> 6.1.0'
15
+ gem 'activesupport', '~> 6.1.0'
16
+ end
17
+
18
+ appraise 'rails-7.0' do
19
+ gem 'activemodel', '~> 7.0.0'
20
+ gem 'activesupport', '~> 7.0.0'
21
+ end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [v4.1.0](https://github.com/rpush/modis/tree/v4.1.0) (2023-08-01)
4
+
5
+ [Full Changelog](https://github.com/rpush/modis/compare/v4.1.0...v4.1.0)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Support redis gem v5.x [\#45](https://github.com/rpush/modis/pull/45) ([benlangfeld](https://github.com/benlangfeld))
10
+
11
+ ## [v4.1.0](https://github.com/rpush/modis/tree/v4.1.0) (2023-02-01)
12
+
13
+ [Full Changelog](https://github.com/rpush/modis/compare/v4.0.1...v4.1.0)
14
+
15
+ **Closed issues:**
16
+
17
+ - Migrate CI to GitHub Actions, add testing for Rails 7.0 and Ruby 3.1 [\#33](https://github.com/rpush/modis/issues/33)
18
+
19
+ **Merged pull requests:**
20
+
21
+ - Prep v4.1.0 release [\#46](https://github.com/rpush/modis/pull/46) ([benlangfeld](https://github.com/benlangfeld))
22
+ - Upgrades to latest activesupport [\#44](https://github.com/rpush/modis/pull/44) ([benlangfeld](https://github.com/benlangfeld))
23
+ - Switch from Travis CI to GH actions [\#42](https://github.com/rpush/modis/pull/42) ([benlangfeld](https://github.com/benlangfeld))
24
+ - Flexible encoding [\#41](https://github.com/rpush/modis/pull/41) ([benlangfeld](https://github.com/benlangfeld))
25
+ - Compatibility with redis 4.8.x gem [\#40](https://github.com/rpush/modis/pull/40) ([benlangfeld](https://github.com/benlangfeld))
26
+ - Compatibility with redis 4.7.x gem [\#39](https://github.com/rpush/modis/pull/39) ([benlangfeld](https://github.com/benlangfeld))
27
+ - More modern ruby for local dev [\#37](https://github.com/rpush/modis/pull/37) ([benlangfeld](https://github.com/benlangfeld))
28
+ - Don't allow redis \> 4.6 yet [\#36](https://github.com/rpush/modis/pull/36) ([benlangfeld](https://github.com/benlangfeld))
29
+
3
30
  ## [v4.0.1](https://github.com/rpush/modis/tree/v4.0.1) (2022-03-02)
4
31
 
5
32
  [Full Changelog](https://github.com/rpush/modis/compare/v4.0.0...v4.0.1)
@@ -12,6 +39,10 @@
12
39
 
13
40
  [Full Changelog](https://github.com/rpush/modis/compare/v3.3.0...v4.0.0)
14
41
 
42
+ **Closed issues:**
43
+
44
+ - remove hiredis dependency [\#15](https://github.com/rpush/modis/issues/15)
45
+
15
46
  **Merged pull requests:**
16
47
 
17
48
  - Makes hiredis a development dependency [\#31](https://github.com/rpush/modis/pull/31) ([fdocr](https://github.com/fdocr))
@@ -31,12 +62,18 @@
31
62
 
32
63
  **Merged pull requests:**
33
64
 
34
- - Add missing `\#update` and `\#update!` persistance methods [\#27](https://github.com/rpush/modis/pull/27) ([dsantosmerino](https://github.com/dsantosmerino))
65
+ - Add missing `#update` and `#update!` persistance methods [\#27](https://github.com/rpush/modis/pull/27) ([dsantosmerino](https://github.com/dsantosmerino))
35
66
 
36
67
  ## [v3.1.0](https://github.com/rpush/modis/tree/v3.1.0) (2019-10-18)
37
68
 
38
69
  [Full Changelog](https://github.com/rpush/modis/compare/3.0.0...v3.1.0)
39
70
 
71
+ **Closed issues:**
72
+
73
+ - Add testing for Rails 6 [\#24](https://github.com/rpush/modis/issues/24)
74
+ - Modis Memory Leak [\#14](https://github.com/rpush/modis/issues/14)
75
+ - Support of Rails 5.2 [\#13](https://github.com/rpush/modis/issues/13)
76
+
40
77
  **Merged pull requests:**
41
78
 
42
79
  - Remove i18n dependency [\#26](https://github.com/rpush/modis/pull/26) ([aried3r](https://github.com/aried3r))
@@ -47,6 +84,10 @@
47
84
 
48
85
  [Full Changelog](https://github.com/rpush/modis/compare/v2.1.0...3.0.0)
49
86
 
87
+ **Closed issues:**
88
+
89
+ - difficult to persist after making changes to part of a hash attribute [\#8](https://github.com/rpush/modis/issues/8)
90
+
50
91
  **Merged pull requests:**
51
92
 
52
93
  - Prep 3.0.0 release [\#21](https://github.com/rpush/modis/pull/21) ([garettarrowood](https://github.com/garettarrowood))
@@ -57,14 +98,64 @@
57
98
  - get rid of old school rocket syntax [\#11](https://github.com/rpush/modis/pull/11) ([DmytroStepaniuk](https://github.com/DmytroStepaniuk))
58
99
  - fix wrong readme example [\#10](https://github.com/rpush/modis/pull/10) ([DmytroStepaniuk](https://github.com/DmytroStepaniuk))
59
100
 
60
- ## v2.1.0
101
+ ## [v2.1.0](https://github.com/rpush/modis/tree/v2.1.0) (2017-06-24)
102
+
103
+ [Full Changelog](https://github.com/rpush/modis/compare/v1.4.2...v2.1.0)
104
+
105
+ **Closed issues:**
106
+
107
+ - Reason of :all index [\#6](https://github.com/rpush/modis/issues/6)
108
+
109
+ **Merged pull requests:**
110
+
111
+ - New option for Modis::Model - :enable\_all\_index [\#7](https://github.com/rpush/modis/pull/7) ([nattfodd](https://github.com/nattfodd))
112
+
113
+ ## [v1.4.2](https://github.com/rpush/modis/tree/v1.4.2) (2017-06-05)
114
+
115
+ [Full Changelog](https://github.com/rpush/modis/compare/v2.0.0...v1.4.2)
116
+
117
+ ## [v2.0.0](https://github.com/rpush/modis/tree/v2.0.0) (2017-05-25)
118
+
119
+ [Full Changelog](https://github.com/rpush/modis/compare/v1.4.1...v2.0.0)
120
+
121
+ **Closed issues:**
122
+
123
+ - Drop support for Ruby \<= 2.1 [\#4](https://github.com/rpush/modis/issues/4)
124
+ - Spec errors in new optimizations [\#1](https://github.com/rpush/modis/issues/1)
125
+
126
+ **Merged pull requests:**
127
+
128
+ - Improvements [\#5](https://github.com/rpush/modis/pull/5) ([Tonkpils](https://github.com/Tonkpils))
129
+ - Support for Ruby 2.4.1 [\#3](https://github.com/rpush/modis/pull/3) ([Tonkpils](https://github.com/Tonkpils))
130
+
131
+ ## [v1.4.1](https://github.com/rpush/modis/tree/v1.4.1) (2015-01-20)
132
+
133
+ [Full Changelog](https://github.com/rpush/modis/compare/v1.4.0...v1.4.1)
134
+
135
+ ## [v1.4.0](https://github.com/rpush/modis/tree/v1.4.0) (2015-01-13)
136
+
137
+ [Full Changelog](https://github.com/rpush/modis/compare/v1.3.0...v1.4.0)
138
+
139
+ ## [v1.3.0](https://github.com/rpush/modis/tree/v1.3.0) (2014-09-01)
140
+
141
+ [Full Changelog](https://github.com/rpush/modis/compare/v1.2.0...v1.3.0)
142
+
143
+ ## [v1.2.0](https://github.com/rpush/modis/tree/v1.2.0) (2014-09-01)
144
+
145
+ [Full Changelog](https://github.com/rpush/modis/compare/v1.1.0...v1.2.0)
146
+
147
+ ## [v1.1.0](https://github.com/rpush/modis/tree/v1.1.0) (2014-07-09)
148
+
149
+ [Full Changelog](https://github.com/rpush/modis/compare/v1.0.0...v1.1.0)
150
+
151
+ ## [v1.0.0](https://github.com/rpush/modis/tree/v1.0.0) (2014-06-22)
152
+
153
+ [Full Changelog](https://github.com/rpush/modis/compare/v0.0.1...v1.0.0)
61
154
 
62
- - Add `enable_all_index` option to allow disabling the `all` keys. [#7](https://github.com/rpush/modis/pull/7)
155
+ ## [v0.0.1](https://github.com/rpush/modis/tree/v0.0.1) (2014-04-20)
63
156
 
64
- ## v2.0.0
157
+ [Full Changelog](https://github.com/rpush/modis/compare/a42bf2ff8e233a52ce1fb4fd3120f21cec8bee1c...v0.0.1)
65
158
 
66
- - Support MRI 2.2.2+ and JRuby 9k+ [#5](https://github.com/rpush/modis/pull/5)
67
- - Remove YAML (de)serialization support [#5](https://github.com/rpush/modis/pull/5)
68
159
 
69
160
 
70
161
  \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- modis (4.0.1)
4
+ modis (4.2.0)
5
5
  activemodel (>= 5.2)
6
6
  activesupport (>= 5.2)
7
7
  connection_pool (>= 2)
@@ -11,39 +11,93 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activemodel (6.0.3.4)
15
- activesupport (= 6.0.3.4)
16
- activesupport (6.0.3.4)
14
+ activemodel (7.0.4.2)
15
+ activesupport (= 7.0.4.2)
16
+ activesupport (7.0.4.2)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- zeitwerk (~> 2.2, >= 2.2.2)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ addressable (2.8.1)
22
+ public_suffix (>= 2.0.2, < 6.0)
22
23
  appraisal (2.3.0)
23
24
  bundler
24
25
  rake
25
26
  thor (>= 0.14.0)
26
27
  ast (2.4.2)
28
+ async (2.3.1)
29
+ console (~> 1.10)
30
+ io-event (~> 1.1)
31
+ timers (~> 4.1)
32
+ async-http (0.59.5)
33
+ async (>= 1.25)
34
+ async-io (>= 1.28)
35
+ async-pool (>= 0.2)
36
+ protocol-http (~> 0.23)
37
+ protocol-http1 (~> 0.14.0)
38
+ protocol-http2 (~> 0.14.0)
39
+ traces (>= 0.8.0)
40
+ async-http-faraday (0.11.0)
41
+ async-http (~> 0.42)
42
+ faraday
43
+ async-io (1.34.3)
44
+ async
45
+ async-pool (0.3.12)
46
+ async (>= 1.25)
27
47
  cane (3.0.0)
28
48
  parallel
29
49
  codeclimate-test-reporter (1.0.7)
30
50
  simplecov
31
- concurrent-ruby (1.1.7)
32
- connection_pool (2.2.3)
51
+ concurrent-ruby (1.2.0)
52
+ connection_pool (2.3.0)
53
+ console (1.16.2)
54
+ fiber-local
33
55
  diff-lcs (1.4.4)
34
56
  docile (1.3.2)
57
+ faraday (2.7.4)
58
+ faraday-net_http (>= 2.0, < 3.1)
59
+ ruby2_keywords (>= 0.0.4)
60
+ faraday-http-cache (2.4.1)
61
+ faraday (>= 0.8)
62
+ faraday-net_http (3.0.2)
63
+ fiber-local (1.0.0)
64
+ github_changelog_generator (1.16.4)
65
+ activesupport
66
+ async (>= 1.25.0)
67
+ async-http-faraday
68
+ faraday-http-cache
69
+ multi_json
70
+ octokit (~> 4.6)
71
+ rainbow (>= 2.2.1)
72
+ rake (>= 10.0)
35
73
  hiredis (0.6.3)
36
- i18n (1.8.5)
74
+ i18n (1.12.0)
37
75
  concurrent-ruby (~> 1.0)
76
+ io-event (1.1.6)
38
77
  jaro_winkler (1.5.4)
39
- minitest (5.14.2)
40
- msgpack (1.3.3)
78
+ minitest (5.17.0)
79
+ msgpack (1.6.0)
80
+ multi_json (1.15.0)
81
+ octokit (4.25.1)
82
+ faraday (>= 1, < 3)
83
+ sawyer (~> 0.9)
41
84
  parallel (1.20.1)
42
85
  parser (3.0.1.0)
43
86
  ast (~> 2.4.1)
87
+ protocol-hpack (1.4.2)
88
+ protocol-http (0.24.0)
89
+ protocol-http1 (0.14.6)
90
+ protocol-http (~> 0.22)
91
+ protocol-http2 (0.14.2)
92
+ protocol-hpack (~> 1.4)
93
+ protocol-http (~> 0.18)
94
+ public_suffix (5.0.1)
44
95
  rainbow (3.0.0)
45
96
  rake (13.0.1)
46
- redis (4.6.0)
97
+ redis (5.0.6)
98
+ redis-client (>= 0.9.0)
99
+ redis-client (0.12.1)
100
+ connection_pool
47
101
  rexml (3.2.5)
48
102
  rspec (3.9.0)
49
103
  rspec-core (~> 3.9.0)
@@ -67,16 +121,20 @@ GEM
67
121
  ruby-progressbar (~> 1.7)
68
122
  unicode-display_width (>= 1.4.0, < 2.0)
69
123
  ruby-progressbar (1.11.0)
124
+ ruby2_keywords (0.0.5)
125
+ sawyer (0.9.2)
126
+ addressable (>= 2.3.5)
127
+ faraday (>= 0.17.3, < 3)
70
128
  simplecov (0.18.5)
71
129
  docile (~> 1.1)
72
130
  simplecov-html (~> 0.11)
73
- simplecov-html (0.12.2)
131
+ simplecov-html (0.12.3)
74
132
  thor (1.0.1)
75
- thread_safe (0.3.6)
76
- tzinfo (1.2.7)
77
- thread_safe (~> 0.1)
133
+ timers (4.3.5)
134
+ traces (0.8.0)
135
+ tzinfo (2.0.6)
136
+ concurrent-ruby (~> 1.0)
78
137
  unicode-display_width (1.7.0)
79
- zeitwerk (2.4.0)
80
138
 
81
139
  PLATFORMS
82
140
  ruby
@@ -85,6 +143,7 @@ DEPENDENCIES
85
143
  appraisal
86
144
  cane
87
145
  codeclimate-test-reporter
146
+ github_changelog_generator
88
147
  hiredis (>= 0.5)
89
148
  modis!
90
149
  rake
data/README.md CHANGED
@@ -1,4 +1,3 @@
1
- [![Build Status](https://travis-ci.org/rpush/modis.svg?branch=master)](https://travis-ci.org/rpush/modis)
2
1
  [![Code Climate](https://codeclimate.com/github/ileitch/modis/badges/gpa.svg)](https://codeclimate.com/github/ileitch/modis)
3
2
  [![Test Coverage](https://codeclimate.com/github/ileitch/modis/badges/coverage.svg)](https://codeclimate.com/github/ileitch/modis)
4
3
 
data/Rakefile CHANGED
@@ -10,9 +10,9 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
10
10
  spec.rspec_opts = ['--backtrace']
11
11
  end
12
12
 
13
- if ENV['TRAVIS'] && ENV['QUALITY'] == 'false'
13
+ if ENV['CI'] && ENV['QUALITY'] == 'false'
14
14
  task default: 'spec'
15
- elsif RUBY_VERSION > '1.9' && defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
15
+ elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
16
16
  task default: 'spec:quality'
17
17
  else
18
18
  task default: 'spec'
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activemodel", "~> 7.0.0"
6
+ gem "activesupport", "~> 7.0.0"
7
+
8
+ gemspec path: "../"
data/lib/modis/index.rb CHANGED
@@ -62,7 +62,7 @@ module Modis
62
62
 
63
63
  indexed_attributes.each do |attribute|
64
64
  key = index_key(attribute, read_attribute(attribute))
65
- redis.sadd(key, id)
65
+ redis.sadd(key, [id])
66
66
  end
67
67
  end
68
68
 
@@ -71,7 +71,7 @@ module Modis
71
71
 
72
72
  indexed_attributes.each do |attribute|
73
73
  key = index_key(attribute, read_attribute(attribute))
74
- redis.srem(key, id)
74
+ redis.srem(key, [id])
75
75
  end
76
76
  end
77
77
 
@@ -83,7 +83,9 @@ module Modis
83
83
 
84
84
  def deserialize(record)
85
85
  values = record.values
86
- values = MessagePack.unpack(msgpack_array_header(values.size) + values.join)
86
+ values.map! { |value| value.force_encoding(values.first.encoding) }
87
+ header = msgpack_array_header(values.size, values.first.encoding)
88
+ values = MessagePack.unpack(header + values.join)
87
89
  keys = record.keys
88
90
  values.each_with_index { |v, i| record[keys[i]] = v }
89
91
  record
@@ -97,14 +99,14 @@ module Modis
97
99
 
98
100
  private
99
101
 
100
- def msgpack_array_header(values_size)
102
+ def msgpack_array_header(values_size, encoding)
101
103
  if values_size < 16
102
104
  [0x90 | values_size].pack("C")
103
105
  elsif values_size < 65536
104
106
  [0xDC, values_size].pack("Cn")
105
107
  else
106
108
  [0xDD, values_size].pack("CN")
107
- end.force_encoding(Encoding::UTF_8)
109
+ end.force_encoding(encoding)
108
110
  end
109
111
  end
110
112
 
@@ -138,8 +140,8 @@ module Modis
138
140
  redis.pipelined do |pipeline|
139
141
  remove_from_indexes(pipeline)
140
142
  if self.class.all_index_enabled?
141
- pipeline.srem(self.class.key_for(:all), id)
142
- pipeline.srem(self.class.sti_base_key_for(:all), id) if self.class.sti_child?
143
+ pipeline.srem(self.class.key_for(:all), [id])
144
+ pipeline.srem(self.class.sti_base_key_for(:all), [id]) if self.class.sti_child?
143
145
  end
144
146
  pipeline.del(key)
145
147
  end
@@ -217,8 +219,8 @@ module Modis
217
219
 
218
220
  if new_record?
219
221
  if self.class.all_index_enabled?
220
- pipeline.sadd(self.class.key_for(:all), id)
221
- pipeline.sadd(self.class.sti_base_key_for(:all), id) if self.class.sti_child?
222
+ pipeline.sadd(self.class.key_for(:all), [id])
223
+ pipeline.sadd(self.class.sti_base_key_for(:all), [id]) if self.class.sti_child?
222
224
  end
223
225
  add_to_indexes(pipeline)
224
226
  else
data/lib/modis/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Modis
4
- VERSION = '4.0.1'
4
+ VERSION = '4.2.0'
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  begin
4
- if ENV['TRAVIS']
4
+ if ENV['CI']
5
5
  namespace :spec do
6
6
  task cane: ['spec']
7
7
  end
data/modis.gemspec CHANGED
@@ -40,4 +40,5 @@ Gem::Specification.new do |gem|
40
40
  gem.add_development_dependency 'rubocop', '0.81.0'
41
41
  gem.add_development_dependency 'simplecov'
42
42
  gem.add_development_dependency 'hiredis', '>= 0.5'
43
+ gem.add_development_dependency 'github_changelog_generator'
43
44
  end
data/spec/finder_spec.rb CHANGED
@@ -183,7 +183,7 @@ describe Modis::Finder do
183
183
  it 'transparently upgrades old data' do
184
184
  consumer = FindersSpec::Consumer.create!(name: 'Ian')
185
185
  Modis.with_connection do |redis|
186
- redis.srem(FindersSpec::Consumer.key_for(:all), consumer.id)
186
+ redis.srem(FindersSpec::Consumer.key_for(:all), [consumer.id])
187
187
  end
188
188
  expect(FindersSpec::Consumer.find(consumer.id)).to eq(consumer)
189
189
  end
@@ -111,13 +111,8 @@ describe Modis::Persistence do
111
111
 
112
112
  it 'does not track the ID if the underlying Redis command failed' do
113
113
  redis = double(hmset: double(value: nil), sadd: nil)
114
- if Gem::Version.new(Redis::VERSION) > Gem::Version.new('4.6.0')
115
- expect(model.class).to receive(:transaction).and_yield(Redis::PipelinedConnection.new(Redis::Pipeline::Multi.new(redis)))
116
- expect(redis).to receive(:pipelined).and_yield(Redis::PipelinedConnection.new(Redis::Pipeline.new(redis)))
117
- else
118
- expect(model.class).to receive(:transaction).and_yield(redis)
119
- expect(redis).to receive(:pipelined).and_yield(redis)
120
- end
114
+ expect(model.class).to receive(:transaction).and_yield(redis)
115
+ expect(redis).to receive(:pipelined).and_yield(redis)
121
116
  model.save
122
117
  expect { model.class.find(model.id) }.to raise_error(Modis::RecordNotFound)
123
118
  end
@@ -140,13 +135,8 @@ describe Modis::Persistence do
140
135
  model.age = 11
141
136
  redis = double
142
137
  expect(redis).to receive(:hmset).with("modis:persistence_spec:mock_model:1", ["age", "\v"]).and_return(double(value: 'OK'))
143
- if Gem::Version.new(Redis::VERSION) > Gem::Version.new('4.6.0')
144
- expect(model.class).to receive(:transaction).and_yield(Redis::PipelinedConnection.new(Redis::Pipeline::Multi.new(redis)))
145
- expect(redis).to receive(:pipelined).and_yield(Redis::PipelinedConnection.new(Redis::Pipeline.new(redis)))
146
- else
147
- expect(model.class).to receive(:transaction).and_yield(redis)
148
- expect(redis).to receive(:pipelined).and_yield(redis)
149
- end
138
+ expect(model.class).to receive(:transaction).and_yield(redis)
139
+ expect(redis).to receive(:pipelined).and_yield(redis)
150
140
  model.save!
151
141
  expect(model.age).to eq(11)
152
142
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- unless ENV['TRAVIS']
3
+ unless ENV['CI']
4
4
  begin
5
5
  require './spec/support/simplecov_helper'
6
6
  include SimpleCovHelper # rubocop:disable Style/MixinUsage
@@ -11,7 +11,7 @@ module SimpleCovHelper
11
11
 
12
12
  formatters = [SimpleCov::Formatter::QualityFormatter]
13
13
 
14
- if ENV['TRAVIS']
14
+ if ENV['CI']
15
15
  require 'codeclimate-test-reporter'
16
16
 
17
17
  formatters << CodeClimate::TestReporter::Formatter if CodeClimate::TestReporter.run?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modis
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Leitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-02 00:00:00.000000000 Z
11
+ date: 2023-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0.5'
195
+ - !ruby/object:Gem::Dependency
196
+ name: github_changelog_generator
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
195
209
  description: ActiveModel + Redis
196
210
  email:
197
211
  - port001@gmail.com
@@ -199,10 +213,11 @@ executables: []
199
213
  extensions: []
200
214
  extra_rdoc_files: []
201
215
  files:
216
+ - ".github/workflows/test.yml"
217
+ - ".github_changelog_generator"
202
218
  - ".gitignore"
203
219
  - ".rubocop.yml"
204
220
  - ".ruby-version"
205
- - ".travis.yml"
206
221
  - Appraisals
207
222
  - CHANGELOG.md
208
223
  - Gemfile
@@ -217,6 +232,7 @@ files:
217
232
  - gemfiles/rails_5.2.gemfile
218
233
  - gemfiles/rails_6.0.gemfile
219
234
  - gemfiles/rails_6.1.gemfile
235
+ - gemfiles/rails_7.0.gemfile
220
236
  - lib/modis.rb
221
237
  - lib/modis/attribute.rb
222
238
  - lib/modis/configuration.rb
@@ -258,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
274
  - !ruby/object:Gem::Version
259
275
  version: '0'
260
276
  requirements: []
261
- rubygems_version: 3.1.4
277
+ rubygems_version: 3.3.26
262
278
  signing_key:
263
279
  specification_version: 4
264
280
  summary: ActiveModel + Redis
data/.travis.yml DELETED
@@ -1,42 +0,0 @@
1
- language: ruby
2
-
3
- dist: bionic
4
-
5
- cache: bundler
6
-
7
- services:
8
- - redis-server
9
-
10
- rvm:
11
- - 2.3
12
- - 2.4
13
- - 2.5
14
- - 2.6
15
- - 2.7
16
- - 3.0
17
- - jruby-9.2.17.0
18
-
19
- gemfile:
20
- - gemfiles/rails_5.2.gemfile
21
- - gemfiles/rails_6.0.gemfile
22
- - gemfiles/rails_6.1.gemfile
23
-
24
- matrix:
25
- fast_finish: true
26
- exclude:
27
- # Rails 6 requires Ruby 2.5 or higher
28
- - gemfile: gemfiles/rails_6.0.gemfile
29
- rvm: 2.3
30
- - gemfile: gemfiles/rails_6.1.gemfile
31
- rvm: 2.3
32
- - gemfile: gemfiles/rails_6.0.gemfile
33
- rvm: 2.4
34
- - gemfile: gemfiles/rails_6.1.gemfile
35
- rvm: 2.4
36
- # Rails 5.2 isn't compatible with Ruby 3.0 or higher
37
- - gemfile: gemfiles/rails_5.2.gemfile
38
- rvm: 3.0
39
-
40
- env:
41
- global:
42
- secure: LrTz0Pq2ibNZuKDhdzcrvEUSNxUpPopEq9aJeCxy3UpV0v4vpHBtWV0S6zofvf98g/RkZ6cGI1u+0H578dHgE6pWTo+iR8LAwqPKofrFIWRkeo+M77Vs5swahb3mQyPOcig1hfVWDm25MsojePYm70eBIcBU55NWImtdePXfiU0=