redis-session-store 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0158a4d89d8a2848b75766683f7e6e5add9c5d4f
4
- data.tar.gz: 9551ca90b67dad5c67ab4d028ee5a0bbafe1ef58
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ N2FjZTIzZDUyNjJhZmRjNzNmODNmYTEyM2E1ZWE3YTUyMGJhNjQ1Yw==
5
+ data.tar.gz: !binary |-
6
+ NmEzMWIwNzliODY3YmFhNzg2MDlhNDlkMWIyOTU3MjRiNjQyMGZiYg==
5
7
  SHA512:
6
- metadata.gz: 587a5a53e8df3fd350c95600754737fef57b697db50834e5e8113a41841c186aa6a4a3f918c3755010a49e0ff62abb80a70f2bcf67c6d83990256de343a49649
7
- data.tar.gz: 6bfe6da52599e3ffabc5dfbbea48aedd36f655b2e5ac33023112fffc6e4907105990d1673b7dca816bd0119a3ed105870522556e517e95b1dcfadf353a64fa5e
8
+ metadata.gz: !binary |-
9
+ NmYyOTU1OTgzZTE2Mzk1MWFmYjI2ZDkzMTM2ZmIxMDYxOGZmODc2YzIyMmYw
10
+ MTM3ODY4YTU5OWNkYmJiOTQyNDhiOTUzN2RlNDc5OTY0ZTViZTgyNTNlZmIy
11
+ NDNhNGRiZWI3N2QyMGEyNjdjY2IxMDA3ZDE5NDFjNjBlMDliYWU=
12
+ data.tar.gz: !binary |-
13
+ NzA2OWQzMGY0NDU5ZTZiZThhYjg1Mzg1YjZjNmMzY2ExNmQ5M2EzNDk0YWI1
14
+ NjRlOTdhODk5MzM1ZjliODNiNTE1YzFjMTkyNzMzNWU0YTIxMTRmNzFhZGQ1
15
+ ZTg4ZTAyMjc5N2Q4MThhZmFkN2M0ZjFmMzYyZTU1MDUwNTZiMmM=
data/.rubocop_todo.yml CHANGED
@@ -1,5 +1,6 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2014-08-28 08:17:48 -0400 using RuboCop version 0.25.0.
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-07-02 09:22:22 -0400 using RuboCop version 0.41.1.
3
4
  # The point is for the user to remove these configuration records
4
5
  # one by one as the offenses are removed from the code base.
5
6
  # Note that changes in the inspected code, or installation of new
@@ -8,4 +9,4 @@
8
9
  # Offense count: 1
9
10
  # Configuration parameters: CountComments.
10
11
  Metrics/ClassLength:
11
- Max: 107
12
+ Max: 108
data/.travis.yml CHANGED
@@ -1,13 +1,12 @@
1
- ---
2
1
  language: ruby
3
2
  sudo: false
3
+ cache: bundler
4
4
  rvm:
5
- - 1.9.3
6
- - 2.1.3
7
- - jruby-19mode
5
+ - 2.3.1
6
+ - jruby-9.1.1.0
8
7
  matrix:
9
8
  allow_failures:
10
- - rvm: jruby-19mode
9
+ - rvm: jruby-9.1.1.0
11
10
  notifications:
12
11
  email: false
13
12
  deploy:
@@ -18,4 +17,4 @@ deploy:
18
17
  on:
19
18
  tags: true
20
19
  repo: roidrage/redis-session-store
21
- rvm: 2.1.3
20
+ rvm: 2.3.1
data/CHANGELOG.md CHANGED
@@ -1,158 +1,221 @@
1
- redis-session-store history
2
- ===========================
1
+ # Change Log
3
2
 
4
- ## v0.8.1 (2016-01-25)
3
+ **ATTN**: This project uses [semantic versioning](http://semver.org/).
5
4
 
6
- * Support for Rails 5 and Rack 2
7
- * Expand error support for redis-rb v3 gem
5
+ ## [Unreleased]
8
6
 
9
- ## v0.8.0 (2014-08-28)
7
+ ## [0.9.0] - 2016-07-02
8
+ ### Added
9
+ - [`CODE_OF_CONDUCT.md`](./CODE_OF_CONDUCT.md)
10
+ - Method alias for `#delete_session` -> `#destroy_session`
10
11
 
11
- * Allow for injection of custom redis client
12
- * Explicitly declare actionpack dependency
13
- * Spec updates for rspec 3
12
+ ### Changed
13
+ - Tested version of Ruby 2 up to 2.3.1
14
+ - Session config examples to use `redis: { url: '...' }`
14
15
 
15
- ## v0.7.0 (2014-04-22)
16
+ ### Removed
17
+ - Ruby 1.9.3 support due to Rack 2 requirements
16
18
 
17
- * Fix issue #38, we now delay writing to redis until a session exists. This is
18
- a backwards-incompatible change, as it removes the `on_sid_collision` option.
19
- There is now no checking for sid collisions, however that is very unlikely.
19
+ ## [0.8.1] - 2016-01-25
20
+ ### Added
21
+ - Support for Rails 5 and Rack 2
20
22
 
21
- ## v0.6.6 (2014-04-08)
23
+ ### Changed
24
+ - Error support for redis-rb v3 gem
22
25
 
23
- * Fix issue #37, use correct constant for `ENV_SESSION_OPTIONS_KEY` if not
24
- passed.
26
+ ## [0.8.0] - 2014-08-28
27
+ ### Added
28
+ - Allow for injection of custom redis client
29
+ - Explicitly declare actionpack dependency
25
30
 
26
- ## v0.6.5 (2014-04-04)
31
+ ### Changed
32
+ - Spec updates for rspec 3
27
33
 
28
- * Fix issue #36, use setnx to get a new session id instead of get. This
29
- prevents a very rare id collision.
34
+ ## [0.7.0] - 2014-04-22
35
+ ### Fixed
36
+ - Issue #38, we now delay writing to redis until a session exists. This is a
37
+ backwards-incompatible change, as it removes the `on_sid_collision` option.
38
+ There is now no checking for sid collisions, however that is very unlikely.
30
39
 
31
- ## v0.6.4 (2014-04-04)
40
+ ## [0.6.6] - 2014-04-08
41
+ ### Fixed
42
+ - Issue #37, use correct constant for `ENV_SESSION_OPTIONS_KEY` if not passed.
32
43
 
33
- * Reverting `setnx` usage in v0.6.3 so we can change our sessions.
44
+ ## [0.6.5] - 2014-04-04
45
+ ### Fixed
46
+ - Issue #36, use setnx to get a new session id instead of get. This prevents a
47
+ very rare id collision.
34
48
 
35
- ## v0.6.3 (2014-04-01)
49
+ ## [0.6.4] - 2014-04-04
50
+ ### Removed
51
+ - `#setnx` usage in v0.6.3 so we can change our sessions
36
52
 
37
- * Reverting the `#setnx` change in `0.6.2` as it behaved badly under
38
- load, hitting yet another race condition issue and pegging the CPU.
39
- * Setting session ID with a multi-call `#setnx` and `#expire` instead of
53
+ ## [0.6.3] - 2014-04-01
54
+ ### Changed
55
+ - Setting session ID with a multi-call `#setnx` and `#expire` instead of
40
56
  `#setex`.
41
57
 
42
- ## v0.6.2 (2014-03-31)
58
+ ### Removed
59
+ - `#setnx` change in v0.6.2 as it behaved badly under load, hitting yet another
60
+ race condition issue and pegging the CPU.
43
61
 
44
- * Use `#setnx` instead of `#get` when checking for session ID
45
- collisions, which is slightly more paranoid and should help avoid a
46
- particularly nasty edge case.
62
+ ## [0.6.2] - 2014-03-31
63
+ ### Changed
64
+ - Use `#setnx` instead of `#get` when checking for session ID collisions, which
65
+ is slightly more paranoid and should help avoid a particularly nasty edge
66
+ case.
47
67
 
48
- ## v0.6.1 (2014-03-17)
68
+ ## [0.6.1] - 2014-03-17
69
+ ### Fixed
70
+ - Compatibility with `ActionDispatch::Request::Session::Options` when destroying
71
+ sessions.
49
72
 
50
- * Fix compatibility with `ActionDispatch::Request::Session::Options`
51
- when destroying sessions.
73
+ ## [0.6.0] - 2014-03-17
74
+ ### Added
75
+ - Custom serializer configuration
76
+ - Custom handling capability for session load errors
52
77
 
53
- ## v0.6.0 (2014-03-17)
78
+ ### Changed
79
+ - Always destroying sessions that cannot be loaded
54
80
 
55
- * Add custom serializer configuration
56
- * Add custom handling capability for session load errors
57
- * Always destroying sessions that cannot be loaded
81
+ ## [0.5.0] - 2014-03-16
82
+ ### Added
83
+ - Support for `on_sid_collision` handler option
84
+ - Support for `on_redis_down` handler option
58
85
 
59
- ## v0.5.0 (2014-03-16)
60
-
61
- * Keep generating session IDs until one is found that doesn't collide
86
+ ### Changed
87
+ - Keep generating session IDs until one is found that doesn't collide
62
88
  with existing session IDs
63
- * Add support for `on_sid_collision` handler option
64
- * Add support for `on_redis_down` handler option
65
- * **BACKWARD INCOMPATIBLE** Drop support for `:raise_errors` option
66
-
67
- ## v0.4.2 (2014-03-14)
68
89
 
69
- * Renaming `load_session` method to not conflict with AbstractStore
90
+ ### Removed
91
+ - **BACKWARD INCOMPATIBLE** Drop support for `:raise_errors` option
70
92
 
71
- ## v0.4.1 (yanked) (2014-03-13)
93
+ ## [0.4.2] - 2014-03-14
94
+ ### Changed
95
+ - Renaming `load_session` method to not conflict with AbstractStore
72
96
 
73
- * Regenerate session ID when session is missing
97
+ ## [0.4.1] - (2014-03-13) [YANKED]
98
+ ### Changed
99
+ - Regenerate session ID when session is missing
74
100
 
75
- ## v0.4.0 (2014-02-19)
101
+ ## [0.4.0] - 2014-02-19
102
+ ### Added
103
+ - Support for `ENV_SESSION_OPTIONS_KEY` rack env option
104
+ - Support for `:raise_errors` session option (kinda like Dalli)
76
105
 
77
- * Add support for `ENV_SESSION_OPTIONS_KEY` rack env option
78
- * Add support for `:raise_errors` session option (kinda like Dalli)
79
- * Increasing test coverage
106
+ ### Changed
107
+ - Increasing test coverage
80
108
 
81
- ## v0.3.1 (2014-02-19)
109
+ ## [0.3.1] - 2014-02-19
110
+ ### Added
111
+ - `#destroy_session` method
82
112
 
83
- * Add `#destroy_session` method
84
- * Clean up remaining RuboCop offenses
85
- * Documentation updates
113
+ ### Changed
114
+ - Clean up remaining RuboCop offenses
115
+ - Documentation updates
86
116
 
87
- ## v0.3.0 (2014-02-13)
117
+ ## [0.3.0] - 2014-02-13
118
+ ### Added
119
+ - Rails 3 compatibility
120
+ - Add test coverage
88
121
 
89
- * Rails 3 compatibility
90
- * Switch from minitest to rspec
91
- * Add test coverage
92
- * RuboCop cleanup
122
+ ### Changed
123
+ - Switch from minitest to rspec
124
+ - RuboCop cleanup
93
125
 
94
- ## v0.2.4 (2014-03-16)
95
-
96
- * Keep generating session IDs until one is found that doesn't collide
126
+ ## [0.2.4] - 2014-03-16
127
+ ### Changed
128
+ - Keep generating session IDs until one is found that doesn't collide
97
129
  with existing session IDs
98
130
 
99
- ## v0.2.3 (2014-03-14)
100
-
101
- * Renaming `load_session` method to not conflict with AbstractStore
102
-
103
- ## v0.2.2 (yanked) (2014-03-13)
104
-
105
- * Regenerate session ID when session is missing
106
-
107
- ## v0.2.1 (2013-09-17)
108
-
109
- * Add explicit MIT license metadata in gemspec
110
-
111
- ## v0.2.0 (2013-09-13)
112
-
113
- * Use `@redis.setex` when expiry provided, else `@redis.set`
114
- * Gemfile, gemspec, and git updates
115
- * Nest redis-specific options inside a `:redis` key of session options
116
- * Add `#destroy` method
117
- * Rescue only `Errno::ECONNREFUSED` exceptions
118
- * Handle `nil` cookies during `#destroy`
119
- * Add Travis integration
120
- * Add some minimal tests to ensure backward compatibility session options
121
-
122
- ## v0.1.9 (2012-03-06)
123
-
124
- ## v0.1.8 (2010-12-09)
125
-
126
- * Remove use of `@redis.pipelined`
127
-
128
- ## v0.1.7 (2010-12-08)
129
-
130
- * Using latest redis gem API
131
-
132
- ## v0.1.6 (2010-04-18)
133
-
134
- * Using pipelined format with `set` and `expire`
135
- * Changing default port from 6370 to 6379
136
-
137
- ## v0.1.5 (2010-04-07)
138
-
139
- ## v0.1.4 (2010-03-26)
140
-
141
- * Changed redis parameter from `:server` to `:host`
142
-
143
- ## v0.1.3 (2009-12-30)
144
-
145
- * Documentation updates
146
-
147
- ## v0.1.2 (2009-12-30)
148
-
149
- * Documentation updates
150
-
151
- ## v0.1.1 (2009-12-30)
152
-
153
- * library file renamed to `redis-session-store.rb` to play nicely with
131
+ ## [0.2.3] - 2014-03-14
132
+ ### Changed
133
+ - Renaming `load_session` method to not conflict with AbstractStore
134
+
135
+ ## [0.2.2] - 2014-03-13 [YANKED]
136
+ ### Changed
137
+ - Regenerate session ID when session is missing
138
+
139
+ ## [0.2.1] - 2013-09-17
140
+ ### Added
141
+ - Explicit MIT license metadata in gemspec
142
+
143
+ ## [0.2.0] - 2013-09-13
144
+ ### Added
145
+ - Gemfile, gemspec, and git updates
146
+ - `#destroy` method
147
+ - Travis integration
148
+ - Some minimal tests to ensure backward compatibility session options
149
+
150
+ ### Changed
151
+ - Nest redis-specific options inside a `:redis` key of session options
152
+ - Rescue only `Errno::ECONNREFUSED` exceptions
153
+ - Handle `nil` cookies during `#destroy`
154
+
155
+ ## [0.1.9] - 2012-03-06
156
+ ### Changed
157
+ - Use `@redis.setex` when expiry provided, else `@redis.set`
158
+ - gemification
159
+ - Options hash to no longer expect redis options at same level
160
+
161
+ ## [0.1.8] - 2010-12-09
162
+ ### Removed
163
+ - Use of `@redis.pipelined`
164
+
165
+ ## 0.1.7 - 2010-12-08
166
+ ### Changed
167
+ - Using latest redis gem API
168
+
169
+ ## 0.1.6 - 2010-04-18
170
+ ### Changed
171
+ - Using pipelined format with `set` and `expire`
172
+ - Changing default port from 6370 to 6379
173
+
174
+ ## 0.1.5 - 2010-04-07
175
+
176
+ ## 0.1.4 - 2010-03-26
177
+ ### Changed
178
+ - Redis parameter from `:server` to `:host`
179
+
180
+ ## 0.1.3 - 2009-12-30
181
+ ### Changed
182
+ - Documentation updates
183
+
184
+ ## 0.1.2 - 2009-12-30
185
+ ### Changed
186
+ - Documentation updates
187
+
188
+ ## 0.1.1 - 2009-12-30
189
+ ### Changed
190
+ - library file renamed to `redis-session-store.rb` to play nicely with
154
191
  rails require
155
192
 
156
- ## v0.1 (2009-12-30)
157
-
158
- * first working version
193
+ ## 0.1 - 2009-12-30
194
+ ### Added
195
+ - first working version
196
+
197
+ [Unreleased]: https://github.com/roidrage/redis-session-store/compare/v0.9.0...HEAD
198
+ [0.9.0]: https://github.com/roidrage/redis-session-store/compare/v0.8.1...v0.9.0
199
+ [0.8.1]: https://github.com/roidrage/redis-session-store/compare/v0.8.0...v0.8.1
200
+ [0.8.0]: https://github.com/roidrage/redis-session-store/compare/v0.7.0...v0.8.0
201
+ [0.7.0]: https://github.com/roidrage/redis-session-store/compare/v0.6.6...v0.7.0
202
+ [0.6.6]: https://github.com/roidrage/redis-session-store/compare/v0.6.5...v0.6.6
203
+ [0.6.5]: https://github.com/roidrage/redis-session-store/compare/v0.6.4...v0.6.5
204
+ [0.6.4]: https://github.com/roidrage/redis-session-store/compare/v0.6.3...v0.6.4
205
+ [0.6.3]: https://github.com/roidrage/redis-session-store/compare/v0.6.2...v0.6.3
206
+ [0.6.2]: https://github.com/roidrage/redis-session-store/compare/v0.6.1...v0.6.2
207
+ [0.6.1]: https://github.com/roidrage/redis-session-store/compare/v0.6.0...v0.6.1
208
+ [0.6.0]: https://github.com/roidrage/redis-session-store/compare/v0.5.0...v0.6.0
209
+ [0.5.0]: https://github.com/roidrage/redis-session-store/compare/v0.4.2...v0.5.0
210
+ [0.4.2]: https://github.com/roidrage/redis-session-store/compare/v0.4.1...v0.4.2
211
+ [0.4.1]: https://github.com/roidrage/redis-session-store/compare/v0.4.0...v0.4.1
212
+ [0.4.0]: https://github.com/roidrage/redis-session-store/compare/v0.3.1...v0.4.0
213
+ [0.3.1]: https://github.com/roidrage/redis-session-store/compare/v0.3.0...v0.3.1
214
+ [0.3.0]: https://github.com/roidrage/redis-session-store/compare/v0.2.4...v0.3.0
215
+ [0.2.4]: https://github.com/roidrage/redis-session-store/compare/v0.2.3...v0.2.4
216
+ [0.2.3]: https://github.com/roidrage/redis-session-store/compare/v0.2.2...v0.2.3
217
+ [0.2.2]: https://github.com/roidrage/redis-session-store/compare/v0.2.1...v0.2.2
218
+ [0.2.1]: https://github.com/roidrage/redis-session-store/compare/v0.2.0...v0.2.1
219
+ [0.2.0]: https://github.com/roidrage/redis-session-store/compare/v0.1.9...v0.2.0
220
+ [0.1.9]: https://github.com/roidrage/redis-session-store/compare/v0.1.8...v0.1.9
221
+ [0.1.8]: https://github.com/roidrage/redis-session-store/compare/v0.1.7...v0.1.8
@@ -0,0 +1,75 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team via [github
59
+ issues](https://github.com/roidrage/redis-session-store/issues). All
60
+ complaints will be reviewed and investigated and will result in a response that
61
+ is deemed necessary and appropriate to the circumstances. The project team is
62
+ obligated to maintain confidentiality with regard to the reporter of an incident.
63
+ Further details of specific enforcement policies may be posted separately.
64
+
65
+ Project maintainers who do not follow or enforce the Code of Conduct in good
66
+ faith may face temporary or permanent repercussions as determined by other
67
+ members of the project's leadership.
68
+
69
+ ## Attribution
70
+
71
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
72
+ available at [http://contributor-covenant.org/version/1/4][version]
73
+
74
+ [homepage]: http://contributor-covenant.org
75
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
- # vim:fileencoding=utf-8
2
1
  source 'https://rubygems.org'
3
2
 
4
3
  gemspec
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Mathias Meyer
1
+ Copyright (c) 2016 Mathias Meyer and contributors
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -39,11 +39,9 @@ In your Rails app, throw in an initializer with the following contents:
39
39
  My::Application.config.session_store :redis_session_store, {
40
40
  key: 'your_session_key',
41
41
  redis: {
42
- db: 2,
43
42
  expire_after: 120.minutes,
44
43
  key_prefix: 'myapp:session:',
45
- host: 'host', # Redis host name, default is localhost
46
- port: 12345 # Redis port, default is 6379
44
+ url: 'redis://host:12345/2',
47
45
  }
48
46
  }
49
47
  ```
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- # vim:fileencoding=utf-8
2
1
  require 'bundler/gem_tasks'
3
2
  require 'rspec/core/rake_task'
4
3
  require 'rubocop/rake_task'
@@ -1,10 +1,9 @@
1
- # vim:fileencoding=utf-8
2
1
  require 'redis'
3
2
 
4
3
  # Redis session storage for Rails, and for Rails only. Derived from
5
4
  # the MemCacheStore code, simply dropping in Redis instead.
6
5
  class RedisSessionStore < ActionDispatch::Session::AbstractStore
7
- VERSION = '0.8.1'
6
+ VERSION = '0.9.0'.freeze
8
7
  # Rails 3.1 and beyond defines the constant elsewhere
9
8
  unless defined?(ENV_SESSION_OPTIONS_KEY)
10
9
  if Rack.release.split('.').first.to_i > 1
@@ -17,9 +16,7 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
17
16
  # ==== Options
18
17
  # * +:key+ - Same as with the other cookie stores, key name
19
18
  # * +:redis+ - A hash with redis-specific options
20
- # * +:host+ - Redis host name, default is localhost
21
- # * +:port+ - Redis port, default is 6379
22
- # * +:db+ - Database number, defaults to 0.
19
+ # * +:url+ - Redis url, default is redis://localhost:6379/0
23
20
  # * +:key_prefix+ - Prefix for keys used in Redis, e.g. +myapp:+
24
21
  # * +:expire_after+ - A number in seconds for session timeout
25
22
  # * +:client+ - Connect to Redis with given object rather than create one
@@ -32,11 +29,9 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
32
29
  # My::Application.config.session_store :redis_session_store, {
33
30
  # key: 'your_session_key',
34
31
  # redis: {
35
- # db: 2,
36
32
  # expire_after: 120.minutes,
37
33
  # key_prefix: 'myapp:session:',
38
- # host: 'host', # Redis host name, default is localhost
39
- # port: 12345 # Redis port, default is 6379
34
+ # url: 'redis://host:12345/2'
40
35
  # },
41
36
  # on_redis_down: ->(*a) { logger.error("Redis down! #{a.inspect}") }
42
37
  # serializer: :hybrid # migrate from Marshal to JSON
@@ -47,7 +42,7 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
47
42
 
48
43
  redis_options = options[:redis] || {}
49
44
 
50
- @default_options.merge!(namespace: 'rack:session')
45
+ @default_options[:namespace] = 'rack:session'
51
46
  @default_options.merge!(redis_options)
52
47
  @redis = redis_options[:client] || Redis.new(redis_options)
53
48
  @on_redis_down = options[:on_redis_down]
@@ -83,7 +78,7 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
83
78
  %w(on_redis_down on_session_load_error).each do |h|
84
79
  next unless (handler = public_send(h)) && !handler.respond_to?(:call)
85
80
 
86
- fail ArgumentError, "#{h} handler is not callable"
81
+ raise ArgumentError, "#{h} handler is not callable"
87
82
  end
88
83
  end
89
84
 
@@ -102,7 +97,7 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
102
97
  on_redis_down.call(e, env, sid) if on_redis_down
103
98
  [generate_sid, {}]
104
99
  end
105
- alias_method :find_session, :get_session
100
+ alias find_session get_session
106
101
 
107
102
  def load_session_from_redis(sid)
108
103
  data = redis.get(prefixed(sid))
@@ -131,7 +126,7 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
131
126
  on_redis_down.call(e, env, sid) if on_redis_down
132
127
  return false
133
128
  end
134
- alias_method :write_session, :set_session
129
+ alias write_session set_session
135
130
 
136
131
  def encode(session_data)
137
132
  serializer.dump(session_data)
@@ -140,6 +135,7 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
140
135
  def destroy_session(env, sid, options)
141
136
  destroy_session_from_sid(sid, (options || {}).to_hash.merge(env: env))
142
137
  end
138
+ alias delete_session destroy_session
143
139
 
144
140
  def destroy(env)
145
141
  if env['rack.request.cookie_hash'] &&
@@ -1,5 +1,3 @@
1
- # vim:fileencoding=utf-8
2
-
3
1
  Gem::Specification.new do |gem|
4
2
  gem.name = 'redis-session-store'
5
3
  gem.authors = ['Mathias Meyer']
@@ -16,7 +14,7 @@ Gem::Specification.new do |gem|
16
14
  gem.files = `git ls-files -z`.split("\x0")
17
15
  gem.require_paths = %w(lib)
18
16
  gem.version = File.read('lib/redis-session-store.rb')
19
- .match(/^ VERSION = '(.*)'/)[1]
17
+ .match(/^ VERSION = '(.*)'/)[1]
20
18
 
21
19
  gem.add_runtime_dependency 'redis'
22
20
  gem.add_runtime_dependency 'actionpack', '>= 3', '< 5.1'
@@ -1,4 +1,3 @@
1
- # vim:fileencoding=utf-8
2
1
  require 'json'
3
2
 
4
3
  describe RedisSessionStore do
@@ -184,7 +183,7 @@ describe RedisSessionStore do
184
183
  end
185
184
 
186
185
  context 'when :on_redis_down re-raises' do
187
- before { store.on_redis_down = ->(e, *) { fail e } }
186
+ before { store.on_redis_down = ->(e, *) { raise e } }
188
187
 
189
188
  it 'explodes' do
190
189
  expect do
@@ -285,7 +284,7 @@ describe RedisSessionStore do
285
284
  end
286
285
 
287
286
  context 'when :on_redis_down re-raises' do
288
- before { store.on_redis_down = ->(e, *) { fail e } }
287
+ before { store.on_redis_down = ->(e, *) { raise e } }
289
288
 
290
289
  it 'explodes' do
291
290
  expect do
@@ -325,7 +324,7 @@ describe RedisSessionStore do
325
324
  end
326
325
 
327
326
  context 'when :on_redis_down re-raises' do
328
- before { store.on_redis_down = ->(e, *) { fail e } }
327
+ before { store.on_redis_down = ->(e, *) { raise e } }
329
328
 
330
329
  it 'explodes' do
331
330
  expect do
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,3 @@
1
- # vim:fileencoding=utf-8
2
-
3
1
  require 'simplecov'
4
2
  require_relative 'support'
5
3
  require 'fakeredis/rspec'
data/spec/support.rb CHANGED
@@ -1,5 +1,3 @@
1
- # vim:fileencoding=utf-8
2
-
3
1
  unless defined?(Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY)
4
2
  module Rack
5
3
  module Session
metadata CHANGED
@@ -1,117 +1,117 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-session-store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.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: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3'
34
- - - "<"
34
+ - - <
35
35
  - !ruby/object:Gem::Version
36
36
  version: '5.1'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ">="
41
+ - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
43
  version: '3'
44
- - - "<"
44
+ - - <
45
45
  - !ruby/object:Gem::Version
46
46
  version: '5.1'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fakeredis
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - ! '>='
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rake
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - ! '>='
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - ! '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rspec
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - ! '>='
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - ! '>='
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rubocop
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - ! '>='
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - ! '>='
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: simplecov
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">="
107
+ - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ">="
114
+ - - ! '>='
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  description: A drop-in replacement for e.g. MemCacheStore to store Rails sessions
@@ -125,14 +125,15 @@ extra_rdoc_files:
125
125
  - AUTHORS.md
126
126
  - CONTRIBUTING.md
127
127
  files:
128
- - ".gitignore"
129
- - ".rspec"
130
- - ".rubocop.yml"
131
- - ".rubocop_todo.yml"
132
- - ".simplecov"
133
- - ".travis.yml"
128
+ - .gitignore
129
+ - .rspec
130
+ - .rubocop.yml
131
+ - .rubocop_todo.yml
132
+ - .simplecov
133
+ - .travis.yml
134
134
  - AUTHORS.md
135
135
  - CHANGELOG.md
136
+ - CODE_OF_CONDUCT.md
136
137
  - CONTRIBUTING.md
137
138
  - Gemfile
138
139
  - LICENSE
@@ -153,17 +154,17 @@ require_paths:
153
154
  - lib
154
155
  required_ruby_version: !ruby/object:Gem::Requirement
155
156
  requirements:
156
- - - ">="
157
+ - - ! '>='
157
158
  - !ruby/object:Gem::Version
158
159
  version: '0'
159
160
  required_rubygems_version: !ruby/object:Gem::Requirement
160
161
  requirements:
161
- - - ">="
162
+ - - ! '>='
162
163
  - !ruby/object:Gem::Version
163
164
  version: '0'
164
165
  requirements: []
165
166
  rubyforge_project:
166
- rubygems_version: 2.5.1
167
+ rubygems_version: 2.4.5
167
168
  signing_key:
168
169
  specification_version: 4
169
170
  summary: A drop-in replacement for e.g. MemCacheStore to store Rails sessions (and