modis 4.3.0 → 4.3.2

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: 9a9d3d05277e2ddf26b7c14547b3e03f37cb6fbb771ba9b2a6b61acce6485bd9
4
- data.tar.gz: 031d2f34a15d5f077b5b01c2e4286b73285ed2171f4029577c2d812a22f6da6d
3
+ metadata.gz: bd66702e695b7d99aa4687b5112f11182228c746109da11e993ababfa5eb62d0
4
+ data.tar.gz: 7999704909f7ad4bfa8365d3107fe2e9f4446070545898bc53d6939c0f733526
5
5
  SHA512:
6
- metadata.gz: 9b76390c567d8ba5495c226cb7425372797fe9b3d5e2d2a07a8f891bed7e5aa4f3c66d84f54c6cac7814f07f156e958687a62da8179c4d1922da2efb065412c1
7
- data.tar.gz: dba384ff8ad647615016ed340c21e72088d45b1186b91e96f28c579b73ff7d45cd2616b10c70d42fcb17e1f4cfe4889074c0eb8a6ab41b0e92082d83d663c026
6
+ metadata.gz: fc275ca88973e5b553125a3b0cd7f4aa048e4627d4b6ba2f8ebba9867910e0f7acd004d1084b8ad93dbe9bbb836c111615a0cd8e0bbd523c323ee8098c1023ce
7
+ data.tar.gz: 37848dacc6eb044dbf04af650111916876f0c13c74f09cd8793cd34a52b5121f8504283357944175c3cfb4c4105d0bec1212649ecef3a87c76d9c3d646885d19
@@ -28,9 +28,9 @@ jobs:
28
28
  strategy:
29
29
  fail-fast: false
30
30
  matrix:
31
- gemfile: ['rails_5.2', 'rails_6.0', 'rails_6.1', 'rails_7.0']
31
+ gemfile: ['rails_5.2', 'rails_6.0', 'rails_6.1', 'rails_7.0', 'rails_7.1', 'rails_7.2']
32
32
 
33
- ruby: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1']
33
+ ruby: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3']
34
34
 
35
35
  exclude:
36
36
  # Rails 5.2 requires Ruby < 3.0
@@ -39,6 +39,10 @@ jobs:
39
39
  gemfile: 'rails_5.2'
40
40
  - ruby: '3.1'
41
41
  gemfile: 'rails_5.2'
42
+ - ruby: '3.2'
43
+ gemfile: 'rails_5.2'
44
+ - ruby: '3.3'
45
+ gemfile: 'rails_5.2'
42
46
  # Rails >= 6 requires Ruby >= 2.5
43
47
  - ruby: '2.4'
44
48
  gemfile: 'rails_6.0'
@@ -51,6 +55,22 @@ jobs:
51
55
  gemfile: 'rails_7.0'
52
56
  - ruby: '2.6'
53
57
  gemfile: 'rails_7.0'
58
+ - ruby: '2.4'
59
+ gemfile: 'rails_7.1'
60
+ - ruby: '2.5'
61
+ gemfile: 'rails_7.1'
62
+ - ruby: '2.6'
63
+ gemfile: 'rails_7.1'
64
+ - ruby: '2.4'
65
+ gemfile: 'rails_7.2'
66
+ - ruby: '2.5'
67
+ gemfile: 'rails_7.2'
68
+ - ruby: '2.6'
69
+ gemfile: 'rails_7.2'
70
+ - ruby: '2.7'
71
+ gemfile: 'rails_7.2'
72
+ - ruby: '3.0'
73
+ gemfile: 'rails_7.2'
54
74
 
55
75
  env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
56
76
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
@@ -66,3 +86,15 @@ jobs:
66
86
 
67
87
  - name: Run tests
68
88
  run: bundle exec rake
89
+
90
+ tests:
91
+ runs-on: ubuntu-latest
92
+ needs: test
93
+ if: always()
94
+ steps:
95
+ - name: All tests ok
96
+ if: ${{ !(contains(needs.*.result, 'failure')) }}
97
+ run: exit 0
98
+ - name: Some tests failed
99
+ if: ${{ contains(needs.*.result, 'failure') }}
100
+ run: exit 1
@@ -1,3 +1,3 @@
1
1
  user=rpush
2
2
  project=modis
3
- future-release=v4.1.0
3
+ future-release=v4.3.2
data/Appraisals CHANGED
@@ -19,3 +19,13 @@ appraise 'rails-7.0' do
19
19
  gem 'activemodel', '~> 7.0.0'
20
20
  gem 'activesupport', '~> 7.0.0'
21
21
  end
22
+
23
+ appraise 'rails-7.1' do
24
+ gem 'activemodel', '~> 7.1.0'
25
+ gem 'activesupport', '~> 7.1.0'
26
+ end
27
+
28
+ appraise 'rails-7.2' do
29
+ gem 'activemodel', '~> 7.2.0'
30
+ gem 'activesupport', '~> 7.2.0'
31
+ end
data/CHANGELOG.md CHANGED
@@ -1,8 +1,29 @@
1
1
  # Changelog
2
2
 
3
- ## [v4.1.0](https://github.com/rpush/modis/tree/v4.1.0) (2024-07-31)
3
+ ## [v4.3.2](https://github.com/rpush/modis/tree/v4.3.2) (2024-09-06)
4
4
 
5
- [Full Changelog](https://github.com/rpush/modis/compare/v4.2.0...v4.1.0)
5
+ [Full Changelog](https://github.com/rpush/modis/compare/v4.3.1...v4.3.2)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Test on Rails 7.2 [\#54](https://github.com/rpush/modis/pull/54) ([benlangfeld](https://github.com/benlangfeld))
10
+ - Test on new Ruby/Rails versions [\#52](https://github.com/rpush/modis/pull/52) ([benlangfeld](https://github.com/benlangfeld))
11
+
12
+ ## [v4.3.1](https://github.com/rpush/modis/tree/v4.3.1) (2024-08-01)
13
+
14
+ [Full Changelog](https://github.com/rpush/modis/compare/v4.3.0...v4.3.1)
15
+
16
+ **Closed issues:**
17
+
18
+ - Release 4.3.0 breaks the Rpush initialization [\#50](https://github.com/rpush/modis/issues/50)
19
+
20
+ **Merged pull requests:**
21
+
22
+ - Restore backwards compatibility broken in 4.3.0 [\#51](https://github.com/rpush/modis/pull/51) ([benlangfeld](https://github.com/benlangfeld))
23
+
24
+ ## [v4.3.0](https://github.com/rpush/modis/tree/v4.3.0) (2024-07-31)
25
+
26
+ [Full Changelog](https://github.com/rpush/modis/compare/v4.2.0...v4.3.0)
6
27
 
7
28
  **Merged pull requests:**
8
29
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- modis (4.3.0)
4
+ modis (4.3.2)
5
5
  activemodel (>= 5.2)
6
6
  activesupport (>= 5.2)
7
7
  connection_pool (>= 2)
@@ -94,7 +94,7 @@ GEM
94
94
  public_suffix (5.0.1)
95
95
  rainbow (3.0.0)
96
96
  rake (13.0.1)
97
- redis (5.2.0)
97
+ redis (5.3.0)
98
98
  redis-client (>= 0.22.0)
99
99
  redis-client (0.22.2)
100
100
  connection_pool
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activemodel", "~> 7.1.0"
6
+ gem "activesupport", "~> 7.1.0"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activemodel", "~> 7.2.0"
6
+ gem "activesupport", "~> 7.2.0"
7
+
8
+ gemspec path: "../"
@@ -9,8 +9,8 @@ module Modis
9
9
  end
10
10
 
11
11
  class << self
12
- attr_reader :config
12
+ def config
13
+ @config ||= Configuration.new
14
+ end
13
15
  end
14
-
15
- @config = Configuration.new
16
16
  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.3.0'
4
+ VERSION = '4.3.2'
5
5
  end
data/lib/modis.rb CHANGED
@@ -18,11 +18,14 @@ require 'modis/index'
18
18
  require 'modis/model'
19
19
 
20
20
  module Modis
21
- @mutex = Mutex.new
22
21
  class << self
23
22
  attr_writer :connection_pool_size, :connection_pool_timeout,
24
23
  :connection_pools
25
24
 
25
+ def mutex
26
+ @mutex ||= Mutex.new
27
+ end
28
+
26
29
  def redis_options
27
30
  @redis_options ||= { default: {} }
28
31
  end
@@ -31,7 +34,20 @@ module Modis
31
34
  if options.is_a?(Hash) && options.values.first.is_a?(Hash)
32
35
  @redis_options = options.transform_values(&:dup)
33
36
  else
34
- @redis_options[:default] = options
37
+ redis_options[:default] = options
38
+ end
39
+ end
40
+
41
+ def reset!
42
+ connection_pools.each do |key, _|
43
+ with_connection(key) do |connection|
44
+ keys = connection.keys "#{config.namespace}:*"
45
+ connection.del(*keys) unless keys.empty?
46
+ end
47
+ end
48
+ instance_variables.each do |var|
49
+ instance_variable_set(var, nil)
50
+ remove_instance_variable(var)
35
51
  end
36
52
  end
37
53
 
@@ -49,7 +65,7 @@ module Modis
49
65
 
50
66
  def connection_pool(pool_name = :default)
51
67
  connection_pools[pool_name] ||= begin
52
- @mutex.synchronize do
68
+ mutex.synchronize do
53
69
  ConnectionPool.new(
54
70
  size: connection_pool_size,
55
71
  timeout: connection_pool_timeout
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'spec_helper'
4
+
3
5
  module MultiRedisSpec
4
6
  class DefaultUserModel
5
7
  include Modis::Model
@@ -277,7 +277,7 @@ describe Modis::Persistence do
277
277
  end
278
278
 
279
279
  describe 'update_attributes!' do
280
- around(:each) { |example| ActiveSupport::Deprecation.silence { example.run } }
280
+ around(:each) { |example| ActiveSupport::Deprecation.new.silence { example.run } }
281
281
 
282
282
  it 'updates the given attributes' do
283
283
  model.update_attributes!(name: 'Derp', age: 29)
@@ -331,7 +331,7 @@ describe Modis::Persistence do
331
331
  end
332
332
 
333
333
  describe 'update_attributes' do
334
- around(:each) { |example| ActiveSupport::Deprecation.silence { example.run } }
334
+ around(:each) { |example| ActiveSupport::Deprecation.new.silence { example.run } }
335
335
 
336
336
  it 'updates the given attributes' do
337
337
  model.update_attributes(name: 'Derp', age: 29)
data/spec/spec_helper.rb CHANGED
@@ -14,18 +14,12 @@ require 'modis'
14
14
 
15
15
  Redis.raise_deprecations = true if Gem.loaded_specs['redis'].version >= Gem::Version.new('4.6.0')
16
16
 
17
- Modis.configure do |config|
18
- config.namespace = 'modis'
19
- end
20
-
21
17
  RSpec.configure do |config|
22
18
  config.after :each do
23
19
  RSpec::Mocks.space.proxy_for(Modis).reset
24
- Modis.connection_pools.each do |key, _|
25
- Modis.with_connection(key) do |connection|
26
- keys = connection.keys "#{Modis.config.namespace}:*"
27
- connection.del(*keys) unless keys.empty?
28
- end
20
+ Modis.reset!
21
+ Modis.configure do |modis_config|
22
+ modis_config.namespace = 'modis'
29
23
  end
30
24
  end
31
25
  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.3.0
4
+ version: 4.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Leitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-31 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -233,6 +233,8 @@ files:
233
233
  - gemfiles/rails_6.0.gemfile
234
234
  - gemfiles/rails_6.1.gemfile
235
235
  - gemfiles/rails_7.0.gemfile
236
+ - gemfiles/rails_7.1.gemfile
237
+ - gemfiles/rails_7.2.gemfile
236
238
  - lib/modis.rb
237
239
  - lib/modis/attribute.rb
238
240
  - lib/modis/configuration.rb