modis 4.0.0 → 4.0.1

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: 62a6abe9671e399409e452a290c360fcd0aadfbdceccca9aa364d6f232b2df49
4
- data.tar.gz: d8468a3f54bf0587f8d89ff2b353a5c48ea0798a4c067bd291ef5ed471448a01
3
+ metadata.gz: 90338a93da41f45150c96831168e346edc9c408aa587bd7e1d82cb6e735e1b5b
4
+ data.tar.gz: 87894188fb86b5f4f5f5586990a99744a3c88eedda54e1e1bb5d588df3c33db7
5
5
  SHA512:
6
- metadata.gz: a382d676431ed8bd7fd79dde5dbff275c19687b42ce9de52980ce35898ea91eb447a1a7349b8f09bc56606841e7f6cada8f882bc23f5eb8d9f5483b109805d61
7
- data.tar.gz: 499687970a4a33a573e16ea8f1b70749e85d2650b2092a37ce26cdd9452cc6c3a3c539e9e59dcfa9d5db0ed2d9ccf19c961122e22d0e8dfd3e41afda080c925d
6
+ metadata.gz: b80e7a9f7d6b546f100a03d0b49f0d6f095832cc97aeaea6fd4edb23428fd741c9851e76e1ad011d785e478f4f0bbd77eea31e77c2c420df447506ec328fc114
7
+ data.tar.gz: c43be4893954d2826f6f31c39c2a035bce50907f32fe224a475b4f0b71d038a42379c13132192297271ab30ad4922abcabec463db4832f40f9c5c2ac293aedb0
data/.rubocop.yml CHANGED
@@ -3,23 +3,24 @@ AllCops:
3
3
  - modis.gemspec
4
4
  - vendor/**/*
5
5
  - gemfiles/**/*
6
+ TargetRubyVersion: 2.3
6
7
 
7
- LineLength:
8
+ Layout/LineLength:
8
9
  Enabled: false
9
10
 
10
- StringLiterals:
11
+ Style/StringLiterals:
11
12
  Enabled: false
12
13
 
13
- Documentation:
14
+ Style/Documentation:
14
15
  Enabled: false
15
16
 
16
- MethodLength:
17
+ Metrics/MethodLength:
17
18
  Enabled: false
18
19
 
19
- ClassLength:
20
+ Metrics/ClassLength:
20
21
  Enabled: false
21
22
 
22
- CyclomaticComplexity:
23
+ Metrics/CyclomaticComplexity:
23
24
  Enabled: false
24
25
 
25
26
  Style/SignalException:
@@ -42,3 +43,19 @@ Metrics/BlockLength:
42
43
 
43
44
  Security/YAMLLoad:
44
45
  Enabled: false
46
+
47
+ Lint/RaiseException:
48
+ Enabled: true
49
+
50
+ Lint/StructNewOverride:
51
+ Enabled: true
52
+
53
+ Style/HashEachMethods:
54
+ Enabled: true
55
+
56
+ Style/HashTransformKeys:
57
+ Enabled: true
58
+
59
+ Style/HashTransformValues:
60
+ Enabled: true
61
+
data/CHANGELOG.md CHANGED
@@ -1,32 +1,61 @@
1
- ## Unreleased
1
+ # Changelog
2
2
 
3
- ## v4.0.0 - 2021-04-28
3
+ ## [v4.0.1](https://github.com/rpush/modis/tree/v4.0.1) (2022-03-02)
4
4
 
5
- **Breaking:**
5
+ [Full Changelog](https://github.com/rpush/modis/compare/v4.0.0...v4.0.1)
6
6
 
7
- - Drop support for Rails 4.2, 5.0, 5.1.
8
- - Removed `hiredis` as a dependency and made it a development dependency.
9
- For details, see [#31](https://github.com/rpush/modis/pull/31) by [@fdoxyz](https://github.com/fdoxyz).
7
+ **Merged pull requests:**
10
8
 
11
- ## v3.3.0 - 2020-07-07
9
+ - Fix deprectated pipeline calls for Redis 4.6.0 [\#32](https://github.com/rpush/modis/pull/32) ([justinhoward](https://github.com/justinhoward))
12
10
 
13
- - Fix deprecation warnings when using Ruby >= 2.7, `activemodel` >= 6.0.3, or `redis` >= 4.2.0. [#30](https://github.com/rpush/modis/pull/30) by [@rofreg](https://github.com/rofreg).
11
+ ## [v4.0.0](https://github.com/rpush/modis/tree/v4.0.0) (2021-04-28)
14
12
 
15
- ## v3.2.0 - 2019-12-12
13
+ [Full Changelog](https://github.com/rpush/modis/compare/v3.3.0...v4.0.0)
16
14
 
17
- - Add missing `#update` and `#update!`. [#27](https://github.com/rpush/modis/pull/27) by [@dsantosmerino](https://github.com/dsantosmerino).
15
+ **Merged pull requests:**
18
16
 
19
- ## v3.1.0 - 2019-10-18
17
+ - Makes hiredis a development dependency [\#31](https://github.com/rpush/modis/pull/31) ([fdocr](https://github.com/fdocr))
20
18
 
21
- - Test with Rails 6
22
- - Drop i18n dependency (credit goes to [@jas14](https://github.com/jas14) in [#23](https://github.com/rpush/modis/pull/23))
19
+ ## [v3.3.0](https://github.com/rpush/modis/tree/v3.3.0) (2020-07-07)
23
20
 
24
- ## v3.0.0 - 2018-12-20
21
+ [Full Changelog](https://github.com/rpush/modis/compare/v3.2.0...v3.3.0)
25
22
 
26
- - Drop support for any Ruby < 2.3 and Rails < 4.2.
27
- - Add support for Rails 5.2
28
- - Resolve Rubocop lint violations
29
- - Test combinations of Ruby and Rails versions in CI
23
+ **Merged pull requests:**
24
+
25
+ - Fix deprecation warnings [\#30](https://github.com/rpush/modis/pull/30) ([rofreg](https://github.com/rofreg))
26
+ - Test with Ruby 2.7 [\#28](https://github.com/rpush/modis/pull/28) ([aried3r](https://github.com/aried3r))
27
+
28
+ ## [v3.2.0](https://github.com/rpush/modis/tree/v3.2.0) (2019-12-12)
29
+
30
+ [Full Changelog](https://github.com/rpush/modis/compare/v3.1.0...v3.2.0)
31
+
32
+ **Merged pull requests:**
33
+
34
+ - Add missing `\#update` and `\#update!` persistance methods [\#27](https://github.com/rpush/modis/pull/27) ([dsantosmerino](https://github.com/dsantosmerino))
35
+
36
+ ## [v3.1.0](https://github.com/rpush/modis/tree/v3.1.0) (2019-10-18)
37
+
38
+ [Full Changelog](https://github.com/rpush/modis/compare/3.0.0...v3.1.0)
39
+
40
+ **Merged pull requests:**
41
+
42
+ - Remove i18n dependency [\#26](https://github.com/rpush/modis/pull/26) ([aried3r](https://github.com/aried3r))
43
+ - Test with Rails 6, Ubuntu 18.04, Ruby 2.6 [\#25](https://github.com/rpush/modis/pull/25) ([aried3r](https://github.com/aried3r))
44
+ - Fix build status badge [\#22](https://github.com/rpush/modis/pull/22) ([jas14](https://github.com/jas14))
45
+
46
+ ## [3.0.0](https://github.com/rpush/modis/tree/3.0.0) (2018-12-20)
47
+
48
+ [Full Changelog](https://github.com/rpush/modis/compare/v2.1.0...3.0.0)
49
+
50
+ **Merged pull requests:**
51
+
52
+ - Prep 3.0.0 release [\#21](https://github.com/rpush/modis/pull/21) ([garettarrowood](https://github.com/garettarrowood))
53
+ - Lock i18n version [\#20](https://github.com/rpush/modis/pull/20) ([garettarrowood](https://github.com/garettarrowood))
54
+ - Compatability with Rails 5.2's ActiveModel::Dirty [\#19](https://github.com/rpush/modis/pull/19) ([benlangfeld](https://github.com/benlangfeld))
55
+ - Resolve rubocop violations and lock version [\#17](https://github.com/rpush/modis/pull/17) ([garettarrowood](https://github.com/garettarrowood))
56
+ - Fix CI failures by resolving RuboCop offenses [\#12](https://github.com/rpush/modis/pull/12) ([garettarrowood](https://github.com/garettarrowood))
57
+ - get rid of old school rocket syntax [\#11](https://github.com/rpush/modis/pull/11) ([DmytroStepaniuk](https://github.com/DmytroStepaniuk))
58
+ - fix wrong readme example [\#10](https://github.com/rpush/modis/pull/10) ([DmytroStepaniuk](https://github.com/DmytroStepaniuk))
30
59
 
31
60
  ## v2.1.0
32
61
 
@@ -36,3 +65,6 @@
36
65
 
37
66
  - Support MRI 2.2.2+ and JRuby 9k+ [#5](https://github.com/rpush/modis/pull/5)
38
67
  - Remove YAML (de)serialization support [#5](https://github.com/rpush/modis/pull/5)
68
+
69
+
70
+ \* *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.0)
4
+ modis (4.0.1)
5
5
  activemodel (>= 5.2)
6
6
  activesupport (>= 5.2)
7
7
  connection_pool (>= 2)
@@ -23,7 +23,7 @@ GEM
23
23
  bundler
24
24
  rake
25
25
  thor (>= 0.14.0)
26
- ast (2.4.1)
26
+ ast (2.4.2)
27
27
  cane (3.0.0)
28
28
  parallel
29
29
  codeclimate-test-reporter (1.0.7)
@@ -38,13 +38,13 @@ GEM
38
38
  jaro_winkler (1.5.4)
39
39
  minitest (5.14.2)
40
40
  msgpack (1.3.3)
41
- parallel (1.19.2)
42
- parser (2.7.1.4)
41
+ parallel (1.20.1)
42
+ parser (3.0.1.0)
43
43
  ast (~> 2.4.1)
44
- powerpack (0.1.2)
45
44
  rainbow (3.0.0)
46
45
  rake (13.0.1)
47
- redis (4.2.1)
46
+ redis (4.6.0)
47
+ rexml (3.2.5)
48
48
  rspec (3.9.0)
49
49
  rspec-core (~> 3.9.0)
50
50
  rspec-expectations (~> 3.9.0)
@@ -58,15 +58,15 @@ GEM
58
58
  diff-lcs (>= 1.2.0, < 2.0)
59
59
  rspec-support (~> 3.9.0)
60
60
  rspec-support (3.9.3)
61
- rubocop (0.61.1)
61
+ rubocop (0.81.0)
62
62
  jaro_winkler (~> 1.5.1)
63
63
  parallel (~> 1.10)
64
- parser (>= 2.5, != 2.5.1.1)
65
- powerpack (~> 0.1)
64
+ parser (>= 2.7.0.1)
66
65
  rainbow (>= 2.2.2, < 4.0)
66
+ rexml
67
67
  ruby-progressbar (~> 1.7)
68
- unicode-display_width (~> 1.4.0)
69
- ruby-progressbar (1.10.1)
68
+ unicode-display_width (>= 1.4.0, < 2.0)
69
+ ruby-progressbar (1.11.0)
70
70
  simplecov (0.18.5)
71
71
  docile (~> 1.1)
72
72
  simplecov-html (~> 0.11)
@@ -75,7 +75,7 @@ GEM
75
75
  thread_safe (0.3.6)
76
76
  tzinfo (1.2.7)
77
77
  thread_safe (~> 0.1)
78
- unicode-display_width (1.4.1)
78
+ unicode-display_width (1.7.0)
79
79
  zeitwerk (2.4.0)
80
80
 
81
81
  PLATFORMS
@@ -89,8 +89,8 @@ DEPENDENCIES
89
89
  modis!
90
90
  rake
91
91
  rspec
92
- rubocop (= 0.61.1)
92
+ rubocop (= 0.81.0)
93
93
  simplecov
94
94
 
95
95
  BUNDLED WITH
96
- 2.1.4
96
+ 2.2.21
data/lib/modis/finder.rb CHANGED
@@ -20,8 +20,8 @@ module Modis
20
20
 
21
21
  records = Modis.with_connection do |redis|
22
22
  ids = redis.smembers(key_for(:all))
23
- redis.pipelined do
24
- ids.map { |id| record_for(redis, id) }
23
+ redis.pipelined do |pipeline|
24
+ ids.map { |id| record_for(pipeline, id) }
25
25
  end
26
26
  end
27
27
 
@@ -42,8 +42,13 @@ module Modis
42
42
  raise RecordNotFound, "Couldn't find #{name} without an ID" if ids.empty?
43
43
 
44
44
  records = Modis.with_connection do |redis|
45
- blk = proc { |id| record_for(redis, id) }
46
- ids.count == 1 ? ids.map(&blk) : redis.pipelined { ids.map(&blk) }
45
+ if ids.count == 1
46
+ ids.map { |id| record_for(redis, id) }
47
+ else
48
+ redis.pipelined do |pipeline|
49
+ ids.map { |id| record_for(pipeline, id) }
50
+ end
51
+ end
47
52
  end
48
53
 
49
54
  models = records_to_models(records)
@@ -135,13 +135,13 @@ module Modis
135
135
  def destroy
136
136
  self.class.transaction do |redis|
137
137
  run_callbacks :destroy do
138
- redis.pipelined do
139
- remove_from_indexes(redis)
138
+ redis.pipelined do |pipeline|
139
+ remove_from_indexes(pipeline)
140
140
  if self.class.all_index_enabled?
141
- redis.srem(self.class.key_for(:all), id)
142
- redis.srem(self.class.sti_base_key_for(:all), id) if self.class.sti_child?
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
143
  end
144
- redis.del(key)
144
+ pipeline.del(key)
145
145
  end
146
146
  end
147
147
  end
@@ -210,19 +210,19 @@ module Modis
210
210
  self.class.transaction do |redis|
211
211
  run_callbacks :save do
212
212
  run_callbacks callback do
213
- redis.pipelined do
213
+ redis.pipelined do |pipeline|
214
214
  attrs = coerced_attributes
215
215
  key = self.class.sti_child? ? self.class.sti_base_key_for(id) : self.class.key_for(id)
216
- future = attrs.any? ? redis.hmset(key, attrs) : :unchanged
216
+ future = attrs.any? ? pipeline.hmset(key, attrs) : :unchanged
217
217
 
218
218
  if new_record?
219
219
  if self.class.all_index_enabled?
220
- redis.sadd(self.class.key_for(:all), id)
221
- redis.sadd(self.class.sti_base_key_for(:all), id) if self.class.sti_child?
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
222
  end
223
- add_to_indexes(redis)
223
+ add_to_indexes(pipeline)
224
224
  else
225
- update_indexes(redis)
225
+ update_indexes(pipeline)
226
226
  end
227
227
  end
228
228
  end
@@ -8,7 +8,7 @@ module Modis
8
8
 
9
9
  module ClassMethods
10
10
  def transaction
11
- Modis.with_connection { |redis| redis.multi { yield(redis) } }
11
+ Modis.with_connection { |redis| redis.multi { |transaction| yield(transaction) } }
12
12
  end
13
13
  end
14
14
  end
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.0'
4
+ VERSION = '4.0.1'
5
5
  end
data/modis.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |gem|
37
37
  gem.add_development_dependency 'rspec'
38
38
  gem.add_development_dependency 'codeclimate-test-reporter'
39
39
  gem.add_development_dependency 'cane'
40
- gem.add_development_dependency 'rubocop', '0.61.1'
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
43
  end
@@ -111,8 +111,13 @@ 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
- expect(model.class).to receive(:transaction).and_yield(redis)
115
- expect(redis).to receive(:pipelined).and_yield
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
116
121
  model.save
117
122
  expect { model.class.find(model.id) }.to raise_error(Modis::RecordNotFound)
118
123
  end
@@ -135,8 +140,13 @@ describe Modis::Persistence do
135
140
  model.age = 11
136
141
  redis = double
137
142
  expect(redis).to receive(:hmset).with("modis:persistence_spec:mock_model:1", ["age", "\v"]).and_return(double(value: 'OK'))
138
- expect(model.class).to receive(:transaction).and_yield(redis)
139
- expect(redis).to receive(:pipelined).and_yield
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
140
150
  model.save!
141
151
  expect(model.age).to eq(11)
142
152
  end
data/spec/spec_helper.rb CHANGED
@@ -12,6 +12,8 @@ end
12
12
 
13
13
  require 'modis'
14
14
 
15
+ Redis.raise_deprecations = true if Gem.loaded_specs['redis'].version >= Gem::Version.new('4.6.0')
16
+
15
17
  Modis.configure do |config|
16
18
  config.namespace = 'modis'
17
19
  end
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.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Leitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-28 00:00:00.000000000 Z
11
+ date: 2022-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 0.61.1
159
+ version: 0.81.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: 0.61.1
166
+ version: 0.81.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: simplecov
169
169
  requirement: !ruby/object:Gem::Requirement