mongrel_page_cache_handler 1.6.7 → 1.6.9

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.
@@ -2,4 +2,4 @@
2
2
  gem_name: mongrel_page_cache_handler
3
3
  package: mongrel_page_cache_handler
4
4
  project: magrathea
5
- version: 1.6.7
5
+ version: 1.6.9
data/lib/utils.rb CHANGED
@@ -19,56 +19,61 @@ module Mongrel
19
19
  end
20
20
  end
21
21
 
22
- def build_full_file_path(request, mk_dirs = false)
23
- File.join(build_directory_path(request, mk_dirs), build_file_name(request))
24
- end
25
-
26
- def build_directory_path(request, mk_dirs = false)
27
- pcd = ActionController::Base.page_cache_directory
28
- dir_path = File.join(pcd, build_path(request))
29
- FileUtils.mkdir_p(dir_path) if mk_dirs
30
- dir_path
31
- end
32
-
33
- def build_file_name(request)
34
- query_params = build_query_params(request)
35
- f_name = ""
36
- query_params.each_pair do |key, value|
37
- f_name << key.to_s
38
- f_name << "_"
39
- f_name << value
40
- f_name << "-"
41
- end
42
- f_name.gsub!(" ", "_")
43
- f_name.downcase!
44
- f_name.chop!
45
- f_name
46
- end
22
+ # def build_full_file_path(request, mk_dirs = false)
23
+ # File.join(build_directory_path(request, mk_dirs), build_file_name(request))
24
+ # end
25
+ #
26
+ # def build_directory_path(request, mk_dirs = false)
27
+ # pcd = ActionController::Base.page_cache_directory
28
+ # dir_path = File.join(pcd, build_path(request))
29
+ # FileUtils.mkdir_p(dir_path) if mk_dirs
30
+ # dir_path
31
+ # end
32
+ #
33
+ # def build_file_name(request)
34
+ # query_params = build_query_params(request)
35
+ # f_name = ""
36
+ # query_params.each_pair do |key, value|
37
+ # f_name << key.to_s
38
+ # f_name << "_"
39
+ # f_name << value
40
+ # f_name << "-"
41
+ # end
42
+ # f_name.gsub!(" ", "_")
43
+ # f_name.downcase!
44
+ # f_name.chop!
45
+ # f_name
46
+ # end
47
47
 
48
48
  def build_cachetastic_key(request)
49
- File.join(build_path(request), build_file_name(request))
50
- end
51
-
52
- def build_query_params(request)
53
- query_string = request.params["QUERY_STRING"]
54
- query_params = {:page => "1"}
55
- unless query_string.blank?
56
- query_string.split("&").sort.each do |pair|
57
- pair_values = pair.split("=")
58
- query_params[pair_values.first.to_sym] = URI.unescape(pair_values.last)
59
- end
60
- end
61
- query_params.delete(:gclid)
62
- query_params
63
- end
64
-
65
- def build_path(request)
66
- path = request.params[Mongrel::Const::PATH_INFO]# + ActionController::Base.page_cache_extension
67
- if path == "/" or path.nil? or path == '' # CHANGEME
68
- path = "/index"
69
- end
49
+ path = request.params[Mongrel::Const::PATH_INFO].downcase.dup
50
+ path = "/" if path.blank?
51
+ path << "?" << request.params["QUERY_STRING"].downcase.dup unless request.params["QUERY_STRING"].blank?
52
+ path.gsub!(/(gclid=.*?)(&|\z)/, '')
70
53
  path
54
+ # File.join(build_path(request), build_file_name(request))
71
55
  end
56
+
57
+ # def build_query_params(request)
58
+ # query_string = request.params["QUERY_STRING"]
59
+ # query_params = {:page => "1"}
60
+ # unless query_string.blank?
61
+ # query_string.split("&").sort.each do |pair|
62
+ # pair_values = pair.split("=")
63
+ # query_params[pair_values.first.to_sym] = URI.unescape(pair_values.last)
64
+ # end
65
+ # end
66
+ # query_params.delete(:gclid)
67
+ # query_params
68
+ # end
69
+ #
70
+ # def build_path(request)
71
+ # path = request.params[Mongrel::Const::PATH_INFO]# + ActionController::Base.page_cache_extension
72
+ # if path == "/" or path.nil? or path == '' # CHANGEME
73
+ # path = "/index"
74
+ # end
75
+ # path
76
+ # end
72
77
 
73
78
  end
74
79
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongrel_page_cache_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7
4
+ version: 1.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2008-01-31 00:00:00 -05:00
22
+ date: 2008-02-07 00:00:00 -05:00
23
23
  default_executable:
24
24
  dependencies: []
25
25