celluloid-redis 0.0.1 → 0.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/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.0.2
2
+ -----
3
+ * Bugfix for handling Errno::ECONNRESET in the same way as redis-rb
4
+
1
5
  0.0.1
2
6
  -----
3
7
  * Initial (pre-)release
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  Celluloid::Redis
2
2
  ================
3
+ [![Gem Version](https://badge.fury.io/rb/celluloid-redis.png)](http://rubygems.org/gems/celluloid-redis)
3
4
  [![Build Status](https://secure.travis-ci.org/celluloid/celluloid-redis.png?branch=master)](http://travis-ci.org/celluloid/celluloid-redis)
4
5
  [![Dependency Status](https://gemnasium.com/celluloid/celluloid-redis.png)](https://gemnasium.com/celluloid/celluloid-redis)
5
6
  [![Code Climate](https://codeclimate.com/github/celluloid/celluloid-redis.png)](https://codeclimate.com/github/celluloid/celluloid-redis)
@@ -1,5 +1,5 @@
1
1
  module Celluloid
2
2
  module Redis
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -51,6 +51,7 @@ class Redis
51
51
 
52
52
  def read
53
53
  line = @sock.gets
54
+ raise Errno::ECONNRESET unless line
54
55
  reply_type = line.slice!(0, 1)
55
56
  format_reply(reply_type, line)
56
57
 
@@ -99,4 +100,4 @@ class Redis
99
100
  end
100
101
  end
101
102
 
102
- Redis::Connection.drivers << Redis::Connection::Celluloid
103
+ Redis::Connection.drivers << Redis::Connection::Celluloid
@@ -14,4 +14,11 @@ describe Redis::Connection::Celluloid do
14
14
  redis.set(example_key, example_value)
15
15
  redis.get(example_key).should eq example_value
16
16
  end
17
- end
17
+
18
+ it "cleanly shuts down an instance" do
19
+ with_new_instance do |instance|
20
+ redis = Redis.new(:port => instance.port, :driver => :celluloid)
21
+ expect { redis.shutdown }.not_to raise_error
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,35 @@
1
+ class RedisInstance
2
+ def initialize(opts = {})
3
+ @opts = {:port => 6400, :cmd => 'redis-server'}.merge(opts)
4
+ end
5
+
6
+ def host
7
+ @opts[:host]
8
+ end
9
+
10
+ def port
11
+ @opts[:port]
12
+ end
13
+
14
+ def stop
15
+ return unless @pid
16
+ begin
17
+ Process.kill('SIGTERM', @pid)
18
+ rescue Errno::ESRCH
19
+ end
20
+ end
21
+
22
+ def run
23
+ @pid = spawn(@opts[:cmd], "--port #{port}", "--daemonize yes")
24
+ wait_until_useable
25
+ end
26
+
27
+ private
28
+ def wait_until_useable
29
+ begin
30
+ TCPSocket.open('localhost', port)
31
+ rescue Errno::ECONNREFUSED
32
+ retry
33
+ end
34
+ end
35
+ end
@@ -1,4 +1,15 @@
1
1
  require "celluloid/redis"
2
2
  require "redis/connection/celluloid"
3
+ require "redis_instance"
3
4
  require "coveralls"
4
5
  Coveralls.wear!
6
+
7
+ def with_new_instance(opts = {})
8
+ begin
9
+ instance = RedisInstance.new(opts)
10
+ instance.run
11
+ yield instance
12
+ ensure
13
+ instance.stop
14
+ end
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celluloid-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-14 00:00:00.000000000 Z
12
+ date: 2013-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
@@ -129,6 +129,7 @@ files:
129
129
  - lib/celluloid/redis/version.rb
130
130
  - lib/redis/connection/celluloid.rb
131
131
  - spec/redis/connection/celluloid_spec.rb
132
+ - spec/redis_instance.rb
132
133
  - spec/spec_helper.rb
133
134
  - tasks/rspec.rake
134
135
  homepage: https://github.com/celluloid/celluloid-redis
@@ -146,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
147
  version: '0'
147
148
  segments:
148
149
  - 0
149
- hash: 1868622521016118762
150
+ hash: 2624804133874232203
150
151
  required_rubygems_version: !ruby/object:Gem::Requirement
151
152
  none: false
152
153
  requirements:
@@ -155,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
156
  version: '0'
156
157
  segments:
157
158
  - 0
158
- hash: 1868622521016118762
159
+ hash: 2624804133874232203
159
160
  requirements: []
160
161
  rubyforge_project:
161
162
  rubygems_version: 1.8.23
@@ -164,4 +165,5 @@ specification_version: 3
164
165
  summary: celluloid-redis provides a redis-rb connection class using Celluloid::IO
165
166
  test_files:
166
167
  - spec/redis/connection/celluloid_spec.rb
168
+ - spec/redis_instance.rb
167
169
  - spec/spec_helper.rb