metaslug 0.3.3 → 0.3.4
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 862c620b8ece775c0dec31c3831bf28ff8721acb
|
4
|
+
data.tar.gz: 008617364acc3c289e241a63ea57ae20225e98b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f533304e7b0b308ba29620e90238bbae7cc4f22f7220ecace2812ac61262cb1f1932692d4dce7a993d7cb43d64fdabc03f0d8221acc731e6e59e61f4241f6878
|
7
|
+
data.tar.gz: 7925c12e76a0be072167ce32a4c5d16e4476c775a387f8b34525953c5d8765a7a1397af20aacd5896ddc9bcb79cab71b7d41d7b153230ee62b084c341c482b81
|
data/README.md
CHANGED
@@ -46,10 +46,10 @@ en:
|
|
46
46
|
This generator takes options. For example:
|
47
47
|
|
48
48
|
~~~
|
49
|
-
bundle exec rails g metaslug:locale -l
|
49
|
+
bundle exec rails g metaslug:locale -l de -o -m description,keywords,title
|
50
50
|
~~~
|
51
51
|
|
52
|
-
will
|
52
|
+
will generate a file for de locale. `-o` specifies to only print content on the console while `-m` takes your metas (defaults are title and description).
|
53
53
|
|
54
54
|
On development mode, translations are reloaded for each request, not in the other environments.
|
55
55
|
|
@@ -49,14 +49,14 @@ module Metaslug
|
|
49
49
|
def set_metas_for_current_path
|
50
50
|
locale_metas_storage.keys.each do |k|
|
51
51
|
if request.path.match(translate_key_into_regexp(k))
|
52
|
-
set_metas_from_hash(locale_metas_storage[k])
|
52
|
+
set_metas_from_hash(locale_metas_storage[k].dup)
|
53
53
|
return
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
# if no key match the current path, load default metas if present.
|
58
58
|
if locale_metas_storage.has_key?('default')
|
59
|
-
set_metas_from_hash(locale_metas_storage['default'])
|
59
|
+
set_metas_from_hash(locale_metas_storage['default'].dup)
|
60
60
|
else
|
61
61
|
set_metas_from_hash({})
|
62
62
|
end
|
data/lib/metaslug/version.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class MetasTest < ActionDispatch::IntegrationTest
|
4
|
+
include Metaslug::ActionControllerExtension
|
4
5
|
fixtures :all
|
5
6
|
|
6
7
|
test "title when visiting categories path with en locale" do
|
@@ -88,4 +89,13 @@ class MetasTest < ActionDispatch::IntegrationTest
|
|
88
89
|
assert_selector("meta[property='twitter:title'][content='Twitter title']", visible: false)
|
89
90
|
assert_selector("meta[property='twitter:url'][content='Twitter url']", visible: false)
|
90
91
|
end
|
92
|
+
|
93
|
+
test "visit a page with metas interpolation should not modify the loaded YAML" do
|
94
|
+
visit post_path(posts(:phone), locale: :en)
|
95
|
+
# title must be evaluated
|
96
|
+
assert_title "Phone article"
|
97
|
+
|
98
|
+
# stored value must no be evaluated, it should still be the liquid template
|
99
|
+
assert_equal("{{post.title}}", metas_storage["en"]["/posts/:id"]["title"])
|
100
|
+
end
|
91
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metaslug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Catty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -272,3 +272,4 @@ test_files:
|
|
272
272
|
- test/dummy/test/integration/metas_test.rb
|
273
273
|
- test/metaslug_test.rb
|
274
274
|
- test/test_helper.rb
|
275
|
+
has_rdoc:
|