rack-datamapper-session 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,10 @@
1
1
  require 'rack/session/abstract/id'
2
+ require 'dm-core'
2
3
 
3
4
  module Rack
4
5
  module Session
5
- class DataMapperSession
6
- include DataMapper::Resource
6
+ class Rack::Session::DataMapperSession
7
+ include ::DataMapper::Resource
7
8
 
8
9
  property :id, Serial
9
10
  property :sid, String, :length => 128
@@ -28,12 +29,12 @@ module Rack
28
29
 
29
30
  class DataMapper < Abstract::ID
30
31
  def get_session(env, sid)
31
- session = DataMapperSession.first(:sid => sid) if sid
32
+ session = Rack::Session::DataMapperSession.first(:sid => sid) if sid
32
33
 
33
34
  unless sid and session
34
35
  env['rack.errors'].puts("Session '#{sid.inspect}' not found, initializing...") if $VERBOSE and not sid.nil?
35
36
  sid = generate_sid
36
- session = DataMapperSession.new(:sid => sid)
37
+ session = Rack::Session::DataMapperSession.new(:sid => sid)
37
38
  raise 'Unable to store session' unless session.save
38
39
  end
39
40
 
@@ -45,13 +46,13 @@ module Rack
45
46
  expiry = options[:expire_after]
46
47
  expiry = expiry.nil? ? 0 : expiry + 1
47
48
 
48
- session = DataMapperSession.first(:sid => sid) if sid
49
+ session = Rack::Session::DataMapperSession.first(:sid => sid) if sid
49
50
 
50
51
  if options[:renew] or options[:drop]
51
52
  session.destroy
52
53
  return false if options[:drop]
53
54
  sid = generate_sid
54
- session = DataMapperSession.new(:sid => sid)
55
+ session = Rack::Session::DataMapperSession.new(:sid => sid)
55
56
  end
56
57
 
57
58
  session.data = new_session.data
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'rack-datamapper-session'
5
- s.version = '0.1'
5
+ s.version = '0.2'
6
6
 
7
7
  s.authors = ['Phil Pirozhkov']
8
8
  s.date = '2009-11-03'
@@ -12,5 +12,4 @@ Gem::Specification.new do |s|
12
12
  s.summary ='Datamapper session for any Rack based application'
13
13
 
14
14
  s.add_dependency 'rack', '>= 1.0'
15
- s.add_dependency 'dm-core', '>= 0.9'
16
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-datamapper-session
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: "0.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Pirozhkov
@@ -22,16 +22,6 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "1.0"
24
24
  version:
25
- - !ruby/object:Gem::Dependency
26
- name: dm-core
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0.9"
34
- version:
35
25
  description: Datamapper session for any Rack based application. Don't forget to automigrate.
36
26
  email:
37
27
  - pirj@mail.ru