redis-store 1.0.0.rc1 → 1.0.0.1

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.

@@ -0,0 +1,7 @@
1
+ bundler_args: "--without development"
2
+ script: "bundle exec rake"
3
+ rvm:
4
+ - 1.8.7
5
+ - 1.9.2
6
+ - jruby
7
+ - rbx
data/CHANGELOG CHANGED
@@ -1,3 +1,18 @@
1
+ *1.0.0.1 (September 6, 2011)*
2
+
3
+ * Bump version v1.0.0.1
4
+
5
+ *1.0.0 (September 1, 2011)*
6
+
7
+ * Bump version v1.0.0
8
+ * Avoid encoding issues when sending strings to Redis. [Damian Janowski]
9
+ * Fixed a bug that caused all the users to share the same session (with a session_id of 0 or 1) [Mathieu Ravaux]
10
+ * ActiveSupport cache stores reply to read_multi with a hash, not an array. [Matt Griffin]
11
+ * Rack::Session && Rack::Cache store can be created with options [aligo]
12
+ * add destroy_session [aligo]
13
+ * compatible with rails 3.1. rely on Rack::Session::Redis stores API. [aligo]
14
+ * Fixed Marshalling semantic
15
+
1
16
  *1.0.0 [rc1] (June 5, 2011)*
2
17
 
3
18
  * Bump version v1.0.0.rc1
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source :gemcutter
2
- gem "redis", "~> 2.2.0"
2
+ gem "redis", "~> 2.2.1"
3
3
 
4
4
  group :development do
5
5
  gem "jeweler"
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 - 2010 Luca Guidi
1
+ Copyright (c) 2009 - 2011 Luca Guidi
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -42,13 +42,13 @@ Made up of the following:
42
42
  password: secret
43
43
 
44
44
  If you want to specify the `namespace` option, you have to pass the `db` param too.
45
- #### __Important__: for now (rc1) `namespace` is only supported for single, non-distributed stores.
45
+ #### __Important__: `namespace` is only supported for single, non-distributed stores.
46
46
 
47
47
  ### Set by Hash
48
48
 
49
49
  { :host => 192.168.1.100, :port => 23682, :db => 13, :namespace => "theplaylist", :password => "secret" }
50
50
 
51
- #### __Important__: for now (rc1) `namespace` is only supported for single, non-distributed stores.
51
+ #### __Important__: `namespace` is only supported for single, non-distributed stores.
52
52
 
53
53
  ## Cache store
54
54
 
@@ -72,7 +72,7 @@ Provides a cache store for your Ruby web framework of choice.
72
72
 
73
73
  # Gemfile
74
74
  gem 'redis'
75
- gem 'redis-store', '1.0.0.rc1'
75
+ gem 'redis-store', '1.0.0.1'
76
76
 
77
77
  # config/environments/production.rb
78
78
  config.cache_store = :redis_store, { ... optional configuration ... }
@@ -81,7 +81,7 @@ For advanced configurations scenarios please visit [the wiki](https://github.com
81
81
 
82
82
  ### Merb
83
83
 
84
- dependency "redis-store", "1.0.0.rc1"
84
+ dependency "redis-store", "1.0.0.1"
85
85
  dependency("merb-cache", merb_gems_version) do
86
86
  Merb::Cache.setup do
87
87
  register(:redis, Merb::Cache::RedisStore, :servers => ["127.0.0.1:6379"])
@@ -162,7 +162,7 @@ Provides a Redis store for Rack::Session. See [http://rack.rubyforge.org/doc/Rac
162
162
  # Gemfile
163
163
  gem 'rails', '3.0.3'
164
164
  gem 'redis'
165
- gem 'redis-store', '1.0.0.rc1'
165
+ gem 'redis-store', '1.0.0.1'
166
166
 
167
167
  # config/initializers/session_store.rb
168
168
  MyApp::Application.config.session_store :redis_session_store
@@ -171,7 +171,7 @@ For advanced configurations scenarios please visit [the wiki](https://github.com
171
171
 
172
172
  ### Merb
173
173
 
174
- dependency "redis-store", "1.0.0.rc1"
174
+ dependency "redis-store", "1.0.0.1"
175
175
  Merb::Config.use do |c|
176
176
  c[:session_store] = "redis"
177
177
  end
@@ -236,4 +236,4 @@ If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" bun
236
236
 
237
237
  ## Copyright
238
238
 
239
- (c) 2009 - 2010 Luca Guidi - [http://lucaguidi.com](http://lucaguidi.com), released under the MIT license
239
+ (c) 2009 - 2011 Luca Guidi - [http://lucaguidi.com](http://lucaguidi.com), released under the MIT license
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.rc1
1
+ 1.0.0.1
@@ -43,7 +43,7 @@ module RedisStore
43
43
  [sid, session]
44
44
  end
45
45
 
46
- def set_session(env, sid, session_data)
46
+ def set_session(env, sid, session_data, opts=nil)
47
47
  options = env['rack.session.options']
48
48
  @pool.set(sid, session_data, options)
49
49
  return(::Redis::Store.rails3? ? sid : true)
@@ -54,6 +54,7 @@ module RedisStore
54
54
  def destroy(env)
55
55
  if sid = current_session_id(env)
56
56
  @pool.del(sid)
57
+ sid
57
58
  end
58
59
  rescue Errno::ECONNREFUSED
59
60
  false
@@ -62,8 +63,13 @@ module RedisStore
62
63
  end
63
64
  end
64
65
  end
65
-
66
- if ::Redis::Store.rails3?
66
+ if ::Redis::Store.rails31?
67
+ require 'action_dispatch/middleware/session/abstract_store'
68
+ class ActionDispatch::Session::RedisSessionStore < Rack::Session::Redis
69
+ include ActionDispatch::Session::Compatibility
70
+ include ActionDispatch::Session::StaleSessionCheck
71
+ end
72
+ elsif ::Redis::Store.rails3?
67
73
  class ActionDispatch::Session::RedisSessionStore < ActionDispatch::Session::AbstractStore
68
74
  include RedisStore::Rack::Session::Rails
69
75
  end
@@ -72,3 +78,4 @@ else
72
78
  include RedisStore::Rack::Session::Rails
73
79
  end
74
80
  end
81
+
@@ -170,7 +170,14 @@ module ActiveSupport
170
170
  # cache.read_multi "rabbit", "white-rabbit"
171
171
  # cache.read_multi "rabbit", "white-rabbit", :raw => true
172
172
  def read_multi(*names)
173
- @data.mget *names
173
+ values = @data.mget(*names)
174
+
175
+ # Remove the options hash before mapping keys to values
176
+ names.extract_options!
177
+
178
+ result = Hash[names.zip(values)]
179
+ result.reject!{ |k,v| v.nil? }
180
+ result
174
181
  end
175
182
 
176
183
  # Increment a key in the store.
@@ -14,7 +14,8 @@ module Rack
14
14
 
15
15
  class Redis < RedisBase
16
16
  def initialize(server, options = {})
17
- @cache = ::Redis::Factory.create server
17
+ options[:redis_server] ||= server
18
+ @cache = ::Redis::Factory.create options
18
19
  end
19
20
 
20
21
  def read(key)
@@ -7,7 +7,8 @@ module Rack
7
7
  def initialize(app, options = {})
8
8
  super
9
9
  @mutex = Mutex.new
10
- @pool = ::Redis::Factory.create options[:redis_server] || @default_options[:redis_server]
10
+ options[:redis_server] ||= @default_options[:redis_server]
11
+ @pool = ::Redis::Factory.create options
11
12
  end
12
13
 
13
14
  def generate_sid
@@ -58,6 +59,11 @@ module Rack
58
59
  @mutex.unlock if env['rack.multithread']
59
60
  end
60
61
 
62
+ def destroy_session(env, session_id, options)
63
+ options = { :renew => true }.update(options) unless options[:drop]
64
+ set_session(env, session_id, 0, options)
65
+ end
66
+
61
67
  private
62
68
  def merge_sessions(sid, old, new, cur=nil)
63
69
  cur ||= {}
@@ -79,3 +85,4 @@ module Rack
79
85
  end
80
86
  end
81
87
  end
88
+
@@ -12,6 +12,10 @@ class Redis
12
12
  defined?(::Rails) && ::Rails::VERSION::MAJOR == 3
13
13
  end
14
14
 
15
+ def self.rails31? #:nodoc:
16
+ defined?(::Rails) && ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 1
17
+ end
18
+
15
19
  def reconnect
16
20
  @client.reconnect
17
21
  end
@@ -32,3 +36,4 @@ class Redis
32
36
  end
33
37
  end
34
38
  end
39
+
@@ -2,11 +2,11 @@ class Redis
2
2
  class Store < self
3
3
  module Marshalling
4
4
  def set(key, value, options = nil)
5
- _marshal(value, options) { |value| super key, value, options }
5
+ _marshal(value, options) { |value| super encode(key), encode(value), options }
6
6
  end
7
7
 
8
8
  def setnx(key, value, options = nil)
9
- _marshal(value, options) { |value| super key, value, options }
9
+ _marshal(value, options) { |value| super encode(key), encode(value), options }
10
10
  end
11
11
 
12
12
  def get(key, options = nil)
@@ -22,7 +22,7 @@ class Redis
22
22
 
23
23
  private
24
24
  def _marshal(val, options)
25
- yield marshal?(options) ? val : Marshal.dump(val)
25
+ yield marshal?(options) ? Marshal.dump(val) : val
26
26
  end
27
27
 
28
28
  def _unmarshal(val, options)
@@ -30,11 +30,21 @@ class Redis
30
30
  end
31
31
 
32
32
  def marshal?(options)
33
- options && options[:raw]
33
+ !(options && options[:raw])
34
34
  end
35
35
 
36
36
  def unmarshal?(result, options)
37
- result && result.size > 0 && !marshal?(options)
37
+ result && result.size > 0 && marshal?(options)
38
+ end
39
+
40
+ if defined?(Encoding)
41
+ def encode(string)
42
+ string.to_s.force_encoding(Encoding::BINARY)
43
+ end
44
+ else
45
+ def encode(string)
46
+ string
47
+ end
38
48
  end
39
49
  end
40
50
  end
@@ -4,7 +4,7 @@ class Redis
4
4
  MAJOR = 1
5
5
  MINOR = 0
6
6
  TINY = 0
7
- BUILD = "rc1"
7
+ BUILD = 1
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
10
10
  end
@@ -5,20 +5,20 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{redis-store}
8
- s.version = "1.0.0.rc1"
8
+ s.version = "1.0.0.1"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Luca Guidi}]
12
- s.date = %q{2011-06-05}
12
+ s.date = %q{2011-09-06}
13
13
  s.description = %q{Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks.}
14
14
  s.email = %q{guidi.luca@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "README.md"
17
17
  ]
18
18
  s.files = [
19
+ ".travis.yml",
19
20
  "CHANGELOG",
20
21
  "Gemfile",
21
- "Gemfile.lock",
22
22
  "MIT-LICENSE",
23
23
  "README.md",
24
24
  "Rakefile",
@@ -66,32 +66,14 @@ Gem::Specification.new do |s|
66
66
  ]
67
67
  s.homepage = %q{http://github.com/jodosha/redis-store}
68
68
  s.require_paths = [%q{lib}]
69
- s.rubygems_version = %q{1.8.5}
69
+ s.rubygems_version = %q{1.8.6}
70
70
  s.summary = %q{Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks.}
71
- s.test_files = [
72
- "spec/action_controller/session/redis_session_store_spec.rb",
73
- "spec/active_support/cache/redis_store_spec.rb",
74
- "spec/cache/merb/redis_store_spec.rb",
75
- "spec/cache/sinatra/redis_store_spec.rb",
76
- "spec/i18n/backend/redis_spec.rb",
77
- "spec/rack/cache/entitystore/redis_spec.rb",
78
- "spec/rack/cache/metastore/redis_spec.rb",
79
- "spec/rack/session/redis_spec.rb",
80
- "spec/redis/distributed_store_spec.rb",
81
- "spec/redis/factory_spec.rb",
82
- "spec/redis/store/interface_spec.rb",
83
- "spec/redis/store/marshalling_spec.rb",
84
- "spec/redis/store/namespace_spec.rb",
85
- "spec/redis/store/version_spec.rb",
86
- "spec/redis/store_spec.rb",
87
- "spec/spec_helper.rb"
88
- ]
89
71
 
90
72
  if s.respond_to? :specification_version then
91
73
  s.specification_version = 3
92
74
 
93
75
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
94
- s.add_runtime_dependency(%q<redis>, ["~> 2.2.0"])
76
+ s.add_runtime_dependency(%q<redis>, ["~> 2.2.1"])
95
77
  s.add_development_dependency(%q<jeweler>, [">= 0"])
96
78
  s.add_development_dependency(%q<git>, [">= 0"])
97
79
  s.add_development_dependency(%q<rack-cache>, [">= 0"])
@@ -100,7 +82,7 @@ Gem::Specification.new do |s|
100
82
  s.add_development_dependency(%q<i18n>, [">= 0"])
101
83
  s.add_development_dependency(%q<ruby-debug>, [">= 0"])
102
84
  else
103
- s.add_dependency(%q<redis>, ["~> 2.2.0"])
85
+ s.add_dependency(%q<redis>, ["~> 2.2.1"])
104
86
  s.add_dependency(%q<jeweler>, [">= 0"])
105
87
  s.add_dependency(%q<git>, [">= 0"])
106
88
  s.add_dependency(%q<rack-cache>, [">= 0"])
@@ -110,7 +92,7 @@ Gem::Specification.new do |s|
110
92
  s.add_dependency(%q<ruby-debug>, [">= 0"])
111
93
  end
112
94
  else
113
- s.add_dependency(%q<redis>, ["~> 2.2.0"])
95
+ s.add_dependency(%q<redis>, ["~> 2.2.1"])
114
96
  s.add_dependency(%q<jeweler>, [">= 0"])
115
97
  s.add_dependency(%q<git>, [">= 0"])
116
98
  s.add_dependency(%q<rack-cache>, [">= 0"])
@@ -104,12 +104,12 @@ describe RAILS_SESSION_STORE_CLASS do
104
104
  end
105
105
 
106
106
  it "should read the data" do
107
- @client.should_receive(:call).with(:get, "#{@namespace}:#{@sid}")
107
+ @client.should_receive(:call).with([:get, "#{@namespace}:#{@sid}"])
108
108
  @store.send :get_session, @env, @sid
109
109
  end
110
110
 
111
111
  it "should write the data" do
112
- @client.should_receive(:call).with(:set, "#{@namespace}:#{@sid}", Marshal.dump(@white_rabbit))
112
+ @client.should_receive(:call).with([:set, "#{@namespace}:#{@sid}", Marshal.dump(@white_rabbit)])
113
113
  @store.send :set_session, @env, @sid, @white_rabbit
114
114
  end
115
115
  end
@@ -149,6 +149,22 @@ module ActiveSupport
149
149
  end
150
150
  end
151
151
 
152
+ it "should increment a raw key" do
153
+ with_store_management do |store|
154
+ store.write("raw-counter", 1, :raw => true).should be_true
155
+ store.increment("raw-counter", 2)
156
+ store.read("raw-counter", :raw => true).to_i.should == 3
157
+ end
158
+ end
159
+
160
+ it "should decrement a raw key" do
161
+ with_store_management do |store|
162
+ store.write("raw-counter", 3, :raw => true).should be_true
163
+ store.decrement("raw-counter", 2)
164
+ store.read("raw-counter", :raw => true).to_i.should == 1
165
+ end
166
+ end
167
+
152
168
  it "should increment a key by given value" do
153
169
  with_store_management do |store|
154
170
  store.increment "counter", 3
@@ -194,18 +210,24 @@ module ActiveSupport
194
210
  if ::Redis::Store.rails3?
195
211
  it "should read multiple keys" do
196
212
  @store.write "irish whisky", "Jameson"
197
- rabbit, whisky = @store.read_multi "rabbit", "irish whisky"
198
- rabbit.raw_value.should === @rabbit
199
- whisky.raw_value.should == "Jameson"
213
+ result = @store.read_multi "rabbit", "irish whisky"
214
+ result['rabbit'].raw_value.should === @rabbit
215
+ result['irish whisky'].raw_value.should == "Jameson"
200
216
  end
201
217
  else
202
218
  it "should read multiple keys" do
203
219
  @store.write "irish whisky", "Jameson"
204
- rabbit, whisky = @store.read_multi "rabbit", "irish whisky"
205
- rabbit.should === @rabbit
206
- whisky.should == "Jameson"
220
+ result = @store.read_multi "rabbit", "irish whisky"
221
+ result.should == { 'rabbit' => @rabbit, 'irish whisky' => 'Jameson' }
207
222
  end
208
223
  end
224
+
225
+ it 'should read multiple keys and return only matches' do
226
+ @store.delete 'irish whisky'
227
+ result = @store.read_multi "rabbit", "irish whisky"
228
+ result.should_not include('irish whisky')
229
+ result.should include('rabbit')
230
+ end
209
231
 
210
232
  describe "namespace" do
211
233
  before :each do
@@ -216,7 +238,7 @@ module ActiveSupport
216
238
  end
217
239
 
218
240
  it "should read the data" do
219
- @client.should_receive(:call).with(:get, "#{@namespace}:rabbit")
241
+ @client.should_receive(:call).with([:get, "#{@namespace}:rabbit"])
220
242
  @store.read("rabbit")
221
243
  end
222
244
 
@@ -228,19 +250,19 @@ module ActiveSupport
228
250
  # end
229
251
  else
230
252
  it "should write the data" do
231
- @client.should_receive(:call).with(:set, "#{@namespace}:rabbit", Marshal.dump(@white_rabbit))
253
+ @client.should_receive(:call).with([:set, "#{@namespace}:rabbit", Marshal.dump(@white_rabbit)])
232
254
  @store.write "rabbit", @white_rabbit
233
255
  end
234
256
  end
235
257
 
236
258
  it "should delete the data" do
237
- @client.should_receive(:call).with(:del, "#{@namespace}:rabbit")
259
+ @client.should_receive(:call).with([:del, "#{@namespace}:rabbit"])
238
260
  @store.delete "rabbit"
239
261
  end
240
262
 
241
263
  it "should delete matched data" do
242
- @client.should_receive(:call).with(:del, "#{@namespace}:rabbit")
243
- @client.should_receive(:call).with(:keys, "theplaylist:rabb*").and_return [ "#{@namespace}:rabbit" ]
264
+ @client.should_receive(:call).with([:del, "#{@namespace}:rabbit"])
265
+ @client.should_receive(:call).with([:keys, "theplaylist:rabb*"]).and_return [ "#{@namespace}:rabbit" ]
244
266
  @store.delete_matched "rabb*"
245
267
  end
246
268
 
@@ -251,29 +273,29 @@ module ActiveSupport
251
273
  end
252
274
  else
253
275
  it "should verify existence of an object in the store" do
254
- @client.should_receive(:call).with(:exists, "#{@namespace}:rabbit")
276
+ @client.should_receive(:call).with([:exists, "#{@namespace}:rabbit"])
255
277
  @store.exist?("rabbit")
256
278
  end
257
279
  end
258
280
 
259
281
  it "should increment a key" do
260
- @client.should_receive(:call).with(:incrby, "#{@namespace}:counter", 1)
282
+ @client.should_receive(:call).with([:incrby, "#{@namespace}:counter", 1])
261
283
  @store.increment "counter"
262
284
  end
263
285
 
264
286
  it "should decrement a key" do
265
- @client.should_receive(:call).with(:decrby, "#{@namespace}:counter", 1)
287
+ @client.should_receive(:call).with([:decrby, "#{@namespace}:counter", 1])
266
288
  @store.decrement "counter"
267
289
  end
268
290
 
269
291
  it "should fetch data" do
270
- @client.should_receive(:call).with(:get, "#{@namespace}:rabbit")
292
+ @client.should_receive(:call).with([:get, "#{@namespace}:rabbit"])
271
293
  @store.fetch "rabbit"
272
294
  end
273
295
 
274
296
  it "should read multiple keys" do
275
297
  rabbits = [ Marshal.dump(@rabbit), Marshal.dump(@white_rabbit) ]
276
- @client.should_receive(:call).with(:mget, "#{@namespace}:rabbit", "#{@namespace}:white_rabbit").and_return rabbits
298
+ @client.should_receive(:call).with([:mget, "#{@namespace}:rabbit", "#{@namespace}:white_rabbit"]).and_return rabbits
277
299
  @store.read_multi "rabbit", "white_rabbit"
278
300
  end
279
301
  end
@@ -79,5 +79,41 @@ describe "Redis::Marshalling" do
79
79
  rabbit2.should == "\004\bU:\017OpenStruct{\006:\ncolor\"\nwhite"
80
80
  end
81
81
  end
82
+
83
+ describe "binary safety" do
84
+ it "should marshal objects" do
85
+ utf8_key = [51339].pack("U*")
86
+ ascii_rabbit = OpenStruct.new(:name => [128].pack("C*"))
87
+
88
+ @store.set(utf8_key, ascii_rabbit)
89
+ @store.get(utf8_key).should === ascii_rabbit
90
+ end
91
+
92
+ it "should get and set raw values" do
93
+ utf8_key = [51339].pack("U*")
94
+ ascii_string = [128].pack("C*")
95
+
96
+ @store.set(utf8_key, ascii_string, :raw => true)
97
+ @store.get(utf8_key, :raw => true).bytes.to_a === ascii_string.bytes.to_a
98
+ end
99
+
100
+ it "should marshal objects on setnx" do
101
+ utf8_key = [51339].pack("U*")
102
+ ascii_rabbit = OpenStruct.new(:name => [128].pack("C*"))
103
+
104
+ @store.del(utf8_key)
105
+ @store.setnx(utf8_key, ascii_rabbit)
106
+ @store.get(utf8_key).should === ascii_rabbit
107
+ end
108
+
109
+ it "should get and set raw values on setnx" do
110
+ utf8_key = [51339].pack("U*")
111
+ ascii_string = [128].pack("C*")
112
+
113
+ @store.del(utf8_key)
114
+ @store.setnx(utf8_key, ascii_string, :raw => true)
115
+ @store.get(utf8_key, :raw => true).bytes.to_a === ascii_string.bytes.to_a
116
+ end
117
+ end if defined?(Encoding)
82
118
  end
83
119
 
@@ -16,7 +16,7 @@ describe "Redis::Store::Namespace" do
16
16
  it "should only decorate instances that needs to be namespaced" do
17
17
  @store = Redis::Store.new
18
18
  client = @store.instance_variable_get(:@client)
19
- client.should_receive(:call).with(:get, "rabbit")
19
+ client.should_receive(:call).with([:get, "rabbit"])
20
20
  @store.get("rabbit")
21
21
  end
22
22
 
@@ -25,27 +25,27 @@ describe "Redis::Store::Namespace" do
25
25
  end
26
26
 
27
27
  it "should namespace get" do
28
- @client.should_receive(:call).with(:get, "#{@namespace}:rabbit")
28
+ @client.should_receive(:call).with([:get, "#{@namespace}:rabbit"])
29
29
  @store.get("rabbit")
30
30
  end
31
31
 
32
32
  it "should namespace set" do
33
- @client.should_receive(:call).with(:set, "#{@namespace}:rabbit", @rabbit)
33
+ @client.should_receive(:call).with([:set, "#{@namespace}:rabbit", @rabbit])
34
34
  @store.set "rabbit", @rabbit
35
35
  end
36
36
 
37
37
  it "should namespace setnx" do
38
- @client.should_receive(:call).with(:setnx, "#{@namespace}:rabbit", @rabbit)
38
+ @client.should_receive(:call).with([:setnx, "#{@namespace}:rabbit", @rabbit])
39
39
  @store.setnx "rabbit", @rabbit
40
40
  end
41
41
 
42
42
  it "should namespace del with single key" do
43
- @client.should_receive(:call).with(:del, "#{@namespace}:rabbit")
43
+ @client.should_receive(:call).with([:del, "#{@namespace}:rabbit"])
44
44
  @store.del "rabbit"
45
45
  end
46
46
 
47
47
  it "should namespace del with multiple keys" do
48
- @client.should_receive(:call).with(:del, "#{@namespace}:rabbit", "#{@namespace}:white_rabbit")
48
+ @client.should_receive(:call).with([:del, "#{@namespace}:rabbit", "#{@namespace}:white_rabbit"])
49
49
  @store.del "rabbit", "white_rabbit"
50
50
  end
51
51
 
@@ -55,22 +55,22 @@ describe "Redis::Store::Namespace" do
55
55
  end
56
56
 
57
57
  it "should namespace exists" do
58
- @client.should_receive(:call).with(:exists, "#{@namespace}:rabbit")
58
+ @client.should_receive(:call).with([:exists, "#{@namespace}:rabbit"])
59
59
  @store.exists "rabbit"
60
60
  end
61
61
 
62
62
  it "should namespace incrby" do
63
- @client.should_receive(:call).with(:incrby, "#{@namespace}:counter", 1)
63
+ @client.should_receive(:call).with([:incrby, "#{@namespace}:counter", 1])
64
64
  @store.incrby "counter", 1
65
65
  end
66
66
 
67
67
  it "should namespace decrby" do
68
- @client.should_receive(:call).with(:decrby, "#{@namespace}:counter", 1)
68
+ @client.should_receive(:call).with([:decrby, "#{@namespace}:counter", 1])
69
69
  @store.decrby "counter", 1
70
70
  end
71
71
 
72
72
  it "should namespace mget" do
73
- @client.should_receive(:call).with(:mget, "#{@namespace}:rabbit", "#{@namespace}:white_rabbit")
73
+ @client.should_receive(:call).with([:mget, "#{@namespace}:rabbit", "#{@namespace}:white_rabbit"])
74
74
  @store.mget "rabbit", "white_rabbit"
75
75
  end
76
76
  end
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe Redis::Store::VERSION do
4
4
  it "should describe Redis::Store version" do
5
- Redis::Store::VERSION::STRING.should == "1.0.0.rc1"
5
+ Redis::Store::VERSION::STRING.should == "1.0.0.1"
6
6
  end
7
7
  end
@@ -103,7 +103,7 @@ namespace :redis do
103
103
  end
104
104
 
105
105
  desc 'Start redis'
106
- task :start do
106
+ task :start => 'dtach:check' do
107
107
  RedisRunner.start
108
108
  end
109
109
 
@@ -153,8 +153,8 @@ namespace :redis do
153
153
  sh "mv redis vendor"
154
154
 
155
155
  commit = case ENV['VERSION']
156
- when "1.2.6" then "570e43c8285a4e5e3f31"
157
- when "2.2.4" then "2b886275e9756bb8619a"
156
+ when "1.3.12" then "26ef09a83526e5099bce"
157
+ when "2.2.8" then "ec279203df0bc6ddc981"
158
158
  end
159
159
 
160
160
  arguments = commit.nil? ? "pull origin master" : "reset --hard #{commit}"
@@ -170,7 +170,7 @@ namespace :redis do
170
170
 
171
171
  namespace :replication do
172
172
  desc "Starts redis replication servers"
173
- task :start do
173
+ task :start => 'dtach:check' do
174
174
  result = RedisReplicationRunner.start_detached
175
175
  raise("Could not start redis-server, aborting.") unless result
176
176
  end
@@ -186,7 +186,7 @@ namespace :redis do
186
186
  system "bundle exec irb -I lib -I extra -r redis-store.rb"
187
187
  RedisReplicationRunner.stop
188
188
  end
189
- end
189
+ end
190
190
  end
191
191
 
192
192
  namespace :dtach do
@@ -195,6 +195,13 @@ namespace :dtach do
195
195
  puts "\nSee http://dtach.sourceforge.net/ for information about dtach.\n\n"
196
196
  end
197
197
 
198
+ desc 'Check that dtach is available'
199
+ task :check do
200
+ if !ENV['TRAVIS'] && !system('which dtach')
201
+ raise "dtach is not installed. Install it manually or run 'rake dtach:install'"
202
+ end
203
+ end
204
+
198
205
  desc 'Install dtach 0.8 from source'
199
206
  task :install => [:about] do
200
207
 
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-store
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424055
5
- prerelease: 6
4
+ hash: 93
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - rc
11
10
  - 1
12
- version: 1.0.0.rc1
11
+ version: 1.0.0.1
13
12
  platform: ruby
14
13
  authors:
15
14
  - Luca Guidi
@@ -17,7 +16,7 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2011-06-05 00:00:00 Z
19
+ date: 2011-09-06 00:00:00 Z
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
23
22
  name: redis
@@ -27,12 +26,12 @@ dependencies:
27
26
  requirements:
28
27
  - - ~>
29
28
  - !ruby/object:Gem::Version
30
- hash: 7
29
+ hash: 5
31
30
  segments:
32
31
  - 2
33
32
  - 2
34
- - 0
35
- version: 2.2.0
33
+ - 1
34
+ version: 2.2.1
36
35
  type: :runtime
37
36
  version_requirements: *id001
38
37
  - !ruby/object:Gem::Dependency
@@ -146,9 +145,9 @@ extensions: []
146
145
  extra_rdoc_files:
147
146
  - README.md
148
147
  files:
148
+ - .travis.yml
149
149
  - CHANGELOG
150
150
  - Gemfile
151
- - Gemfile.lock
152
151
  - MIT-LICENSE
153
152
  - README.md
154
153
  - Rakefile
@@ -213,35 +212,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
213
212
  required_rubygems_version: !ruby/object:Gem::Requirement
214
213
  none: false
215
214
  requirements:
216
- - - ">"
215
+ - - ">="
217
216
  - !ruby/object:Gem::Version
218
- hash: 25
217
+ hash: 3
219
218
  segments:
220
- - 1
221
- - 3
222
- - 1
223
- version: 1.3.1
219
+ - 0
220
+ version: "0"
224
221
  requirements: []
225
222
 
226
223
  rubyforge_project:
227
- rubygems_version: 1.8.5
224
+ rubygems_version: 1.8.6
228
225
  signing_key:
229
226
  specification_version: 3
230
227
  summary: Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks.
231
- test_files:
232
- - spec/action_controller/session/redis_session_store_spec.rb
233
- - spec/active_support/cache/redis_store_spec.rb
234
- - spec/cache/merb/redis_store_spec.rb
235
- - spec/cache/sinatra/redis_store_spec.rb
236
- - spec/i18n/backend/redis_spec.rb
237
- - spec/rack/cache/entitystore/redis_spec.rb
238
- - spec/rack/cache/metastore/redis_spec.rb
239
- - spec/rack/session/redis_spec.rb
240
- - spec/redis/distributed_store_spec.rb
241
- - spec/redis/factory_spec.rb
242
- - spec/redis/store/interface_spec.rb
243
- - spec/redis/store/marshalling_spec.rb
244
- - spec/redis/store/namespace_spec.rb
245
- - spec/redis/store/version_spec.rb
246
- - spec/redis/store_spec.rb
247
- - spec/spec_helper.rb
228
+ test_files: []
229
+
@@ -1,180 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- ParseTree (3.0.6)
5
- RubyInline (>= 3.7.0)
6
- sexp_processor (>= 3.0.0)
7
- RubyInline (3.8.6)
8
- ZenTest (~> 4.3)
9
- ZenTest (4.4.2)
10
- abstract (1.0.0)
11
- actionpack (2.3.11)
12
- activesupport (= 2.3.11)
13
- rack (~> 1.1.0)
14
- activesupport (2.3.11)
15
- addressable (2.2.2)
16
- bcrypt-ruby (2.1.2)
17
- columnize (0.3.2)
18
- data_objects (0.10.2)
19
- addressable (~> 2.1)
20
- diff-lcs (1.1.2)
21
- dm-aggregates (0.10.2)
22
- dm-core (~> 0.10.2)
23
- dm-constraints (0.10.2)
24
- dm-core (~> 0.10.2)
25
- dm-core (0.10.2)
26
- addressable (~> 2.1)
27
- extlib (~> 0.9.14)
28
- dm-migrations (0.10.2)
29
- dm-core (~> 0.10.2)
30
- dm-serializer (0.10.2)
31
- dm-core (~> 0.10.2)
32
- fastercsv (~> 1.5.0)
33
- json_pure (~> 1.2.0)
34
- dm-sweatshop (0.10.2)
35
- dm-core (~> 0.10.2)
36
- randexp (~> 0.1.4)
37
- dm-timestamps (0.10.2)
38
- dm-core (~> 0.10.2)
39
- dm-types (0.10.2)
40
- bcrypt-ruby (~> 2.1.2)
41
- dm-core (~> 0.10.2)
42
- fastercsv (~> 1.5.0)
43
- json_pure (~> 1.2.0)
44
- stringex (~> 1.1.0)
45
- uuidtools (~> 2.1.1)
46
- dm-validations (0.10.2)
47
- dm-core (~> 0.10.2)
48
- do_sqlite3 (0.10.2)
49
- data_objects (= 0.10.2)
50
- erubis (2.6.6)
51
- abstract (>= 1.0.0)
52
- extlib (0.9.15)
53
- fastercsv (1.5.3)
54
- git (1.2.5)
55
- haml (3.0.24)
56
- highline (1.6.1)
57
- i18n (0.5.0)
58
- jeweler (1.5.1)
59
- bundler (~> 1.0.0)
60
- git (>= 1.2.5)
61
- rake
62
- json_pure (1.2.4)
63
- linecache (0.43)
64
- mailfactory (1.4.0)
65
- mime-types (>= 1.13.1)
66
- merb (1.1.0)
67
- dm-aggregates (~> 0.10)
68
- dm-constraints (~> 0.10)
69
- dm-serializer (~> 0.10)
70
- dm-sweatshop (~> 0.10)
71
- dm-timestamps (~> 0.10)
72
- dm-types (~> 0.10)
73
- dm-validations (~> 0.10)
74
- do_sqlite3 (~> 0.10)
75
- merb-action-args (= 1.1.0)
76
- merb-assets (= 1.1.0)
77
- merb-auth (= 1.1.0)
78
- merb-cache (= 1.1.0)
79
- merb-core (= 1.1.0)
80
- merb-exceptions (= 1.1.0)
81
- merb-gen (= 1.1.0)
82
- merb-haml (= 1.1.0)
83
- merb-helpers (= 1.1.0)
84
- merb-mailer (= 1.1.0)
85
- merb-param-protection (= 1.1.0)
86
- merb-slices (= 1.1.0)
87
- merb_datamapper (= 1.1.0)
88
- merb-action-args (1.1.0)
89
- ParseTree (>= 2.1.1)
90
- merb-core (~> 1.1.0)
91
- ruby2ruby (>= 1.1.9)
92
- merb-assets (1.1.0)
93
- merb-core (~> 1.1.0)
94
- merb-auth (1.1.0)
95
- merb-auth-core (~> 1.1.0)
96
- merb-auth-more (~> 1.1.0)
97
- merb-auth-slice-password (~> 1.1.0)
98
- merb-core (~> 1.1.0)
99
- merb-auth-core (1.1.1)
100
- merb-core (~> 1.1)
101
- merb-auth-more (1.1.1)
102
- merb-auth-core (~> 1.1.1)
103
- merb-auth-slice-password (1.1.1)
104
- merb-auth-core (~> 1.1.1)
105
- merb-auth-more (~> 1.1.1)
106
- merb-slices (~> 1.1)
107
- merb-cache (1.1.0)
108
- merb-core (~> 1.1.0)
109
- merb-core (1.1.0)
110
- bundler (>= 0.9.3)
111
- erubis (>= 2.6.2)
112
- extlib (>= 0.9.13)
113
- mime-types (>= 1.16)
114
- rack
115
- rake
116
- rspec
117
- merb-exceptions (1.1.0)
118
- merb-core (~> 1.1.0)
119
- merb-mailer (~> 1.1.0)
120
- merb-gen (1.1.0)
121
- merb-core (~> 1.1.0)
122
- templater (>= 1.0.0)
123
- merb-haml (1.1.0)
124
- haml (>= 2.0.3)
125
- merb-core (~> 1.1.0)
126
- merb-helpers (1.1.0)
127
- merb-core (~> 1.1.0)
128
- merb-mailer (1.1.0)
129
- mailfactory (>= 1.2.3)
130
- merb-core (~> 1.1.0)
131
- merb-param-protection (1.1.0)
132
- merb-core (~> 1.1.0)
133
- merb-slices (1.1.0)
134
- merb-core (~> 1.1.0)
135
- merb_datamapper (1.1.0)
136
- dm-core (~> 0.10)
137
- dm-migrations (~> 0.10)
138
- merb-core (~> 1.1.0)
139
- mime-types (1.16)
140
- rack (1.1.0)
141
- rack-cache (0.5.3)
142
- rack (>= 0.4)
143
- rake (0.8.7)
144
- randexp (0.1.5)
145
- ParseTree
146
- redis (2.2.0)
147
- rspec (1.3.0)
148
- ruby-debug (0.10.4)
149
- columnize (>= 0.1)
150
- ruby-debug-base (~> 0.10.4.0)
151
- ruby-debug-base (0.10.4)
152
- linecache (>= 0.3)
153
- ruby2ruby (1.2.5)
154
- ruby_parser (~> 2.0)
155
- sexp_processor (~> 3.0)
156
- ruby_parser (2.0.5)
157
- sexp_processor (~> 3.0)
158
- sexp_processor (3.0.5)
159
- stringex (1.1.0)
160
- templater (1.0.0)
161
- diff-lcs (>= 1.1.2)
162
- extlib (>= 0.9.5)
163
- highline (>= 1.4.0)
164
- uuidtools (2.1.1)
165
-
166
- PLATFORMS
167
- ruby
168
-
169
- DEPENDENCIES
170
- actionpack (= 2.3.11)
171
- activesupport (= 2.3.11)
172
- git
173
- i18n
174
- jeweler
175
- merb (= 1.1.0)
176
- rack (~> 1.1.0)
177
- rack-cache
178
- redis (~> 2.2.0)
179
- rspec (= 1.3.0)
180
- ruby-debug