redis-store 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of redis-store might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58dbe54f1d5825384c5def102f10898a6b9b2e49
4
- data.tar.gz: c527c3db592454bbd8a950790debe970ee6a59ba
3
+ metadata.gz: c34d0f4a72ee0603e5b2ef2b95808baac398b667
4
+ data.tar.gz: e4805c9cd1bfd2cffc6504e36bddf00c80b0ce45
5
5
  SHA512:
6
- metadata.gz: 3ea158585055db1bffbe1add2fca655c69eeeaebd0e0017a6fee71b029a0dfacaec915f06187d9a68bd92f218c25fffafa6cfd756bc312be5f39979e65a5f7fe
7
- data.tar.gz: dd0f84f52e02aa72a5434b22966edc442ba84febea9478fb8c8861e8515678c718cd5c0b1c315d16d34fcbd4f6749ac3c11eadbb331ad0e5b7de03e4d8077b95
6
+ metadata.gz: 85aa71788df20715c5878ee1b13c047c5904a2b57fb30f4d69e9235dd61692b8f01671ac112f789f9ea6730a8db3cc188226c036188691a563df0e48964a6f90
7
+ data.tar.gz: 9bebac3bac2a0ee4dc94db6f08325ce707a65ca289f36ad049769ed0cbc0ea6c6eba0f8ce8c0786560242f7b6ba683567743738c1d7897669b3909fffe854368
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ *1.1.6 (July 16, 2015)*
2
+
3
+ https://github.com/redis-store/redis-store/compare/v1.1.5...v1.1.6
4
+
5
+ *1.1.5 (June 8, 2015)*
6
+
7
+ https://github.com/redis-store/redis-store/compare/v1.1.4...v1.1.5
8
+
1
9
  *1.1.4 (August 20, 2013)*
2
10
 
3
11
  * Bump version v1.1.4
@@ -5,6 +5,7 @@ require 'redis/distributed_store'
5
5
  require 'redis/store/namespace'
6
6
  require 'redis/store/marshalling'
7
7
  require 'redis/store/version'
8
+ require 'redis/store/redis_version'
8
9
 
9
10
  class Redis
10
11
  class Store < self
@@ -34,6 +34,18 @@ class Redis
34
34
  node_for(key).setnx(key, value, options)
35
35
  end
36
36
 
37
+ def redis_version
38
+ nodes.first.redis_version unless nodes.empty?
39
+ end
40
+
41
+ def supports_redis_version?(version)
42
+ if nodes.empty?
43
+ false
44
+ else
45
+ nodes.first.supports_redis_version?(version)
46
+ end
47
+ end
48
+
37
49
  private
38
50
  def _extend_namespace(options)
39
51
  @namespace = options[:namespace]
@@ -1,9 +1,10 @@
1
1
  require 'redis/store/ttl'
2
2
  require 'redis/store/interface'
3
+ require 'redis/store/redis_version'
3
4
 
4
5
  class Redis
5
6
  class Store < self
6
- include Ttl, Interface
7
+ include Ttl, Interface, RedisVersion
7
8
 
8
9
  def initialize(options = { })
9
10
  super
@@ -0,0 +1,14 @@
1
+ class Redis
2
+ class Store < self
3
+ module RedisVersion
4
+ def redis_version
5
+ info('server')['redis_version']
6
+ end
7
+
8
+ def supports_redis_version?(version)
9
+ (redis_version.split(".").map(&:to_i) <=> version.split(".").map(&:to_i)) >= 0
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -1,5 +1,5 @@
1
1
  class Redis
2
2
  class Store < self
3
- VERSION = '1.1.6'
3
+ VERSION = '1.1.7'
4
4
  end
5
5
  end
@@ -39,6 +39,20 @@ describe "Redis::DistributedStore" do
39
39
  @dmr.get("rabbit").must_equal(@rabbit)
40
40
  end
41
41
 
42
+ describe '#redis_version' do
43
+ it 'returns redis version' do
44
+ @dmr.nodes.first.expects(:redis_version)
45
+ @dmr.redis_version
46
+ end
47
+ end
48
+
49
+ describe '#supports_redis_version?' do
50
+ it 'returns redis version' do
51
+ @dmr.nodes.first.expects(:supports_redis_version?).with('2.8.0')
52
+ @dmr.supports_redis_version?('2.8.0')
53
+ end
54
+ end
55
+
42
56
  describe "namespace" do
43
57
  it "uses namespaced key" do
44
58
  @dmr = Redis::DistributedStore.new [
@@ -0,0 +1,29 @@
1
+ require 'test_helper'
2
+
3
+ describe "Redis::RedisVersion" do
4
+ def setup
5
+ @store = Redis::Store.new
6
+ end
7
+
8
+ def teardown
9
+ @store.quit
10
+ end
11
+
12
+ describe '#redis_version' do
13
+ it 'returns redis version' do
14
+ @store.redis_version.to_s.must_match(/^\d{1}\.\d{1,}\.\d{1,}$/)
15
+ end
16
+ end
17
+
18
+ describe '#supports_redis_version?' do
19
+ it 'returns true if redis version is greater or equal to required version' do
20
+ @store.stubs(:redis_version).returns('2.8.19')
21
+ @store.supports_redis_version?('2.6.0').must_equal(true)
22
+ @store.supports_redis_version?('2.8.19').must_equal(true)
23
+ @store.supports_redis_version?('2.8.20').must_equal(false)
24
+ @store.supports_redis_version?('2.9.0').must_equal(false)
25
+ @store.supports_redis_version?('3.0.0').must_equal(false)
26
+ end
27
+ end
28
+ end
29
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-store
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-16 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -130,6 +130,7 @@ files:
130
130
  - lib/redis/store/interface.rb
131
131
  - lib/redis/store/marshalling.rb
132
132
  - lib/redis/store/namespace.rb
133
+ - lib/redis/store/redis_version.rb
133
134
  - lib/redis/store/ttl.rb
134
135
  - lib/redis/store/version.rb
135
136
  - redis-store.gemspec
@@ -138,6 +139,7 @@ files:
138
139
  - test/redis/store/interface_test.rb
139
140
  - test/redis/store/marshalling_test.rb
140
141
  - test/redis/store/namespace_test.rb
142
+ - test/redis/store/redis_version_test.rb
141
143
  - test/redis/store/ttl_test.rb
142
144
  - test/redis/store/version_test.rb
143
145
  - test/redis/store_test.rb
@@ -162,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
164
  version: '0'
163
165
  requirements: []
164
166
  rubyforge_project: redis-store
165
- rubygems_version: 2.4.8
167
+ rubygems_version: 2.4.5.1
166
168
  signing_key:
167
169
  specification_version: 4
168
170
  summary: Redis stores for Ruby frameworks
@@ -172,6 +174,7 @@ test_files:
172
174
  - test/redis/store/interface_test.rb
173
175
  - test/redis/store/marshalling_test.rb
174
176
  - test/redis/store/namespace_test.rb
177
+ - test/redis/store/redis_version_test.rb
175
178
  - test/redis/store/ttl_test.rb
176
179
  - test/redis/store/version_test.rb
177
180
  - test/redis/store_test.rb