eventmachine-redis 0.1.1 → 0.1.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 +0 -14
- data/VERSION +1 -1
- data/eventmachine-redis.gemspec +3 -5
- data/lib/eventmachine-redis.rb +3 -3
- data/spec/redis_spec.rb +5 -5
- metadata +3 -5
- data/examples/push-shift.rb +0 -16
data/README.markdown
CHANGED
@@ -2,20 +2,6 @@
|
|
2
2
|
|
3
3
|
An [EventMachine](http://github.com/eventmachine/eventmachine/) based Redis client.
|
4
4
|
|
5
|
-
## Example
|
6
|
-
|
7
|
-
EM.run do
|
8
|
-
Redis = EM::Protocols::Redis.connect
|
9
|
-
|
10
|
-
puts "Waiting for item on 'queue'..."
|
11
|
-
|
12
|
-
Redis.shift('queue', :timeout => 0) do |key, item|
|
13
|
-
puts "Item: #{item}"
|
14
|
-
|
15
|
-
EM.stop
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
5
|
## Warning
|
20
6
|
|
21
7
|
This was written as a learning exercise and is currently very incomplete.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/eventmachine-redis.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{eventmachine-redis}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tristan Dunn"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-29}
|
13
13
|
s.description = %q{An EventMachine based Redis client.}
|
14
14
|
s.email = %q{hello@tristandunn.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
|
|
20
20
|
"Rakefile",
|
21
21
|
"VERSION",
|
22
22
|
"eventmachine-redis.gemspec",
|
23
|
-
"examples/push-shift.rb",
|
24
23
|
"lib/eventmachine-redis.rb",
|
25
24
|
"spec/redis_spec.rb",
|
26
25
|
"spec/spec_helper.rb"
|
@@ -32,8 +31,7 @@ Gem::Specification.new do |s|
|
|
32
31
|
s.summary = %q{An EventMachine based Redis client.}
|
33
32
|
s.test_files = [
|
34
33
|
"spec/redis_spec.rb",
|
35
|
-
"spec/spec_helper.rb"
|
36
|
-
"examples/push-shift.rb"
|
34
|
+
"spec/spec_helper.rb"
|
37
35
|
]
|
38
36
|
|
39
37
|
if s.respond_to? :specification_version then
|
data/lib/eventmachine-redis.rb
CHANGED
@@ -9,7 +9,7 @@ module EventMachine::Protocols::Redis
|
|
9
9
|
TYPE_INTEGER = ':'.freeze
|
10
10
|
TYPE_MULTIPLE = '*'.freeze
|
11
11
|
|
12
|
-
MULTILINE_COMMANDS = %w(
|
12
|
+
MULTILINE_COMMANDS = %w(PUBLISH).freeze
|
13
13
|
|
14
14
|
def self.connect(host = 'localhost', port = 6379)
|
15
15
|
EM.connect(host, port, self)
|
@@ -41,8 +41,8 @@ module EventMachine::Protocols::Redis
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
45
|
-
command('
|
44
|
+
def publish(channel, message, &block)
|
45
|
+
command('PUBLISH', channel, message, &block)
|
46
46
|
end
|
47
47
|
|
48
48
|
def shift(key, options = {}, &block)
|
data/spec/redis_spec.rb
CHANGED
@@ -25,7 +25,7 @@ describe EventMachine::Protocols::Redis do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should define multiline commands constant' do
|
28
|
-
Redis::MULTILINE_COMMANDS.should == %w(
|
28
|
+
Redis::MULTILINE_COMMANDS.should == %w(PUBLISH)
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should connect via EventMachine when calling Redis.connect' do
|
@@ -88,10 +88,10 @@ describe EventMachine::Protocols::Redis do
|
|
88
88
|
@completed.should be_true
|
89
89
|
end
|
90
90
|
|
91
|
-
describe '#
|
92
|
-
it 'should generate
|
93
|
-
@instance.
|
94
|
-
@instance.sent_data.should == "
|
91
|
+
describe '#publish' do
|
92
|
+
it 'should generate PUBLISH command' do
|
93
|
+
@instance.publish('channel', 'message')
|
94
|
+
@instance.sent_data.should == "PUBLISH channel 7\r\nmessage\r\n"
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tristan Dunn
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-29 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -31,7 +31,6 @@ files:
|
|
31
31
|
- Rakefile
|
32
32
|
- VERSION
|
33
33
|
- eventmachine-redis.gemspec
|
34
|
-
- examples/push-shift.rb
|
35
34
|
- lib/eventmachine-redis.rb
|
36
35
|
- spec/redis_spec.rb
|
37
36
|
- spec/spec_helper.rb
|
@@ -68,4 +67,3 @@ summary: An EventMachine based Redis client.
|
|
68
67
|
test_files:
|
69
68
|
- spec/redis_spec.rb
|
70
69
|
- spec/spec_helper.rb
|
71
|
-
- examples/push-shift.rb
|
data/examples/push-shift.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'eventmachine-redis'
|
5
|
-
|
6
|
-
EM.run do
|
7
|
-
Redis = EM::Protocols::Redis.connect
|
8
|
-
|
9
|
-
puts "Waiting for item on 'queue'..."
|
10
|
-
|
11
|
-
Redis.shift('queue', :timeout => 0) do |key, item|
|
12
|
-
puts "Item: #{item}"
|
13
|
-
|
14
|
-
EM.stop
|
15
|
-
end
|
16
|
-
end
|