redrails-session 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +3 -0
- data/LICENSE +18 -0
- data/README.md +65 -0
- data/Rakefile +2 -0
- data/dummy/.gitignore +3 -0
- data/dummy/app/controllers/application_controller.rb +4 -0
- data/dummy/app/controllers/test_controller.rb +7 -0
- data/dummy/app/views/layouts/application.html.erb +2 -0
- data/dummy/app/views/test/index.html.erb +3 -0
- data/dummy/config.ru +3 -0
- data/dummy/config/application.rb +11 -0
- data/dummy/config/boot.rb +4 -0
- data/dummy/config/environment.rb +6 -0
- data/dummy/config/environments/development.rb +9 -0
- data/dummy/config/environments/test.rb +10 -0
- data/dummy/config/initializers/secret_token.rb +2 -0
- data/dummy/config/initializers/session_store.rb +3 -0
- data/dummy/config/routes.rb +4 -0
- data/dummy/script/rails +5 -0
- data/lib/action_dispatch/session/redrails_session_store.rb +12 -0
- data/lib/redrails-session.rb +2 -0
- data/lib/redrails/session.rb +13 -0
- data/lib/redrails/session/middleware.rb +13 -0
- data/redrails-session.gemspec +25 -0
- metadata +121 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Copyright (C) 2011 by Kendall Gifford
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
8
|
+
subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
## redrails-session
|
2
|
+
|
3
|
+
Redis session store for rails applications.
|
4
|
+
|
5
|
+
This lets you store your users' browser sessions in a [redis](http://redis.io/)
|
6
|
+
database. This is really a very simplistic "glue" gem that allows you to easily
|
7
|
+
use the [redrack-session](https://github.com/zettabyte/redrack-session) gem to
|
8
|
+
store your users' sessions in a redis database.
|
9
|
+
|
10
|
+
### Usage
|
11
|
+
|
12
|
+
All you have to do to use this gem is to:
|
13
|
+
|
14
|
+
1. Add it to your `Gemfile`.
|
15
|
+
2. Edit your `config/initializers/session_store.rb`, configuring your app to use this gem.
|
16
|
+
|
17
|
+
###### Example `Gemfile`
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
source "http://rubygems.org"
|
21
|
+
gem "rails", "3.1.1"
|
22
|
+
gem "redrails-session"
|
23
|
+
# ... all your other gems ...
|
24
|
+
```
|
25
|
+
|
26
|
+
###### Example `config/initializers/session_store.rb`
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'redrails-session'
|
30
|
+
MyApp::Application.config.session_store :redrails_session_store
|
31
|
+
```
|
32
|
+
|
33
|
+
#### Redis Setup
|
34
|
+
|
35
|
+
Check out http://redis.io/ for information on installing and configuring a redis
|
36
|
+
server.
|
37
|
+
|
38
|
+
#### Supported Options
|
39
|
+
|
40
|
+
When editing your `config/initializers/session_store.rb` file to use
|
41
|
+
`redrails-session`, there are several options you may provide to configure the
|
42
|
+
behavior of the session store. These options are the same set of options
|
43
|
+
supported by the `Redrack::Session::Middleware` class in the
|
44
|
+
[redrack-session](https://github.com/zettabyte/redrack-session) gem (see its
|
45
|
+
documentation for more details).
|
46
|
+
|
47
|
+
The options you can specify (and their defaults) are:
|
48
|
+
|
49
|
+
- `:expires` -- alias for `:expire_after`, lets you specify how long, in seconds, to keep inactive sessions around (forever by default)
|
50
|
+
- `:key` -- specify name of cookie stored on client's browser that holds their unique session ID (default: ``rails.session'`)
|
51
|
+
- `:redis_host` -- specify IP address or hostname of host running the redis service (default: `'127.0.0.1'`)
|
52
|
+
- `:redis_port` -- specify port that the redis service is listening on (default: `6379`)
|
53
|
+
- `:redis_path` -- alternatively specify filename of socket that redis server is listening on (unset by default)
|
54
|
+
- `:redis_database` -- specify which database number to store session data in (default: `0`)
|
55
|
+
- `:redis_namespace` -- optionally specify a string to prefix to all session keys in case you're storing other datasets in the redis database (unset by default)
|
56
|
+
- `:redis_password` -- optionally specify a string to use to authenticate with the server (unset by default)
|
57
|
+
|
58
|
+
### Credits and License
|
59
|
+
|
60
|
+
Written by [Kendall Gifford](https://github.com/zettabyte).
|
61
|
+
|
62
|
+
Licensed using the standard
|
63
|
+
[MIT License](http://en.wikipedia.org/wiki/MIT_License). See the file
|
64
|
+
[LICENSE](http://github.com/zettabyte/redrails-session/blob/master/LICENSE) in
|
65
|
+
the root folder of the project.
|
data/Rakefile
ADDED
data/dummy/.gitignore
ADDED
data/dummy/config.ru
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
Dummy::Application.configure do
|
3
|
+
config.cache_classes = false
|
4
|
+
config.whiny_nils = true
|
5
|
+
config.consider_all_requests_local = true
|
6
|
+
config.action_controller.perform_caching = false
|
7
|
+
config.active_support.deprecation = :log
|
8
|
+
config.action_dispatch.best_standards_support = :builtin
|
9
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
Dummy::Application.configure do
|
3
|
+
config.cache_classes = true
|
4
|
+
config.whiny_nils = true
|
5
|
+
config.consider_all_requests_local = true
|
6
|
+
config.action_controller.perform_caching = false
|
7
|
+
config.action_dispatch.show_exceptions = false
|
8
|
+
config.action_controller.allow_forgery_protection = false
|
9
|
+
config.active_support.deprecation = :stderr
|
10
|
+
end
|
data/dummy/script/rails
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'redrack/session/middleware'
|
3
|
+
require 'action_dispatch/middleware/session/abstract_store'
|
4
|
+
|
5
|
+
module ActionDispatch
|
6
|
+
module Session
|
7
|
+
class RedrailsSessionStore < Redrack::Session::Middleware
|
8
|
+
include Compatibility
|
9
|
+
include StaleSessionCheck
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Redrails
|
3
|
+
module Session
|
4
|
+
VERSION = "0.0.1"
|
5
|
+
autoload :Middleware, 'redrails/session/middleware'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
module ActionDispatch
|
10
|
+
module Session
|
11
|
+
autoload :RedrailsSessionStore, 'action_dispatch/session/redrails_session_store'
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'redrack/session/middleware'
|
3
|
+
module Redrails
|
4
|
+
module Session
|
5
|
+
class Middleware < Redrack::Session::Middleware
|
6
|
+
def initialize(app, options = {})
|
7
|
+
options[:expire_after] ||= options[:expires]
|
8
|
+
options[:key] ||= "rails.session"
|
9
|
+
super
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "redrails/session"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "redrails-session"
|
7
|
+
s.version = Redrails::Session::VERSION
|
8
|
+
s.authors = ["Kendall Gifford"]
|
9
|
+
s.email = ["zettabyte@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/zettabyte/redrails-session"
|
11
|
+
s.summary = "Redis session store for rails applications."
|
12
|
+
s.description = <<-DESC.gsub(/^\s*/, "")
|
13
|
+
Redis session store for rails applications.
|
14
|
+
|
15
|
+
This provides convenient glue to use the redrack-session gem in your rails app.
|
16
|
+
DESC
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- dummy/*`.split("\n")
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_development_dependency "bundler", "~> 1.0.21"
|
23
|
+
s.add_runtime_dependency "rails", "~> 3.1.0"
|
24
|
+
s.add_runtime_dependency "redrack-session", "~> 1.0.0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redrails-session
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kendall Gifford
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-02 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: &22001720 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.21
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *22001720
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rails
|
27
|
+
requirement: &22001240 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.1.0
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *22001240
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: redrack-session
|
38
|
+
requirement: &22000780 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.0.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *22000780
|
47
|
+
description: ! 'Redis session store for rails applications.
|
48
|
+
|
49
|
+
This provides convenient glue to use the redrack-session gem in your rails app.
|
50
|
+
|
51
|
+
'
|
52
|
+
email:
|
53
|
+
- zettabyte@gmail.com
|
54
|
+
executables: []
|
55
|
+
extensions: []
|
56
|
+
extra_rdoc_files: []
|
57
|
+
files:
|
58
|
+
- .gitignore
|
59
|
+
- Gemfile
|
60
|
+
- LICENSE
|
61
|
+
- README.md
|
62
|
+
- Rakefile
|
63
|
+
- dummy/.gitignore
|
64
|
+
- dummy/app/controllers/application_controller.rb
|
65
|
+
- dummy/app/controllers/test_controller.rb
|
66
|
+
- dummy/app/views/layouts/application.html.erb
|
67
|
+
- dummy/app/views/test/index.html.erb
|
68
|
+
- dummy/config.ru
|
69
|
+
- dummy/config/application.rb
|
70
|
+
- dummy/config/boot.rb
|
71
|
+
- dummy/config/environment.rb
|
72
|
+
- dummy/config/environments/development.rb
|
73
|
+
- dummy/config/environments/test.rb
|
74
|
+
- dummy/config/initializers/secret_token.rb
|
75
|
+
- dummy/config/initializers/session_store.rb
|
76
|
+
- dummy/config/routes.rb
|
77
|
+
- dummy/script/rails
|
78
|
+
- lib/action_dispatch/session/redrails_session_store.rb
|
79
|
+
- lib/redrails-session.rb
|
80
|
+
- lib/redrails/session.rb
|
81
|
+
- lib/redrails/session/middleware.rb
|
82
|
+
- redrails-session.gemspec
|
83
|
+
homepage: https://github.com/zettabyte/redrails-session
|
84
|
+
licenses: []
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 1.8.10
|
104
|
+
signing_key:
|
105
|
+
specification_version: 3
|
106
|
+
summary: Redis session store for rails applications.
|
107
|
+
test_files:
|
108
|
+
- dummy/app/controllers/application_controller.rb
|
109
|
+
- dummy/app/controllers/test_controller.rb
|
110
|
+
- dummy/app/views/layouts/application.html.erb
|
111
|
+
- dummy/app/views/test/index.html.erb
|
112
|
+
- dummy/config.ru
|
113
|
+
- dummy/config/application.rb
|
114
|
+
- dummy/config/boot.rb
|
115
|
+
- dummy/config/environment.rb
|
116
|
+
- dummy/config/environments/development.rb
|
117
|
+
- dummy/config/environments/test.rb
|
118
|
+
- dummy/config/initializers/secret_token.rb
|
119
|
+
- dummy/config/initializers/session_store.rb
|
120
|
+
- dummy/config/routes.rb
|
121
|
+
- dummy/script/rails
|