redis-session-store 0.9.2 → 0.10.0

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
- SHA1:
3
- metadata.gz: 07ac9df763ffa56b77ca40c2327e6bd75437a738
4
- data.tar.gz: 97e2c5169020108df208b3c96c182e705c0ef45c
2
+ SHA256:
3
+ metadata.gz: 197d2120a9c333b43c5c563a89ed0fcc96a6444918d0aa49207e3d74cc1c0fe3
4
+ data.tar.gz: 6946c195bdb70317a7e2e06c84643401a4e8b520dde2191c48c97e7399a39e7e
5
5
  SHA512:
6
- metadata.gz: e368674d0c51f31097c96eeff10a17467d10c8ac613269c731ee4d13197cc031a58bcdbe20081a67596c10b2d36bfb6890a024968f346b4e452640ff0739fd7d
7
- data.tar.gz: 00ac5034ea3e1945362a616d7ad1a28e54c25dcc79ad5a45af0cb3f2fe9fdb5689f9b6c6b22ed056deedf191b3ef5dc09a1fd9e92cdb396806e4392e0551f7ec
6
+ metadata.gz: c830641d881e1ebcc7d472f98ca55e9ded617a869e7a5de87a7bd96c09cf23d5ef9244d8978aa7fe8747ba9179bc5e575a9914d2aafb2248b988d79b4e18a9c2
7
+ data.tar.gz: 086ff62e30cdb9b08b9845f5f9581ad20a05e38aadb868b1dc4ee08d07402ac6571936142c9f775e8c4ed38bdaa6825b9cda5ee7155444fe903e5af907fe70b8
@@ -16,6 +16,9 @@ Metrics/BlockLength:
16
16
  Exclude:
17
17
  - 'spec/**/*.rb'
18
18
 
19
+ Metrics/LineLength:
20
+ Max: 100
21
+
19
22
  Security/MarshalLoad:
20
23
  Enabled: false
21
24
 
@@ -9,4 +9,4 @@
9
9
  # Offense count: 1
10
10
  # Configuration parameters: CountComments.
11
11
  Metrics/ClassLength:
12
- Max: 108
12
+ Max: 110
@@ -3,10 +3,10 @@ sudo: false
3
3
  cache: bundler
4
4
  rvm:
5
5
  - 2.3.1
6
- - jruby-9.1.13.0
6
+ - jruby-9.1.15.0
7
7
  matrix:
8
8
  allow_failures:
9
- - rvm: jruby-9.1.13.0
9
+ - rvm: jruby-9.1.15.0
10
10
  notifications:
11
11
  email: false
12
12
  deploy:
data/AUTHORS.md CHANGED
@@ -17,3 +17,6 @@ Redis Session Store authors
17
17
  - Todd Bealmear
18
18
  - Aleksey Dashkevych
19
19
  - Olle Jonsson
20
+ - Nicolas Rodriguez
21
+ - Sergey Nebolsin
22
+ - Anton Kolodii
@@ -4,6 +4,16 @@
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.10.0] - 2018-04-14
8
+ ### Changed
9
+ - JRuby to jruby-9.1.15.0
10
+ - Redis to '>= 3', '< 5'
11
+ - Actionpack to '>= 3', '< 6'
12
+ - Rake to 12
13
+
14
+ ### Added
15
+ - with_indifferent_access if defined ActiveSupport
16
+
7
17
  ## [0.9.2] - 2017-10-31
8
18
  ### Changed
9
19
  - Actionpack to 5.1
data/README.md CHANGED
@@ -99,6 +99,10 @@ My::Application.config.session_store :redis_session_store, {
99
99
 
100
100
  **Note** The session will *always* be destroyed when it cannot be loaded.
101
101
 
102
+ ### Other notes
103
+
104
+ It returns with_indifferent_access if ActiveSupport is defined
105
+
102
106
  ## Rails 2 Compatibility
103
107
 
104
108
  This gem is currently only compatible with Rails 3+. If you need
@@ -3,7 +3,7 @@ require 'redis'
3
3
  # Redis session storage for Rails, and for Rails only. Derived from
4
4
  # the MemCacheStore code, simply dropping in Redis instead.
5
5
  class RedisSessionStore < ActionDispatch::Session::AbstractStore
6
- VERSION = '0.9.2'.freeze
6
+ VERSION = '0.10.0'.freeze
7
7
  # Rails 3.1 and beyond defines the constant elsewhere
8
8
  unless defined?(ENV_SESSION_OPTIONS_KEY)
9
9
  ENV_SESSION_OPTIONS_KEY = if Rack.release.split('.').first.to_i > 1
@@ -13,6 +13,7 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
13
13
  end
14
14
  end
15
15
 
16
+ USE_INDIFFERENT_ACCESS = defined?(ActiveSupport).freeze
16
17
  # ==== Options
17
18
  # * +:key+ - Same as with the other cookie stores, key name
18
19
  # * +:redis+ - A hash with redis-specific options
@@ -86,16 +87,15 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
86
87
  "#{default_options[:key_prefix]}#{sid}"
87
88
  end
88
89
 
89
- def get_session(env, sid)
90
- unless sid && (session = load_session_from_redis(sid))
91
- sid = generate_sid
92
- session = {}
93
- end
90
+ def session_default_values
91
+ [generate_sid, USE_INDIFFERENT_ACCESS ? {}.with_indifferent_access : {}]
92
+ end
94
93
 
95
- [sid, session]
94
+ def get_session(env, sid)
95
+ sid && (session = load_session_from_redis(sid)) ? [sid, session] : session_default_values
96
96
  rescue Errno::ECONNREFUSED, Redis::CannotConnectError => e
97
97
  on_redis_down.call(e, env, sid) if on_redis_down
98
- [generate_sid, {}]
98
+ session_default_values
99
99
  end
100
100
  alias find_session get_session
101
101
 
@@ -111,7 +111,8 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
111
111
  end
112
112
 
113
113
  def decode(data)
114
- serializer.load(data)
114
+ session = serializer.load(data)
115
+ USE_INDIFFERENT_ACCESS ? session.with_indifferent_access : session
115
116
  end
116
117
 
117
118
  def set_session(env, sid, session_data, options = nil)
@@ -121,10 +122,10 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
121
122
  else
122
123
  redis.set(prefixed(sid), encode(session_data))
123
124
  end
124
- return sid
125
+ sid
125
126
  rescue Errno::ECONNREFUSED, Redis::CannotConnectError => e
126
127
  on_redis_down.call(e, env, sid) if on_redis_down
127
- return false
128
+ false
128
129
  end
129
130
  alias write_session set_session
130
131
 
@@ -16,11 +16,11 @@ Gem::Specification.new do |gem|
16
16
  gem.version = File.read('lib/redis-session-store.rb')
17
17
  .match(/^ VERSION = '(.*)'/)[1]
18
18
 
19
- gem.add_runtime_dependency 'actionpack', '>= 3', '< 5.2'
20
- gem.add_runtime_dependency 'redis', '~> 3'
19
+ gem.add_runtime_dependency 'actionpack', '>= 3', '< 6'
20
+ gem.add_runtime_dependency 'redis', '>= 3', '< 5'
21
21
 
22
22
  gem.add_development_dependency 'fakeredis', '~> 0.5'
23
- gem.add_development_dependency 'rake', '~> 11'
23
+ gem.add_development_dependency 'rake', '~> 12'
24
24
  gem.add_development_dependency 'rspec', '~> 3'
25
25
  gem.add_development_dependency 'rubocop', '~> 0.41'
26
26
  gem.add_development_dependency 'simplecov', '~> 0.11'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-session-store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Meyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-31 00:00:00.000000000 Z
11
+ date: 2018-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '3'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.2'
22
+ version: '6'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,21 +29,27 @@ dependencies:
29
29
  version: '3'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.2'
32
+ version: '6'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: redis
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '3'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '5'
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
- - - "~>"
47
+ - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: '3'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '5'
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: fakeredis
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -64,14 +70,14 @@ dependencies:
64
70
  requirements:
65
71
  - - "~>"
66
72
  - !ruby/object:Gem::Version
67
- version: '11'
73
+ version: '12'
68
74
  type: :development
69
75
  prerelease: false
70
76
  version_requirements: !ruby/object:Gem::Requirement
71
77
  requirements:
72
78
  - - "~>"
73
79
  - !ruby/object:Gem::Version
74
- version: '11'
80
+ version: '12'
75
81
  - !ruby/object:Gem::Dependency
76
82
  name: rspec
77
83
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
170
  version: '0'
165
171
  requirements: []
166
172
  rubyforge_project:
167
- rubygems_version: 2.6.14
173
+ rubygems_version: 2.7.6
168
174
  signing_key:
169
175
  specification_version: 4
170
176
  summary: A drop-in replacement for e.g. MemCacheStore to store Rails sessions (and