redis 2.0.1 → 2.0.2
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.
- data/README.markdown +1 -1
- data/Rakefile +13 -6
- data/lib/redis.rb +11 -5
- data/lib/redis/client.rb +1 -1
- data/lib/redis/url.rb +23 -0
- metadata +4 -6
data/README.markdown
CHANGED
@@ -117,4 +117,4 @@ Check the [Redis Command Reference](http://code.google.com/p/redis/wiki/CommandR
|
|
117
117
|
|
118
118
|
## Contributing
|
119
119
|
|
120
|
-
[Fork the project](http://github.com/ezmobius/redis-rb) and send pull requests. You can also ask for help at `#redis` on Freenode.
|
120
|
+
[Fork the project](http://github.com/ezmobius/redis-rb) and send pull requests. You can also ask for help at `#redis-rb` on Freenode.
|
data/Rakefile
CHANGED
@@ -40,16 +40,22 @@ task :run => [:start, :test, :stop]
|
|
40
40
|
|
41
41
|
desc "Start the Redis server"
|
42
42
|
task :start do
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
redis_running = \
|
44
|
+
begin
|
45
|
+
File.exists?(REDIS_PID) && Process.kill(0, File.read(REDIS_PID).to_i)
|
46
|
+
rescue Errno::ESRCH
|
47
|
+
FileUtils.rm REDIS_PID
|
48
|
+
false
|
49
|
+
end
|
50
|
+
|
51
|
+
system "redis-server #{REDIS_CNF}" unless redis_running
|
46
52
|
end
|
47
53
|
|
48
54
|
desc "Stop the Redis server"
|
49
55
|
task :stop do
|
50
56
|
if File.exists?(REDIS_PID)
|
51
|
-
|
52
|
-
|
57
|
+
Process.kill "INT", File.read(REDIS_PID).to_i
|
58
|
+
FileUtils.rm REDIS_PID
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
@@ -85,6 +91,7 @@ end
|
|
85
91
|
namespace :commands do
|
86
92
|
def redis_commands
|
87
93
|
$redis_commands ||= begin
|
94
|
+
require "open-uri"
|
88
95
|
require "nokogiri"
|
89
96
|
|
90
97
|
doc = Nokogiri::HTML(open("http://code.google.com/p/redis/wiki/CommandReference"))
|
@@ -127,7 +134,7 @@ namespace :commands do
|
|
127
134
|
task :verify do
|
128
135
|
require "redis"
|
129
136
|
|
130
|
-
Dir["test/**/*_test.rb"].each { |f| require f }
|
137
|
+
Dir["test/**/*_test.rb"].each { |f| require "./#{f}" }
|
131
138
|
|
132
139
|
log = StringIO.new
|
133
140
|
|
data/lib/redis.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'socket'
|
2
2
|
|
3
3
|
class Redis
|
4
|
-
VERSION = "2.0.
|
4
|
+
VERSION = "2.0.2"
|
5
5
|
|
6
6
|
class ProtocolError < RuntimeError
|
7
7
|
def initialize(reply_type)
|
@@ -157,12 +157,12 @@ class Redis
|
|
157
157
|
@client.call(:rpop, key)
|
158
158
|
end
|
159
159
|
|
160
|
-
def blpop(
|
161
|
-
@client.call_without_timeout(:blpop,
|
160
|
+
def blpop(*args)
|
161
|
+
@client.call_without_timeout(:blpop, *args)
|
162
162
|
end
|
163
163
|
|
164
|
-
def brpop(
|
165
|
-
@client.call_without_timeout(:brpop,
|
164
|
+
def brpop(*args)
|
165
|
+
@client.call_without_timeout(:brpop, *args)
|
166
166
|
end
|
167
167
|
|
168
168
|
def rpoplpush(source, destination)
|
@@ -452,6 +452,8 @@ class Redis
|
|
452
452
|
def quit
|
453
453
|
@client.call(:quit)
|
454
454
|
rescue Errno::ECONNRESET
|
455
|
+
ensure
|
456
|
+
@client.disconnect
|
455
457
|
end
|
456
458
|
|
457
459
|
def pipelined
|
@@ -519,6 +521,10 @@ class Redis
|
|
519
521
|
@client.id
|
520
522
|
end
|
521
523
|
|
524
|
+
def inspect
|
525
|
+
"#<Redis client v#{Redis::VERSION} connected to #{id} (Redis v#{info["redis_version"]})>"
|
526
|
+
end
|
527
|
+
|
522
528
|
def method_missing(command, *args)
|
523
529
|
@client.call(command, *args)
|
524
530
|
end
|
data/lib/redis/client.rb
CHANGED
data/lib/redis/url.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require "uri/generic"
|
2
|
+
|
3
|
+
module URI
|
4
|
+
class Redis < Generic
|
5
|
+
DEFAULT_PORT = 6379
|
6
|
+
|
7
|
+
COMPONENT = [:scheme, :password, :host, :port, :db].freeze
|
8
|
+
|
9
|
+
def db
|
10
|
+
path[1..-1].to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
alias password user
|
14
|
+
|
15
|
+
protected
|
16
|
+
def check_path(value)
|
17
|
+
if super(value)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
@@schemes["REDIS"] = Redis
|
23
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 13
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 2
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
8
|
+
- 2
|
9
|
+
version: 2.0.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Ezra Zygmuntowicz
|
@@ -22,7 +21,7 @@ autorequire: redis
|
|
22
21
|
bindir: bin
|
23
22
|
cert_chain: []
|
24
23
|
|
25
|
-
date: 2010-
|
24
|
+
date: 2010-06-21 00:00:00 -03:00
|
26
25
|
default_executable:
|
27
26
|
dependencies: []
|
28
27
|
|
@@ -44,6 +43,7 @@ files:
|
|
44
43
|
- lib/redis/hash_ring.rb
|
45
44
|
- lib/redis/pipeline.rb
|
46
45
|
- lib/redis/subscribe.rb
|
46
|
+
- lib/redis/url.rb
|
47
47
|
- lib/redis.rb
|
48
48
|
has_rdoc: true
|
49
49
|
homepage: http://github.com/ezmobius/redis-rb
|
@@ -59,7 +59,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
hash: 3
|
63
62
|
segments:
|
64
63
|
- 0
|
65
64
|
version: "0"
|
@@ -68,7 +67,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
67
|
requirements:
|
69
68
|
- - ">="
|
70
69
|
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
70
|
segments:
|
73
71
|
- 0
|
74
72
|
version: "0"
|