rack-session-dbm 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,12 +1,21 @@
1
1
  = rack-session-gdbm
2
2
 
3
- A Rack-based session store with GDBM. Take it easy to use sessions!
3
+ A Rack-based session store with SDBM/GDBM. Take it easy to use sessions!
4
4
 
5
5
  == Introduction
6
6
 
7
+ * just bundle:
8
+
9
+ gem 'rack-session-dbm'
10
+
11
+ * then +use Rack::Session::SDBM(, CUSTOMIZED_GDBM_FILE_PATH)+
12
+
13
+ === To use GDBM...
14
+
7
15
  * install libgdbm-dev or something like that before you build ruby
8
16
  * (re)install ruby or run setup.rb on your gdbm lib dir
9
- * use Rack::Session::GDBM(, CUSTOMIZED_GDBM_FILE_PATH)
17
+ * bundle as above
18
+ * +use Rack::Session::GDBM(, CUSTOMIZED_GDBM_FILE_PATH)+
10
19
 
11
20
  TODO more complete manual...
12
21
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -0,0 +1 @@
1
+ sessions*
data/examples/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source :rubygems
2
+ gem 'rack-session-dbm', :path => '../'
3
+ gem 'haml'
4
+ gem 'sinatra'
5
+ gem 'rack-flash'
@@ -0,0 +1,26 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ rack-session-dbm (0.1.2)
5
+ rack (>= 1.1.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ haml (3.1.2)
11
+ rack (1.3.2)
12
+ rack-flash (0.1.2)
13
+ rack
14
+ sinatra (1.2.6)
15
+ rack (~> 1.1)
16
+ tilt (< 2.0, >= 1.2.2)
17
+ tilt (1.3.2)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ haml
24
+ rack-flash
25
+ rack-session-dbm!
26
+ sinatra
@@ -0,0 +1,60 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.require
4
+
5
+ ROOT = File.expand_path('../', __FILE__)
6
+
7
+ use Rack::Session::SDBM, "#{ROOT}/sessions.sdbm"
8
+ use Rack::Flash
9
+
10
+ get '/' do
11
+ session[:accessed] ||= 0
12
+ session[:accessed] += 1
13
+ @dump = session.inspect
14
+ haml :index
15
+ end
16
+
17
+ post '/keys' do
18
+ session[params[:key]] = params[:value]
19
+ flash[:notice] = "set session[#{params[:key].inspect}] = #{params[:value].inspect}"
20
+ redirect "/"
21
+ end
22
+
23
+ delete '/keys' do
24
+ session.delete params[:key]
25
+ flash[:notice] = "deleet session[#{params[:key].inspect}]"
26
+ redirect "/"
27
+ end
28
+
29
+ helpers do
30
+ def h(str)
31
+ CGI.escapeHTML(str)
32
+ end
33
+ end
34
+
35
+ __END__
36
+ @@ layout
37
+ !!! 5
38
+ %html
39
+ %head
40
+ %title sample
41
+ %body
42
+ = yield
43
+
44
+ @@index
45
+ #main
46
+ - if flash[:notice]
47
+ %p#flash=h flash[:notice]
48
+ %h1 rack-session-sdbm sample
49
+ %h2 session dump is below
50
+ %pre=h @dump
51
+ %h2 set session value
52
+ %form{:method => "post", :action => "/keys"}
53
+ %input{:name => "key", :type => "text", :size => 15}
54
+ %input{:name => "value", :type => "text", :size => 45}
55
+ %input{:type => "submit"}
56
+ %h2 delete session value
57
+ %form{:method => "post", :action => "/keys"}
58
+ %input{:name => "_method", :type => "hidden", :value => "delete"}
59
+ %input{:name => "key", :type => "text", :size => 15}
60
+ %input{:type => "submit"}
@@ -9,7 +9,7 @@ module Rack
9
9
  super(app, options)
10
10
 
11
11
  @mutex = Mutex.new
12
- db_path = path || (ENV['RACK_ROOT'] ? ::File.join(ENV['RACK_ROOT'], 'tmp', default_session_file) : @default_options[:dbm_path])
12
+ db_path = path || (defined?(RACK_ROOT) ? ::File.join(RACK_ROOT, 'tmp', default_session_file) : @default_options[:dbm_path])
13
13
  opts = @default_options
14
14
 
15
15
  @pool = dbklass.new(db_path)
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rack-session-dbm}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Uchio Kondo"]
@@ -25,6 +25,10 @@ Gem::Specification.new do |s|
25
25
  "README.rdoc",
26
26
  "Rakefile",
27
27
  "VERSION",
28
+ "examples/.gitignore",
29
+ "examples/Gemfile",
30
+ "examples/Gemfile.lock",
31
+ "examples/with-sinatra.rb",
28
32
  "lib/rack-session-dbm.rb",
29
33
  "lib/rack/session/abstract_dbm.rb",
30
34
  "lib/rack/session/gdbm.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-session-dbm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
17
- requirement: &24855720 !ruby/object:Gem::Requirement
17
+ requirement: &12738200 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 1.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *24855720
25
+ version_requirements: *12738200
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &24855240 !ruby/object:Gem::Requirement
28
+ requirement: &12737720 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 2.3.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *24855240
36
+ version_requirements: *12737720
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &24854760 !ruby/object:Gem::Requirement
39
+ requirement: &12737240 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *24854760
47
+ version_requirements: *12737240
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: jeweler
50
- requirement: &24854280 !ruby/object:Gem::Requirement
50
+ requirement: &12736760 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.6.4
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *24854280
58
+ version_requirements: *12736760
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rcov
61
- requirement: &24853800 !ruby/object:Gem::Requirement
61
+ requirement: &12736280 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *24853800
69
+ version_requirements: *12736280
70
70
  description: A rack-based session store on sdbm/gdbm. you can use this gem in smaller
71
71
  projects.
72
72
  email: udzura@udzura.jp
@@ -84,6 +84,10 @@ files:
84
84
  - README.rdoc
85
85
  - Rakefile
86
86
  - VERSION
87
+ - examples/.gitignore
88
+ - examples/Gemfile
89
+ - examples/Gemfile.lock
90
+ - examples/with-sinatra.rb
87
91
  - lib/rack-session-dbm.rb
88
92
  - lib/rack/session/abstract_dbm.rb
89
93
  - lib/rack/session/gdbm.rb
@@ -107,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
111
  version: '0'
108
112
  segments:
109
113
  - 0
110
- hash: 2371025864029867347
114
+ hash: -3335380391279363148
111
115
  required_rubygems_version: !ruby/object:Gem::Requirement
112
116
  none: false
113
117
  requirements: