redis-rack 2.0.6 → 2.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68b8d92fa59d3d7167cf87bd16e1e62ca34ba905a901964a6d386b47155f8da0
4
- data.tar.gz: 3c8b27ef07b66c2050d053287c03eb3aee64860fda3e4ff806200d9cc663f7ec
3
+ metadata.gz: f58690fddef5788f2c9b9297969f1ad812278554aca17f40842b163a6362f1bc
4
+ data.tar.gz: e89fb1293e5cc06955ab50138d27e7766d7a07691916ae351347ef29b43751d3
5
5
  SHA512:
6
- metadata.gz: 351e468a771f67ed2e05c3620735636f23f7ad40e338d420c3662a2f7bfc1abdf82e3cf30c1e9a8268452ed1451e87740cc7fabb110b5c60251717a84b2c70f4
7
- data.tar.gz: b93772d79076558bf42e60effd452a47699e215538e73435ec70f500ee8e2902b65b7c1f2eb40d4019884c12fbf81ab57b940702657b4295581abe820483631d
6
+ metadata.gz: 5263c92df2caeadca08bcc303a8454965f1aca30d48f958bfb0773f5af52f866b51d1cf6ce5d7850737036fe486e8dd20d2aeb45e550a088db600295515cd5d3
7
+ data.tar.gz: 0312052d9285c9cef39ab3857d13c42df7023d494fb4392112bc1fce475fd905f51beaf253f337abab07d6d013dce7f32af5c5a1c4cd749fb744e9928ce7d36b
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.2
data/.travis.yml CHANGED
@@ -1,17 +1,14 @@
1
1
  language: ruby
2
2
  script: bundle exec rake
3
3
  rvm:
4
- - 2.2.3
5
- - 2.3.1
6
- - ruby-head
7
- - jruby-head
4
+ - 2.2.3
5
+ - 2.3.1
6
+ - ruby-head
7
+ - jruby-head
8
8
  matrix:
9
9
  allow_failures:
10
10
  - rvm: jruby-head
11
11
  - rvm: ruby-head
12
- gemfile:
13
- - gemfiles/rack_2.gemfile
14
- - gemfiles/rack_1.gemfile
15
12
  deploy:
16
13
  provider: rubygems
17
14
  api_key:
@@ -5,10 +5,10 @@ require 'redis/rack/connection'
5
5
 
6
6
  module Rack
7
7
  module Session
8
- class Redis < Abstract::ID
8
+ class Redis < Abstract::Persisted
9
9
  attr_reader :mutex
10
10
 
11
- DEFAULT_OPTIONS = Abstract::ID::DEFAULT_OPTIONS.merge(
11
+ DEFAULT_OPTIONS = Abstract::Persisted::DEFAULT_OPTIONS.merge(
12
12
  :redis_server => 'redis://127.0.0.1:6379/0/rack:session'
13
13
  )
14
14
 
@@ -30,11 +30,11 @@ module Rack
30
30
  end
31
31
  end
32
32
 
33
- def get_session(env, sid)
34
- if env['rack.session.options'][:skip]
33
+ def find_session(req, sid)
34
+ if req.session.options[:skip]
35
35
  [generate_sid, {}]
36
36
  else
37
- with_lock(env, [nil, {}]) do
37
+ with_lock(req, [nil, {}]) do
38
38
  unless sid and session = with { |c| c.get(sid) }
39
39
  session = {}
40
40
  sid = generate_unique_sid(session)
@@ -44,15 +44,15 @@ module Rack
44
44
  end
45
45
  end
46
46
 
47
- def set_session(env, session_id, new_session, options)
48
- with_lock(env, false) do
47
+ def write_session(req, session_id, new_session, options)
48
+ with_lock(req, false) do
49
49
  with { |c| c.set session_id, new_session, options }
50
50
  session_id
51
51
  end
52
52
  end
53
53
 
54
- def destroy_session(env, session_id, options)
55
- with_lock(env) do
54
+ def delete_session(req, session_id, options)
55
+ with_lock(req) do
56
56
  with { |c| c.del(session_id) }
57
57
  generate_sid unless options[:drop]
58
58
  end
@@ -62,8 +62,8 @@ module Rack
62
62
  @default_options.fetch(:threadsafe, true)
63
63
  end
64
64
 
65
- def with_lock(env, default=nil)
66
- @mutex.lock if env['rack.multithread'] && threadsafe?
65
+ def with_lock(req, default=nil)
66
+ @mutex.lock if req.multithread? && threadsafe?
67
67
  yield
68
68
  rescue Errno::ECONNREFUSED
69
69
  if $VERBOSE
@@ -1,6 +1,6 @@
1
1
  class Redis
2
2
  module Rack
3
- VERSION = '2.0.6'
3
+ VERSION = '2.1.0.pre'
4
4
  end
5
5
  end
6
6
 
data/redis-rack.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency 'rack', '>= 1.5', '< 3'
24
24
 
25
25
  s.add_development_dependency 'rake', '~> 10'
26
- s.add_development_dependency 'bundler', '~> 1.3'
26
+ s.add_development_dependency 'bundler', '> 1', '< 3'
27
27
  s.add_development_dependency 'mocha', '~> 0.14.0'
28
28
  s.add_development_dependency 'minitest', '~> 5'
29
29
  s.add_development_dependency 'redis-store-testing'
@@ -102,7 +102,9 @@ describe Rack::Session::Redis do
102
102
  sesion_store = Rack::Session::Redis.new(incrementor)
103
103
  sesion_store.instance_variable_set(:@mutex, mutex)
104
104
  was_yielded = false
105
- sesion_store.with_lock({'rack.multithread' => true}) { was_yielded = true}
105
+ request = Minitest::Mock.new
106
+ request.expect(:multithread?, true)
107
+ sesion_store.with_lock(request) { was_yielded = true}
106
108
  was_yielded.must_equal(true)
107
109
  end
108
110
 
@@ -118,7 +120,9 @@ describe Rack::Session::Redis do
118
120
  sesion_store = Rack::Session::Redis.new(incrementor, :threadsafe => false)
119
121
  sesion_store.instance_variable_set(:@mutex, mutex)
120
122
  was_yielded = false
121
- sesion_store.with_lock({'rack.multithread' => true}) { was_yielded = true}
123
+ request = Minitest::Mock.new
124
+ request.expect(:multithread?, true)
125
+ sesion_store.with_lock(request) { was_yielded = true}
122
126
  was_yielded.must_equal(true)
123
127
  end
124
128
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.1.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
@@ -68,16 +68,22 @@ dependencies:
68
68
  name: bundler
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - "~>"
71
+ - - ">"
72
+ - !ruby/object:Gem::Version
73
+ version: '1'
74
+ - - "<"
72
75
  - !ruby/object:Gem::Version
73
- version: '1.3'
76
+ version: '3'
74
77
  type: :development
75
78
  prerelease: false
76
79
  version_requirements: !ruby/object:Gem::Requirement
77
80
  requirements:
78
- - - "~>"
81
+ - - ">"
79
82
  - !ruby/object:Gem::Version
80
- version: '1.3'
83
+ version: '1'
84
+ - - "<"
85
+ - !ruby/object:Gem::Version
86
+ version: '3'
81
87
  - !ruby/object:Gem::Dependency
82
88
  name: mocha
83
89
  requirement: !ruby/object:Gem::Requirement
@@ -157,8 +163,8 @@ extra_rdoc_files: []
157
163
  files:
158
164
  - ".github/auto-assign-issues.yml"
159
165
  - ".gitignore"
166
+ - ".ruby-version"
160
167
  - ".travis.yml"
161
- - Appraisals
162
168
  - CODEOWNERS
163
169
  - Gemfile
164
170
  - MIT-LICENSE
@@ -166,8 +172,6 @@ files:
166
172
  - Rakefile
167
173
  - bin/appraisal
168
174
  - bin/rake
169
- - gemfiles/rack_1.gemfile
170
- - gemfiles/rack_2.gemfile
171
175
  - lib/rack/session/redis.rb
172
176
  - lib/redis-rack.rb
173
177
  - lib/redis/rack/connection.rb
@@ -191,9 +195,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
191
195
  version: '0'
192
196
  required_rubygems_version: !ruby/object:Gem::Requirement
193
197
  requirements:
194
- - - ">="
198
+ - - ">"
195
199
  - !ruby/object:Gem::Version
196
- version: '0'
200
+ version: 1.3.1
197
201
  requirements: []
198
202
  rubygems_version: 3.0.3
199
203
  signing_key:
data/Appraisals DELETED
@@ -1,7 +0,0 @@
1
- appraise 'rack-2' do
2
- gem 'rack', '~> 2'
3
- end
4
-
5
- appraise 'rack-1' do
6
- gem 'rack', '~> 1'
7
- end
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rack", "~> 1"
6
-
7
- gemspec :path => "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rack", "~> 2"
6
-
7
- gemspec :path => "../"