redis-actionpack 3.2.4 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/Gemfile +12 -2
- data/README.md +12 -24
- data/Rakefile +6 -2
- data/lib/redis/actionpack/version.rb +1 -1
- data/redis-actionpack.gemspec +12 -14
- data/test/dummy/app/controllers/test_controller.rb +2 -1
- data/test/dummy/config/application.rb +19 -0
- data/test/dummy/config/routes.rb +1 -1
- data/test/integration/redis_store_integration_test.rb +11 -11
- data/test/redis/actionpack/version_test.rb +1 -1
- data/test/test_helper.rb +1 -6
- metadata +10 -28
- data/.travis.yml +0 -14
- data/test/dummy/config/environments/test.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2d567ce799c77499a10d31ec89896b62b9f18e4
|
4
|
+
data.tar.gz: e8a99b34fce929fcdc912b4aaa6e11e82f1f7706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 017d0671f25317c4ae14302fb0af2ec17f17ee331e501925189428827dffbe1128e11dd95cc562e864ba162f1805abc2b49434517659601954a5914abbb62a0b
|
7
|
+
data.tar.gz: 42ab9ed04f14d7e2cc70b86e64df2a600af336784155d4be3834b76e92c55377730f5aa87ed37b6c9566de28e106d5bc1deee94a959531cab911db36a7a2668d
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
gem 'redis-store', '~> 1.1.0', path: '../redis-store'
|
5
|
+
gem 'redis-rack', '~> 1.5.0', path: '../redis-rack'
|
6
|
+
|
7
|
+
version = ENV["RAILS_VERSION"] || "4"
|
8
|
+
|
9
|
+
rails = case version
|
10
|
+
when "master"
|
11
|
+
{:github => "rails/rails"}
|
12
|
+
else
|
13
|
+
"~> #{version}.0"
|
6
14
|
end
|
15
|
+
|
16
|
+
gem "rails", rails
|
data/README.md
CHANGED
@@ -1,40 +1,28 @@
|
|
1
1
|
# Redis stores for ActionPack
|
2
2
|
|
3
|
-
__`redis-actionpack`__ provides a session store for __ActionPack__, specifically for __ActionDispatch__. See the main [redis-store readme](https://github.com/
|
3
|
+
__`redis-actionpack`__ provides a session store for __ActionPack__, specifically for __ActionDispatch__. See the main [redis-store readme](https://github.com/jodosha/redis-store) for general guidelines.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
gem 'redis-actionpack'
|
10
|
-
```
|
7
|
+
# Gemfile
|
8
|
+
gem 'redis-actionpack'
|
11
9
|
|
12
|
-
|
10
|
+
### Usage
|
13
11
|
|
14
|
-
If you are using redis-store with Rails, consider using the [redis-rails gem](https://github.com/redis-store/redis-rails) instead.
|
15
|
-
For standalone usage:
|
12
|
+
If you are using redis-store with Rails, consider using the [redis-rails gem](https://github.com/jodosha/redis-store/tree/master/redis-rails) instead. For standalone usage:
|
16
13
|
|
17
|
-
|
18
|
-
ActionController::Base.cache_store = ActionDispatch::Session::RedisSessionStore.new
|
19
|
-
```
|
14
|
+
ActionController::Base.cache_store = ActionDispatch::Session::RedisSessionStore.new
|
20
15
|
|
21
16
|
## Running tests
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
bundle install
|
29
|
-
bundle exec rake
|
30
|
-
```
|
18
|
+
gem install bundler
|
19
|
+
git clone git://github.com/jodosha/redis-store.git
|
20
|
+
cd redis-store/redis-actionpack
|
21
|
+
bundle install
|
22
|
+
bundle exec rake
|
31
23
|
|
32
24
|
If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" bundle exec rake`
|
33
25
|
|
34
|
-
## Status
|
35
|
-
|
36
|
-
[![Build Status](https://secure.travis-ci.org/redis-store/redis-actionpack.png?branch=3.2.x)](http://travis-ci.org/jodosha/redis-actionpack?branch=3.2.x)
|
37
|
-
|
38
26
|
## Copyright
|
39
27
|
|
40
|
-
2009 -
|
28
|
+
(c) 2009 - 2011 Luca Guidi - [http://lucaguidi.com](http://lucaguidi.com), released under the MIT license
|
data/Rakefile
CHANGED
data/redis-actionpack.gemspec
CHANGED
@@ -1,34 +1,32 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "redis/actionpack/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
6
|
+
s.name = "redis-actionpack"
|
7
7
|
s.version = Redis::ActionPack::VERSION
|
8
|
-
s.authors = [
|
9
|
-
s.email = [
|
10
|
-
s.homepage =
|
8
|
+
s.authors = ["Luca Guidi"]
|
9
|
+
s.email = ["me@lucaguidi.com"]
|
10
|
+
s.homepage = "http://redis-store.org/redis-actionpack"
|
11
11
|
s.summary = %q{Redis session store for ActionPack}
|
12
12
|
s.description = %q{Redis session store for ActionPack}
|
13
|
-
s.license = 'MIT'
|
14
13
|
|
15
|
-
s.rubyforge_project =
|
14
|
+
s.rubyforge_project = "redis-actionpack"
|
16
15
|
|
17
16
|
s.files = `git ls-files`.split("\n")
|
18
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
-
s.require_paths = [
|
19
|
+
s.require_paths = ["lib"]
|
21
20
|
|
22
|
-
s.add_runtime_dependency 'redis-store', '~> 1.1.
|
23
|
-
s.add_runtime_dependency 'redis-rack', '~> 1.
|
24
|
-
s.add_runtime_dependency 'actionpack', '~>
|
21
|
+
s.add_runtime_dependency 'redis-store', '~> 1.1.0'
|
22
|
+
s.add_runtime_dependency 'redis-rack', '~> 1.5.0'
|
23
|
+
s.add_runtime_dependency 'actionpack', '~> 4'
|
25
24
|
|
26
25
|
s.add_development_dependency 'rake', '~> 10'
|
27
26
|
s.add_development_dependency 'bundler', '~> 1.3'
|
28
27
|
s.add_development_dependency 'mocha', '~> 0.14.0'
|
29
28
|
s.add_development_dependency 'minitest', '~> 4.2'
|
30
|
-
s.add_development_dependency 'rails', '~> 3.2.0'
|
31
29
|
s.add_development_dependency 'tzinfo'
|
32
30
|
s.add_development_dependency 'mini_specunit'
|
33
|
-
s.add_development_dependency '
|
31
|
+
s.add_development_dependency 'mini_backtrace'
|
34
32
|
end
|
@@ -23,7 +23,8 @@ class TestController < ActionController::Base
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def get_session_id
|
26
|
-
|
26
|
+
session_id = request.session_options[:id] || cookies["_session_id"]
|
27
|
+
render :text => session_id
|
27
28
|
end
|
28
29
|
|
29
30
|
def call_reset_session
|
@@ -6,6 +6,25 @@ Bundler.require
|
|
6
6
|
|
7
7
|
module Dummy
|
8
8
|
class Application < Rails::Application
|
9
|
+
# Disable class caching for session auto-load test
|
10
|
+
config.cache_classes = false
|
11
|
+
|
12
|
+
config.eager_load = false
|
13
|
+
|
14
|
+
# Show full error reports and disable caching
|
15
|
+
config.consider_all_requests_local = true
|
16
|
+
config.action_controller.perform_caching = false
|
17
|
+
|
18
|
+
# Raise exceptions instead of rendering exception templates
|
19
|
+
config.action_dispatch.show_exceptions = false
|
20
|
+
|
21
|
+
# Disable request forgery protection in test environment
|
22
|
+
config.action_controller.allow_forgery_protection = false
|
23
|
+
|
24
|
+
# Print deprecation notices to the stderr
|
25
|
+
config.active_support.deprecation = :stderr
|
26
|
+
|
27
|
+
config.secret_key_base = 'secret'
|
9
28
|
end
|
10
29
|
end
|
11
30
|
|
data/test/dummy/config/routes.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class RedisStoreIntegrationTest <
|
4
|
-
|
3
|
+
class RedisStoreIntegrationTest < ActionDispatch::IntegrationTest
|
4
|
+
test "reads the data" do
|
5
5
|
get '/set_session_value'
|
6
6
|
response.must_be :success?
|
7
7
|
cookies['_session_id'].wont_be_nil
|
@@ -11,13 +11,13 @@ class RedisStoreIntegrationTest < ActionController::IntegrationTest
|
|
11
11
|
response.body.must_equal 'foo: "bar"'
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
test "should get nil session value" do
|
15
15
|
get '/get_session_value'
|
16
16
|
response.must_be :success?
|
17
17
|
response.body.must_equal 'foo: nil'
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
test "should delete the data after session reset" do
|
21
21
|
get '/set_session_value'
|
22
22
|
response.must_be :success?
|
23
23
|
cookies['_session_id'].wont_be_nil
|
@@ -34,14 +34,14 @@ class RedisStoreIntegrationTest < ActionController::IntegrationTest
|
|
34
34
|
response.body.must_equal 'foo: nil'
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
test "should not send cookies on write, not read" do
|
38
38
|
get '/get_session_value'
|
39
39
|
response.must_be :success?
|
40
40
|
response.body.must_equal 'foo: nil'
|
41
41
|
cookies['_session_id'].must_be_nil
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
test "should set session value after session reset" do
|
45
45
|
get '/set_session_value'
|
46
46
|
response.must_be :success?
|
47
47
|
cookies['_session_id'].wont_be_nil
|
@@ -60,7 +60,7 @@ class RedisStoreIntegrationTest < ActionController::IntegrationTest
|
|
60
60
|
response.body.wont_equal session_id
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
test "should be able to read session id without accessing the session hash" do
|
64
64
|
get '/set_session_value'
|
65
65
|
response.must_be :success?
|
66
66
|
cookies['_session_id'].wont_be_nil
|
@@ -71,7 +71,7 @@ class RedisStoreIntegrationTest < ActionController::IntegrationTest
|
|
71
71
|
response.body.must_equal session_id
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
test "should auto-load unloaded class" do
|
75
75
|
with_autoload_path "session_autoload_test" do
|
76
76
|
get '/set_serialized_session_value'
|
77
77
|
response.must_be :success?
|
@@ -90,7 +90,7 @@ class RedisStoreIntegrationTest < ActionController::IntegrationTest
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
|
93
|
+
test "should not resend the cookie again if session_id cookie is already exists" do
|
94
94
|
get '/set_session_value'
|
95
95
|
response.must_be :success?
|
96
96
|
cookies['_session_id'].wont_be_nil
|
@@ -100,7 +100,7 @@ class RedisStoreIntegrationTest < ActionController::IntegrationTest
|
|
100
100
|
headers['Set-Cookie'].must_be_nil
|
101
101
|
end
|
102
102
|
|
103
|
-
|
103
|
+
test "should prevent session fixation" do
|
104
104
|
get '/get_session_value'
|
105
105
|
response.must_be :success?
|
106
106
|
response.body.must_equal 'foo: nil'
|
@@ -113,7 +113,7 @@ class RedisStoreIntegrationTest < ActionController::IntegrationTest
|
|
113
113
|
cookies['_session_id'].wont_equal session_id
|
114
114
|
end
|
115
115
|
|
116
|
-
|
116
|
+
test "should write the data with expiration time" do
|
117
117
|
get '/set_session_value_with_expiry'
|
118
118
|
response.must_be :success?
|
119
119
|
|
data/test/test_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'bundler/setup'
|
1
2
|
require 'minitest/autorun'
|
2
3
|
require 'active_support/core_ext/numeric/time'
|
3
4
|
|
@@ -21,9 +22,3 @@ def with_autoload_path(path)
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
24
|
-
|
25
|
-
unless respond_to?(:assert_block)
|
26
|
-
def assert_block(*msgs)
|
27
|
-
assert yield, *msgs
|
28
|
-
end
|
29
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-actionpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-store
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.1.
|
19
|
+
version: 1.1.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
|
-
version: 1.1.
|
26
|
+
version: 1.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis-rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.5.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.5.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: actionpack
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '4'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '4.2'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rails
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ~>
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 3.2.0
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ~>
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 3.2.0
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: tzinfo
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +137,7 @@ dependencies:
|
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: '0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
140
|
+
name: mini_backtrace
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
143
|
- - '>='
|
@@ -172,7 +158,6 @@ extensions: []
|
|
172
158
|
extra_rdoc_files: []
|
173
159
|
files:
|
174
160
|
- .gitignore
|
175
|
-
- .travis.yml
|
176
161
|
- Gemfile
|
177
162
|
- MIT-LICENSE
|
178
163
|
- README.md
|
@@ -188,7 +173,6 @@ files:
|
|
188
173
|
- test/dummy/config/application.rb
|
189
174
|
- test/dummy/config/boot.rb
|
190
175
|
- test/dummy/config/environment.rb
|
191
|
-
- test/dummy/config/environments/test.rb
|
192
176
|
- test/dummy/config/initializers/secret_token.rb
|
193
177
|
- test/dummy/config/initializers/session_store.rb
|
194
178
|
- test/dummy/config/routes.rb
|
@@ -198,8 +182,7 @@ files:
|
|
198
182
|
- test/redis/actionpack/version_test.rb
|
199
183
|
- test/test_helper.rb
|
200
184
|
homepage: http://redis-store.org/redis-actionpack
|
201
|
-
licenses:
|
202
|
-
- MIT
|
185
|
+
licenses: []
|
203
186
|
metadata: {}
|
204
187
|
post_install_message:
|
205
188
|
rdoc_options: []
|
@@ -229,7 +212,6 @@ test_files:
|
|
229
212
|
- test/dummy/config/application.rb
|
230
213
|
- test/dummy/config/boot.rb
|
231
214
|
- test/dummy/config/environment.rb
|
232
|
-
- test/dummy/config/environments/test.rb
|
233
215
|
- test/dummy/config/initializers/secret_token.rb
|
234
216
|
- test/dummy/config/initializers/session_store.rb
|
235
217
|
- test/dummy/config/routes.rb
|
data/.travis.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = false
|
9
|
-
|
10
|
-
# Log error messages when you accidentally call methods on nil
|
11
|
-
config.whiny_nils = true
|
12
|
-
|
13
|
-
# Show full error reports and disable caching
|
14
|
-
config.consider_all_requests_local = true
|
15
|
-
config.action_controller.perform_caching = false
|
16
|
-
|
17
|
-
# Raise exceptions instead of rendering exception templates
|
18
|
-
config.action_dispatch.show_exceptions = false
|
19
|
-
|
20
|
-
# Disable request forgery protection in test environment
|
21
|
-
config.action_controller.allow_forgery_protection = false
|
22
|
-
|
23
|
-
# Print deprecation notices to the stderr
|
24
|
-
config.active_support.deprecation = :stderr
|
25
|
-
end
|