mongo_rack 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/HISTORY CHANGED
@@ -8,4 +8,7 @@ o 0.0.3 / 2010-01-28
8
8
  Bugs and cleanup
9
9
 
10
10
  o 0.0.4 / 2010-02-04
11
- Changed Logger to user global scope
11
+ Changed Logger to user global scope
12
+
13
+ o 0.0.5 / 2010-02-07
14
+ Updated marshaling mechanism. This will require a full session cltn clear!
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ require 'mongo_rack'
15
15
  task :default => 'spec:run'
16
16
 
17
17
  PROJ.name = 'mongo_rack'
18
- PROJ.version = "0.0.4"
18
+ PROJ.version = "0.0.5"
19
19
  PROJ.authors = 'Fernand Galiana'
20
20
  PROJ.email = 'fernand.galiana@gmail.com'
21
21
  PROJ.url = 'http://github.com/derailed/mongo_rack'
@@ -27,7 +27,7 @@ module Rack
27
27
  :server => 'localhost:27017/mongo_session/sessions',
28
28
  :pool_size => 1,
29
29
  :pool_timeout => 1.0,
30
- :log_level => :fatal
30
+ :log_level => :error
31
31
 
32
32
  # Initializes mongo_rack. Pass in options for default override.
33
33
  def initialize(app, options={})
@@ -96,14 +96,15 @@ module Rack
96
96
  return server_desc.first, server_desc.last.to_i, tokens[1], tokens[2]
97
97
  end
98
98
 
99
- # Use YAML to store session objects
99
+ # Marshal session object
100
+ # BOZO !! Marshal will not dump valid strings for mongo - using yaml instead
100
101
  def serialize( ses )
101
- YAML::dump( ses )
102
+ YAML.dump( ses )
102
103
  end
103
104
 
104
- # Session object stored in YAML
105
+ # Hydrate session object
105
106
  def deserialize( buff )
106
- YAML::load( buff )
107
+ YAML.load( buff )
107
108
  end
108
109
 
109
110
  # fetch session with optional session id
@@ -16,7 +16,12 @@ describe Rack::Session::Mongo do
16
16
  env[@session_key]['counter'] ||= 0
17
17
  env[@session_key]['counter'] += 1
18
18
  Rack::Response.new( env[@session_key].inspect ).to_a
19
- end
19
+ end
20
+
21
+ # Clear out old sessions!
22
+ con = Mongo::Connection.new( "localhost", 27017 )
23
+ con.db( @db_name )[@cltn_name].remove
24
+ con.close
20
25
  end
21
26
 
22
27
  it "should connect to a valid server" do
@@ -223,7 +228,7 @@ describe Rack::Session::Mongo do
223
228
  sid = 10
224
229
  ses = { 'a' => 1, 'b' => 2 }
225
230
  @pool.send(:_set_session, @env, sid, ses, @opts )
226
- results = @pool.send(:_get_session, @env, sid )
231
+ results = @pool.send(:_get_session, @env, sid )
227
232
  results.last.should == ses
228
233
  end
229
234
 
@@ -11,7 +11,7 @@ end
11
11
 
12
12
  def mongo_check( res, key, val )
13
13
  session_id = res['Set-Cookie'].match( /^#{@session_key}=(.*?);.*?/ )[1]
14
- result = @sessions.find_one( { :_id => session_id } )
14
+ result = @sessions.find_one( { :_id => session_id } )
15
15
  result.should_not be_nil
16
16
  ses = YAML.load( result['data'] )
17
17
  ses[key.to_s].should == val
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernand Galiana
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-04 00:00:00 -07:00
12
+ date: 2010-02-07 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency