sinatra-cookie_thief 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sinatra-cookie_thief (0.1.1)
5
+ sinatra (>= 1.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ rack (1.2.2)
11
+ sinatra (1.2.6)
12
+ rack (~> 1.1)
13
+ tilt (< 2.0, >= 1.2.2)
14
+ tilt (1.3)
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ sinatra-cookie_thief!
@@ -9,31 +9,19 @@ Installation and Usage
9
9
 
10
10
  gem install sinatra-cookie_thief
11
11
 
12
- There are two requirements. First, this must be registered before the cookie middleware is added. Second, you must use Rack::Session::Cookie directly (cannot use enable :sessions). This is because CookieThief must be loaded before the Cookie middleware, and Sinatra internally loads Cookie first.
13
-
14
12
  For classic-style:
15
13
 
16
14
  require 'sinatra'
17
15
  require 'sinatra/cookie_thief'
18
16
  register Sinatra::CookieThief
19
- use Rack::Session::Cookie, :key => 'app.session', :path => '/', :expire_after => 2592000, :secret => 'PUT SOMETHING HERE!'
17
+ enable :sessions
20
18
 
21
19
  For classy-style:
22
20
 
23
21
  require 'sinatra/base'
24
22
  class App < Sinatra::Base
25
23
  register Sinatra::CookieThief
26
- use Rack::Session::Cookie, :key => 'app.session', :path => '/', :expire_after => 2592000, :secret => 'PUT SOMETHING HERE!'
27
- end
28
-
29
- Another warning: DO NOT USE SINATRA'S INTERNAL SESSIONS (enable :sessions)! CookieThief must be placed before sessions in the middleware chain, and Sinatra loads its internal middleware first. You shouldn't use it anyways because it doesn't create an encryption key for you, which is a bad security issue.
30
-
31
- DO NOT DO THIS:
32
-
33
- require 'sinatra/base'
34
- class App < Sinatra::Base
35
- register Sinatra::CookieThief
36
- enable :sessions # BAD! WILL NOT WORK! Must use use Rack::Session::Cookie directly.
24
+ enable :sessions
37
25
  end
38
26
 
39
27
  Improvements
@@ -3,9 +3,9 @@ require File.join(File.join(File.expand_path(File.dirname(__FILE__))), '..', 'ra
3
3
 
4
4
  module Sinatra
5
5
  module CookieThief
6
- def self.registered(app)
7
- raise ArgumentError, 'Cannot use sessions directly from Sinatra with CookieThief because it needs to happen before Session::Cookie. See the README.' if app.sessions?
8
- app.use Rack::CookieThief
6
+ def setup_sessions(builder)
7
+ builder.use Rack::CookieThief
8
+ super
9
9
  end
10
10
  end
11
11
  register CookieThief
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-cookie_thief
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease:
5
- version: 0.1.0
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
6
11
  platform: ruby
7
12
  authors:
8
13
  - Kyle Drake
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-04-30 00:00:00 -07:00
18
+ date: 2011-05-09 00:00:00 -07:00
14
19
  default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
@@ -21,6 +26,10 @@ dependencies:
21
26
  requirements:
22
27
  - - ">="
23
28
  - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 1
32
+ - 0
24
33
  version: "1.0"
25
34
  type: :runtime
26
35
  version_requirements: *id001
@@ -37,6 +46,8 @@ files:
37
46
  - lib/sinatra/cookie_thief.rb
38
47
  - lib/rack/cookie_thief.rb
39
48
  - test/public/hagio.jpg
49
+ - Gemfile
50
+ - Gemfile.lock
40
51
  - README.markdown
41
52
  has_rdoc: true
42
53
  homepage: https://github.com/kyledrake/sinatra-cookie_thief
@@ -52,17 +63,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
63
  requirements:
53
64
  - - ">="
54
65
  - !ruby/object:Gem::Version
66
+ hash: 3
67
+ segments:
68
+ - 0
55
69
  version: "0"
56
70
  required_rubygems_version: !ruby/object:Gem::Requirement
57
71
  none: false
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
61
78
  version: "0"
62
79
  requirements: []
63
80
 
64
81
  rubyforge_project: sinatra-cookie_thief
65
- rubygems_version: 1.5.2
82
+ rubygems_version: 1.6.2
66
83
  signing_key:
67
84
  specification_version: 3
68
85
  summary: Rack middleware to disable cookies when static content is being served.