seo_cache 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ee65da1765c3f78ac9f0ede65e7271880378217d20deeed9df1476f524f5c9d
4
- data.tar.gz: 473a51c49bab2d40fab978611b13e872185d89cb834d57352b5ca5cb10aa627d
3
+ metadata.gz: 36c446ef0dc5b6781157d81939f519c60e024ef6b4b0a9709b23f71cf2a96684
4
+ data.tar.gz: 73f5a4fe10538b1292e8482d82f7411da4380ded38bcb13ba3b1565a3267576e
5
5
  SHA512:
6
- metadata.gz: f0c783ce23dd0122988c73e44110fd2173033a67bdf77029d3c5ba57943b6abf343ae141d3c69b46ef1575366b05b185fdcaba50c3709a0b4a1ee99c8f34fa13
7
- data.tar.gz: 9b056081949ce4207f996748d4750fe37c7128afe88341d81a6c2b0ea04f3024f051eabb6fff4cca68f0e7976c1b476076ecce4548a7a510696a04692dbf241d
6
+ metadata.gz: 7e4f9582ca1e55fabd778adedec0cef4f715ea8fa78e3be1fc85a3982f2e4c8a48dfa8954154208735d5a7daf02c7f8da682c8b5f96d008bf5f8a829706d2f77
7
+ data.tar.gz: 2c6c965ec2cb3621f10e91f8cc75bad2d032825dfebe629cf0a023a74382b3676550f9060c68deb110b21429381e5e4127938c2b5aa2da839925436e7ec32ccc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.5
2
+
3
+ - Use correct path for index page with multiple domain names
4
+
1
5
  ## 1.0.4
2
6
 
3
7
  - Add option to populate seo cache for multi-domains
@@ -17,12 +17,12 @@ module SeoCache
17
17
  @redis.get(cache_path(path, extension)) if SeoCache.memory_cache? && @redis
18
18
  end
19
19
 
20
- def cache(content, path, extension = nil, gzip = Zlib::BEST_COMPRESSION)
20
+ def cache(content, path, locale_domain = nil, extension = nil, gzip = Zlib::BEST_COMPRESSION)
21
21
  instrument :write_page, path do
22
22
  if SeoCache.memory_cache? && @redis
23
- write_to_memory(content, cache_path(path, extension))
23
+ write_to_memory(content, cache_path(path, extension, locale_domain))
24
24
  else
25
- write_to_disk(content, cache_path(path, extension), gzip)
25
+ write_to_disk(content, cache_path(path, extension, locale_domain), gzip)
26
26
  end
27
27
  end
28
28
  end
@@ -51,22 +51,22 @@ module SeoCache
51
51
  SeoCache.cache_extension
52
52
  end
53
53
 
54
- def cache_file(path, extension)
54
+ def cache_file(path, extension, locale_domain)
55
55
  name = if path.empty? || path =~ %r{\A/+\z}
56
56
  '/index'
57
57
  else
58
58
  URI::Parser.new.unescape(path.chomp('/'))
59
59
  end
60
60
 
61
- if File.extname(name).empty?
62
- name + (extension || default_extension)
63
- else
64
- name
65
- end
61
+ name = "#{locale_domain}/#{name}" if locale_domain
62
+
63
+ name += extension || default_extension if File.extname(name).empty?
64
+
65
+ name
66
66
  end
67
67
 
68
- def cache_path(path, extension = nil)
69
- File.join(cache_directory, cache_file(path, extension))
68
+ def cache_path(path, extension = nil, locale_domain = nil)
69
+ File.join(cache_directory, cache_file(path, extension, locale_domain))
70
70
  end
71
71
 
72
72
  def write_to_memory(content, path)
@@ -34,7 +34,7 @@ module SeoCache
34
34
 
35
35
  private
36
36
 
37
- def generate_cache(path, locale = nil)
37
+ def generate_cache(path, locale_domain = nil)
38
38
  return if @page_caching.cache_exists?(path) && !@force_cache
39
39
 
40
40
  url = @host + path
@@ -44,8 +44,7 @@ module SeoCache
44
44
  page_source = @page_render.get(url, false)
45
45
  return unless page_source
46
46
 
47
- path_cache_key = locale ? "/#{locale}#{path}" : path
48
- @page_caching.cache(page_source, path_cache_key)
47
+ @page_caching.cache(page_source, path, locale_domain)
49
48
  end
50
49
  end
51
50
  end
@@ -1,3 +1,3 @@
1
1
  module SeoCache
2
- VERSION = '1.0.4'.freeze
2
+ VERSION = '1.0.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seo_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - FloXcoder