riak-sessions 0.9.0.beta2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +11 -16
- data/lib/riak/session_store.rb +14 -10
- data/lib/ripple/session_store.rb +2 -2
- data/riak-sessions.gemspec +6 -6
- data/spec/riak_session_store_spec.rb +1 -1
- data/spec/ripple_session_store_spec.rb +1 -1
- metadata +6 -6
data/Rakefile
CHANGED
@@ -19,22 +19,17 @@ gemspec = Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_dependency "riak-client", "~>#{version}"
|
20
20
|
gem.add_dependency "rack", ">=1.0"
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
spec/support/ripple_session_support.rb
|
34
|
-
spec/support/rspec-rails-neuter.rb
|
35
|
-
spec/support/test_server.rb
|
36
|
-
spec/support/test_server.yml.example
|
37
|
-
}
|
22
|
+
files = FileList["**/*"]
|
23
|
+
# Editor and O/S files
|
24
|
+
files.exclude ".DS_Store", "*~", "\#*", ".\#*", "*.swp", "*.tmproj", "tmtags"
|
25
|
+
# Generated artifacts
|
26
|
+
files.exclude "coverage", "rdoc", "pkg", "doc", ".bundle", "*.rbc", ".rvmrc", ".watchr", ".rspec"
|
27
|
+
# Project-specific
|
28
|
+
files.exclude "Gemfile.lock", %r{spec/support/test_server.yml$}, "bin"
|
29
|
+
# Remove directories
|
30
|
+
files.exclude {|d| File.directory?(d) }
|
31
|
+
|
32
|
+
gem.files = files.to_a
|
38
33
|
|
39
34
|
gem.test_files = gem.files.grep(/_spec\.rb$/)
|
40
35
|
end
|
data/lib/riak/session_store.rb
CHANGED
@@ -29,7 +29,7 @@ module Riak
|
|
29
29
|
class SessionStore < Rack::Session::Abstract::ID
|
30
30
|
DEFAULT_OPTIONS = Rack::Session::Abstract::ID::DEFAULT_OPTIONS.merge \
|
31
31
|
:host => "127.0.0.1",
|
32
|
-
:
|
32
|
+
:http_port => 8098,
|
33
33
|
:bucket => "_sessions",
|
34
34
|
:r => 1,
|
35
35
|
:w => 1,
|
@@ -47,15 +47,9 @@ module Riak
|
|
47
47
|
# @see Rack::Session::Abstract::ID#initialize
|
48
48
|
def initialize(app, options={})
|
49
49
|
super
|
50
|
-
@client = Riak::Client.new(default_options.slice(
|
51
|
-
|
52
|
-
|
53
|
-
new_props = {}
|
54
|
-
[:r,:w,:dw,:rw,:n_val].each do |q|
|
55
|
-
new_props[q.to_s] = default_options[q] unless b.send(q) == default_options[q]
|
56
|
-
end
|
57
|
-
b.props = new_props unless new_props.blank?
|
58
|
-
end
|
50
|
+
@client = Riak::Client.new(@default_options.slice(*Riak::Client::VALID_OPTIONS))
|
51
|
+
@bucket = @client.bucket(default_options[:bucket])
|
52
|
+
set_bucket_defaults
|
59
53
|
self
|
60
54
|
end
|
61
55
|
|
@@ -116,5 +110,15 @@ module Riak
|
|
116
110
|
robject.store
|
117
111
|
[session_id, robject.data]
|
118
112
|
end
|
113
|
+
|
114
|
+
private
|
115
|
+
def set_bucket_defaults
|
116
|
+
bucket_opts = @default_options.slice(:r,:w,:dw,:rw,:n_val,:last_write_wins).stringify_keys
|
117
|
+
new_props = bucket_opts.inject({}) do |hash,(k,v)|
|
118
|
+
hash[k] = v unless @bucket.props[k] == v
|
119
|
+
hash
|
120
|
+
end
|
121
|
+
@bucket.props = new_props unless new_props.empty?
|
122
|
+
end
|
119
123
|
end
|
120
124
|
end
|
data/lib/ripple/session_store.rb
CHANGED
@@ -33,9 +33,9 @@ module Ripple
|
|
33
33
|
:n_val => 2,
|
34
34
|
:last_write_wins => false,
|
35
35
|
:host => "127.0.0.1",
|
36
|
-
:
|
36
|
+
:http_port => 8098
|
37
37
|
}.merge(@default_options)
|
38
|
-
@client = Riak::Client.new(@default_options.slice(
|
38
|
+
@client = Riak::Client.new(@default_options.slice(*Riak::Client::VALID_OPTIONS))
|
39
39
|
@bucket = @client.bucket(@default_options[:bucket])
|
40
40
|
set_bucket_defaults
|
41
41
|
end
|
data/riak-sessions.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{riak-sessions}
|
5
|
-
s.version = "0.9.0
|
5
|
+
s.version = "0.9.0"
|
6
6
|
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Sean Cribbs"]
|
9
|
-
s.date = %q{2011-03
|
9
|
+
s.date = %q{2011-04-03}
|
10
10
|
s.description = %q{riak-sessions is a session store backed by Riak, the distributed database by Basho. It includes session implementations for both Rack and Rails 3.}
|
11
11
|
s.email = %q{sean@basho.com}
|
12
12
|
s.files = ["Gemfile", "lib/riak/session_store.rb", "lib/riak-sessions.rb", "lib/ripple/session_store.rb", "Rakefile", "riak-sessions.gemspec", "spec/fixtures/session_autoload_test/session_autoload_test/foo.rb", "spec/riak_session_store_spec.rb", "spec/ripple_session_store_spec.rb", "spec/spec_helper.rb", "spec/support/ripple_session_support.rb", "spec/support/rspec-rails-neuter.rb", "spec/support/test_server.rb", "spec/support/test_server.yml.example"]
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_development_dependency(%q<yajl-ruby>, [">= 0"])
|
26
26
|
s.add_development_dependency(%q<rails>, ["~> 3.0.0"])
|
27
27
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
28
|
-
s.add_runtime_dependency(%q<riak-client>, ["~> 0.9.0
|
28
|
+
s.add_runtime_dependency(%q<riak-client>, ["~> 0.9.0"])
|
29
29
|
s.add_runtime_dependency(%q<rack>, [">= 1.0"])
|
30
30
|
else
|
31
31
|
s.add_dependency(%q<rspec>, ["~> 2.4.0"])
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_dependency(%q<yajl-ruby>, [">= 0"])
|
34
34
|
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
35
35
|
s.add_dependency(%q<rake>, [">= 0"])
|
36
|
-
s.add_dependency(%q<riak-client>, ["~> 0.9.0
|
36
|
+
s.add_dependency(%q<riak-client>, ["~> 0.9.0"])
|
37
37
|
s.add_dependency(%q<rack>, [">= 1.0"])
|
38
38
|
end
|
39
39
|
else
|
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
s.add_dependency(%q<yajl-ruby>, [">= 0"])
|
43
43
|
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
44
44
|
s.add_dependency(%q<rake>, [">= 0"])
|
45
|
-
s.add_dependency(%q<riak-client>, ["~> 0.9.0
|
45
|
+
s.add_dependency(%q<riak-client>, ["~> 0.9.0"])
|
46
46
|
s.add_dependency(%q<rack>, [">= 1.0"])
|
47
47
|
end
|
48
48
|
end
|
@@ -16,7 +16,7 @@ require 'rack/mock'
|
|
16
16
|
|
17
17
|
|
18
18
|
describe Riak::SessionStore do
|
19
|
-
Riak::SessionStore::DEFAULT_OPTIONS[:
|
19
|
+
Riak::SessionStore::DEFAULT_OPTIONS[:http_port] = 9000 if $test_server
|
20
20
|
session_key = Riak::SessionStore::DEFAULT_OPTIONS[:key]
|
21
21
|
session_match = /#{session_key}=([0-9a-fA-F]+);/
|
22
22
|
incrementor = lambda do |env|
|
@@ -21,7 +21,7 @@ describe "Ripple::SessionStore" do
|
|
21
21
|
|
22
22
|
before :each do
|
23
23
|
@app = build_app do |middleware|
|
24
|
-
middleware.use Ripple::SessionStore, :key => '_session_id', :
|
24
|
+
middleware.use Ripple::SessionStore, :key => '_session_id', :http_port => ($test_server ? 9000 : 8098)
|
25
25
|
middleware.delete "ActionDispatch::ShowExceptions"
|
26
26
|
end
|
27
27
|
@app.routes.draw do
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riak-sessions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 0.9.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.9.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sean Cribbs
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03
|
13
|
+
date: 2011-04-03 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - ~>
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.9.0
|
79
|
+
version: 0.9.0
|
80
80
|
type: :runtime
|
81
81
|
version_requirements: *id006
|
82
82
|
- !ruby/object:Gem::Dependency
|
@@ -131,9 +131,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
none: false
|
133
133
|
requirements:
|
134
|
-
- - "
|
134
|
+
- - ">="
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version:
|
136
|
+
version: "0"
|
137
137
|
requirements: []
|
138
138
|
|
139
139
|
rubyforge_project:
|