redic 1.4.1 → 1.5.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 +4 -4
- data/CONTRIBUTING +19 -0
- data/lib/redic.rb +10 -0
- data/lib/redic/client.rb +11 -3
- data/redic.gemspec +1 -1
- data/tests/redic_test.rb +5 -4
- data/tests/unix_test.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 355a240594d8061dd7923241cc74287a20fa95e9
|
4
|
+
data.tar.gz: 48970d72e3f18979402c1e48e0abbec18bca841f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83f2a759265a3ec0fc8ed6695a648412219e9b6d929e11f5927050baa9d14b97ca1ad2746d16281e8787aa24bb82e931cb0862fff4b9b269fa954c1cc9596927
|
7
|
+
data.tar.gz: 99a04bb3a6952b079ae6b0eee9ab52e9f17346fffa3052d8fc237dfe26dd239d34d26b2ecf37112910ac47b91609e78b84815b4ef0427168de2545ef441bbf2d
|
data/CONTRIBUTING
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
This code tries to solve a particular problem with a very simple
|
2
|
+
implementation. We try to keep the code to a minimum while making
|
3
|
+
it as clear as possible. The design is very likely finished, and
|
4
|
+
if some feature is missing it is possible that it was left out on
|
5
|
+
purpose. That said, new usage patterns may arise, and when that
|
6
|
+
happens we are ready to adapt if necessary.
|
7
|
+
|
8
|
+
A good first step for contributing is to meet us on IRC and discuss
|
9
|
+
ideas. We spend a lot of time on #lesscode at freenode, always ready
|
10
|
+
to talk about code and simplicity. If connecting to IRC is not an
|
11
|
+
option, you can create an issue explaining the proposed change and
|
12
|
+
a use case. We pay a lot of attention to use cases, because our
|
13
|
+
goal is to keep the code base simple. Usually the result of a
|
14
|
+
conversation is the creation of a different tool.
|
15
|
+
|
16
|
+
Please don't start the conversation with a pull request. The code
|
17
|
+
should come at last, and even though it may help to convey an idea,
|
18
|
+
more often than not it draws the attention to a particular
|
19
|
+
implementation.
|
data/lib/redic.rb
CHANGED
data/lib/redic/client.rb
CHANGED
@@ -3,6 +3,9 @@ require "uri"
|
|
3
3
|
|
4
4
|
class Redic
|
5
5
|
class Client
|
6
|
+
EMPTY = "".freeze
|
7
|
+
SLASH = "/".freeze
|
8
|
+
|
6
9
|
attr :timeout
|
7
10
|
|
8
11
|
def initialize(url, timeout)
|
@@ -68,9 +71,14 @@ class Redic
|
|
68
71
|
raise err, "Can't connect to: %s" % @uri
|
69
72
|
end
|
70
73
|
|
71
|
-
if @uri.scheme
|
72
|
-
|
73
|
-
|
74
|
+
if @uri.scheme != "unix"
|
75
|
+
if @uri.password
|
76
|
+
assert_ok(call("AUTH", @uri.password))
|
77
|
+
end
|
78
|
+
|
79
|
+
if @uri.path != EMPTY && @uri.path != SLASH
|
80
|
+
assert_ok(call("SELECT", @uri.path[1..-1]))
|
81
|
+
end
|
74
82
|
end
|
75
83
|
end
|
76
84
|
|
data/redic.gemspec
CHANGED
data/tests/redic_test.rb
CHANGED
@@ -7,11 +7,12 @@ prepare do
|
|
7
7
|
c = Redic.new(REDIS_URL)
|
8
8
|
|
9
9
|
begin
|
10
|
-
c.call("FLUSHDB")
|
10
|
+
c.call!("FLUSHDB").inspect
|
11
11
|
rescue
|
12
|
-
c.call("AUTH", "foo")
|
13
|
-
c.call("
|
14
|
-
c.call("
|
12
|
+
c.call!("AUTH", "foo")
|
13
|
+
c.call!("SELECT", "0")
|
14
|
+
c.call!("FLUSHDB")
|
15
|
+
c.call!("CONFIG", "SET", "requirepass", "")
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
data/tests/unix_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hiredis
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- .gems
|
37
37
|
- .gitignore
|
38
38
|
- CHANGELOG
|
39
|
+
- CONTRIBUTING
|
39
40
|
- LICENSE
|
40
41
|
- README.md
|
41
42
|
- lib/redic.rb
|