cookieless 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/Gemfile.lock +1 -1
  2. data/README.rdoc +8 -2
  3. data/VERSION +1 -1
  4. data/lib/cookieless.rb +7 -2
  5. metadata +62 -79
@@ -7,7 +7,7 @@ GEM
7
7
  git (>= 1.2.5)
8
8
  rake
9
9
  nokogiri (1.5.0)
10
- rake (0.9.2)
10
+ rake (0.9.2.2)
11
11
  rcov (0.9.9)
12
12
 
13
13
  PLATFORMS
@@ -11,11 +11,12 @@
11
11
 
12
12
  2, Add it as middleware to your application.rb
13
13
 
14
- config.middleware.insert_before ActionDispatch::Cookies, Rack::Cookieless, :session_id => :si
14
+ config.middleware.insert_before ActionDispatch::Cookies, Rack::Cookieless, :session_id => :si, :noconvert => proc {|env|
15
+ env["HTTP_USER_AGENT"].to_s =~ /Googlebot|bingbot/
16
+ }
15
17
 
16
18
  3, Enjoy it!
17
19
 
18
-
19
20
  == Contributing to cookieless
20
21
 
21
22
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
@@ -26,6 +27,11 @@
26
27
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
27
28
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
28
29
 
30
+ == Contributors
31
+
32
+ * chrisboy333 (https://github.com/chrisboy333)
33
+
34
+
29
35
  == Copyright
30
36
 
31
37
  Copyright (c) 2011 Jinzhu. See LICENSE.txt for
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.3.0
@@ -10,8 +10,9 @@ module Rack
10
10
  def call(env)
11
11
  # have cookies or not
12
12
  support_cookie = env["HTTP_COOKIE"].present?
13
+ noconvert = @options[:noconvert].is_a?(Proc) ? @options[:noconvert].call(env) : false
13
14
 
14
- if support_cookie
15
+ if support_cookie || noconvert
15
16
  @app.call(env)
16
17
  else
17
18
  session_id, cookies = get_cookies_by_query(env["QUERY_STRING"], env) || get_cookies_by_query((URI.parse(env['HTTP_REFERER']).query rescue nil), env)
@@ -24,7 +25,11 @@ module Rack
24
25
  ## fix 3xx redirect
25
26
  header["Location"] = convert_url(header["Location"], session_id) if header["Location"]
26
27
  ## only process html page
27
- response.body = process_body(response.body, session_id) if response.respond_to?(:body)
28
+ if response.respond_to?(:body)
29
+ response.body = process_body(response.body, session_id)
30
+ elsif response.is_a?(Array) and [ActionView::OutputBuffer,String].detect{ |klass| response[0].is_a?(klass)}
31
+ response[0] = process_body(response[0].to_s, session_id)
32
+ end
28
33
  end
29
34
 
30
35
  [status, header, response]
metadata CHANGED
@@ -1,84 +1,69 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cookieless
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 4
9
- version: 0.2.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Jinzhu
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-11-17 00:00:00 +08:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- requirement: &id001 !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- segments:
26
- - 0
27
- version: "0"
12
+ date: 2012-01-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nokogiri
16
+ requirement: &19908960 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
28
22
  type: :runtime
29
- version_requirements: *id001
30
23
  prerelease: false
31
- name: nokogiri
32
- - !ruby/object:Gem::Dependency
33
- requirement: &id002 !ruby/object:Gem::Requirement
34
- requirements:
24
+ version_requirements: *19908960
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &19908180 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
35
30
  - - ~>
36
- - !ruby/object:Gem::Version
37
- segments:
38
- - 1
39
- - 0
40
- - 0
31
+ - !ruby/object:Gem::Version
41
32
  version: 1.0.0
42
33
  type: :development
43
- version_requirements: *id002
44
34
  prerelease: false
45
- name: bundler
46
- - !ruby/object:Gem::Dependency
47
- requirement: &id003 !ruby/object:Gem::Requirement
48
- requirements:
35
+ version_requirements: *19908180
36
+ - !ruby/object:Gem::Dependency
37
+ name: jeweler
38
+ requirement: &19907460 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
49
41
  - - ~>
50
- - !ruby/object:Gem::Version
51
- segments:
52
- - 1
53
- - 6
54
- - 4
42
+ - !ruby/object:Gem::Version
55
43
  version: 1.6.4
56
44
  type: :development
57
- version_requirements: *id003
58
45
  prerelease: false
59
- name: jeweler
60
- - !ruby/object:Gem::Dependency
61
- requirement: &id004 !ruby/object:Gem::Requirement
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- segments:
66
- - 0
67
- version: "0"
46
+ version_requirements: *19907460
47
+ - !ruby/object:Gem::Dependency
48
+ name: rcov
49
+ requirement: &19906860 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
68
55
  type: :development
69
- version_requirements: *id004
70
56
  prerelease: false
71
- name: rcov
72
- description: Cookieless is a rack middleware to make your application works with cookie-less devices/browsers without change your application
57
+ version_requirements: *19906860
58
+ description: Cookieless is a rack middleware to make your application works with cookie-less
59
+ devices/browsers without change your application
73
60
  email: wosmvp@gmail.com
74
61
  executables: []
75
-
76
62
  extensions: []
77
-
78
- extra_rdoc_files:
63
+ extra_rdoc_files:
79
64
  - LICENSE.txt
80
65
  - README.rdoc
81
- files:
66
+ files:
82
67
  - .document
83
68
  - Gemfile
84
69
  - Gemfile.lock
@@ -89,35 +74,33 @@ files:
89
74
  - lib/cookieless.rb
90
75
  - test/helper.rb
91
76
  - test/test_cookieless.rb
92
- has_rdoc: true
93
77
  homepage: http://github.com/jinzhu/cookieless
94
- licenses:
78
+ licenses:
95
79
  - MIT
96
80
  post_install_message:
97
81
  rdoc_options: []
98
-
99
- require_paths:
82
+ require_paths:
100
83
  - lib
101
- required_ruby_version: !ruby/object:Gem::Requirement
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- segments:
106
- - 0
107
- version: "0"
108
- required_rubygems_version: !ruby/object:Gem::Requirement
109
- requirements:
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- segments:
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ segments:
113
91
  - 0
114
- version: "0"
92
+ hash: 3388752389269542739
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
115
99
  requirements: []
116
-
117
100
  rubyforge_project:
118
- rubygems_version: 1.3.6
101
+ rubygems_version: 1.8.10
119
102
  signing_key:
120
103
  specification_version: 3
121
- summary: Cookieless is a rack middleware to make your application works with cookie-less devices/browsers without change your application
104
+ summary: Cookieless is a rack middleware to make your application works with cookie-less
105
+ devices/browsers without change your application
122
106
  test_files: []
123
-