excalibur 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/excalibur.gemspec +1 -1
- data/lib/excalibur/decorator.rb +16 -3
- data/lib/excalibur/version.rb +1 -1
- data/spec/lib/excalibur/decorator_spec.rb +20 -20
- data/spec/lib/excalibur/view_helper_spec.rb +7 -7
- metadata +32 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6118b78c73ab2f18c0c7b709c4d9397972ed4bae
|
4
|
+
data.tar.gz: a5be559d240659697b547950e5e26eb493ab84ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9170c200da2811633a161d6c77759a89f4ba159faaaf757836073de047d204079b9bc89829d056b58e97ad26604a1be14c5652c7cf5cf9a31aad0ab6db1e1da
|
7
|
+
data.tar.gz: ed2d9c76affd094e49c14d88714eb385614d74a1ebb8918a7b9386d9d5f7f2dbb7fe568d33d1495af6716e89c7160a5dbbcabf1cad3c3710add588adac50b808
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/excalibur.svg)](http://badge.fury.io/rb/excalibur)
|
4
4
|
[![Build Status](https://travis-ci.org/yopefonic/excalibur.svg)](https://travis-ci.org/yopefonic/excalibur)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/yopefonic/excalibur/badges/gpa.svg)](https://codeclimate.com/github/yopefonic/excalibur)
|
6
|
+
[![excalibur API Documentation](https://www.omniref.com/ruby/gems/excalibur.png)](https://www.omniref.com/ruby/gems/excalibur)
|
6
7
|
|
7
8
|
Excalibur is a SEO related gem for [Ruby on Rails](rubyonrails.org) that helps
|
8
9
|
you to set the title and meta tags for your site overall and per page in a
|
data/excalibur.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.required_ruby_version = '>= 2.0.0'
|
26
26
|
|
27
|
-
spec.add_dependency 'rails', '
|
27
|
+
spec.add_dependency 'rails', '>= 3.0.0'
|
28
28
|
spec.add_dependency 'draper', '~> 1.3', '>= 1.3.0'
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
data/lib/excalibur/decorator.rb
CHANGED
@@ -13,10 +13,15 @@ module Excalibur
|
|
13
13
|
class << self
|
14
14
|
attr_writer :configuration
|
15
15
|
|
16
|
-
def
|
16
|
+
def exc_init(config = configuration)
|
17
17
|
@configuration = config
|
18
18
|
end
|
19
19
|
|
20
|
+
def excalibur_init(*args)
|
21
|
+
warn '[DEPRECATION] `excalibur_init` is deprecated. Please use `exc_init` instead.'
|
22
|
+
exc_init(*args)
|
23
|
+
end
|
24
|
+
|
20
25
|
def configuration
|
21
26
|
@configuration ||= ::Excalibur.configuration.dup
|
22
27
|
end
|
@@ -26,16 +31,24 @@ module Excalibur
|
|
26
31
|
# excalibur_set_title_combinator, excalibur_set_description_content,
|
27
32
|
# excalibur_set_description_option, excalibur_set_description_combinator
|
28
33
|
def method_missing(meth, *args)
|
29
|
-
if meth.to_s =~ /^
|
34
|
+
if meth.to_s =~ /^exc_(title|description+)_(content|option|combinator+)$/
|
30
35
|
configuration.send($1).send("update_#{$2}", *args)
|
36
|
+
elsif meth.to_s =~ /^excalibur_set_(title|description+)_(content|option|combinator+)$/
|
37
|
+
warn "[DEPRECATION] `excalibur_set_#{$1}_#{$2}` is deprecated. Please use `exc_#{$1}_#{$2}` instead."
|
38
|
+
send("exc_#{$1}_#{$2}", *args)
|
31
39
|
else
|
32
40
|
super
|
33
41
|
end
|
34
42
|
end
|
35
43
|
|
36
|
-
def
|
44
|
+
def exc_meta_tag(type, name, value = nil)
|
37
45
|
configuration.set_meta_tag(type, name, value)
|
38
46
|
end
|
47
|
+
|
48
|
+
def excalibur_set_meta_tag(*args)
|
49
|
+
warn '[DEPRECATION] `excalibur_set_meta_tag` is deprecated. Please use `exc_meta_tag` instead.'
|
50
|
+
exc_meta_tag(*args)
|
51
|
+
end
|
39
52
|
end
|
40
53
|
|
41
54
|
def initialize(object, options = {})
|
data/lib/excalibur/version.rb
CHANGED
@@ -48,17 +48,17 @@ module Excalibur
|
|
48
48
|
DummyDecorator.configuration = nil
|
49
49
|
|
50
50
|
class DummyDecorator < Decorator
|
51
|
-
|
52
|
-
|
51
|
+
exc_meta_tag(:foo, :bar, proc { |obj| 'content' })
|
52
|
+
exc_meta_tag(:name, :other, 'content')
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
exc_title_content(:prefix, 'Exc / ')
|
55
|
+
exc_title_content(:body, 'title body')
|
56
|
+
exc_title_option(:length, 42)
|
57
|
+
exc_title_combinator proc{ |obj| "result #{obj}" }
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
exc_description_content(:body, 'title body')
|
60
|
+
exc_description_option(:length, 42)
|
61
|
+
exc_description_combinator proc{ |obj| "result #{obj}" }
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -79,12 +79,12 @@ module Excalibur
|
|
79
79
|
it { expect(DummyDecorator.configuration.description.combinator.call('foobar')).to eq('result foobar') }
|
80
80
|
end
|
81
81
|
|
82
|
-
describe '::
|
82
|
+
describe '::exc_init' do
|
83
83
|
context 'when creating a decorator' do
|
84
84
|
context 'when setting the config without a value' do
|
85
85
|
before do
|
86
86
|
class DummyDecorator < Decorator
|
87
|
-
|
87
|
+
exc_init
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -95,7 +95,7 @@ module Excalibur
|
|
95
95
|
context 'when setting the config with a value' do
|
96
96
|
before do
|
97
97
|
class DummyDecorator < Decorator
|
98
|
-
|
98
|
+
exc_init true
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -121,12 +121,12 @@ module Excalibur
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
describe '::
|
124
|
+
describe '::exc' do
|
125
125
|
describe '_title' do
|
126
126
|
describe '_content' do
|
127
127
|
it 'should change the title content' do
|
128
128
|
expect {
|
129
|
-
DummyDecorator.
|
129
|
+
DummyDecorator.exc_title_content(:foo, 'bar')
|
130
130
|
}.to change(DummyDecorator.configuration.title, :content).to(body: 'Excalibur', foo: 'bar')
|
131
131
|
end
|
132
132
|
end
|
@@ -134,7 +134,7 @@ module Excalibur
|
|
134
134
|
describe '_option' do
|
135
135
|
it 'should change the title options' do
|
136
136
|
expect {
|
137
|
-
DummyDecorator.
|
137
|
+
DummyDecorator.exc_title_option(:foo, 'bar')
|
138
138
|
}.to change(DummyDecorator.configuration.title, :options).to(length: 69, omission: '...', separator: '', foo: 'bar')
|
139
139
|
end
|
140
140
|
end
|
@@ -142,7 +142,7 @@ module Excalibur
|
|
142
142
|
describe '_combinator' do
|
143
143
|
it 'should change the title combinator' do
|
144
144
|
expect {
|
145
|
-
DummyDecorator.
|
145
|
+
DummyDecorator.exc_title_combinator(true)
|
146
146
|
}.to change(DummyDecorator.configuration.title, :combinator).to(true)
|
147
147
|
end
|
148
148
|
end
|
@@ -152,7 +152,7 @@ module Excalibur
|
|
152
152
|
describe '_content' do
|
153
153
|
it 'should change the description content' do
|
154
154
|
expect {
|
155
|
-
DummyDecorator.
|
155
|
+
DummyDecorator.exc_description_content(:foo, 'bar')
|
156
156
|
}.to change(DummyDecorator.configuration.description, :content).to(body: 'Excalibur; a worthy title for a gem about titles.', foo: 'bar')
|
157
157
|
end
|
158
158
|
end
|
@@ -160,7 +160,7 @@ module Excalibur
|
|
160
160
|
describe '_option' do
|
161
161
|
it 'should change the description options' do
|
162
162
|
expect {
|
163
|
-
DummyDecorator.
|
163
|
+
DummyDecorator.exc_description_option(:foo, 'bar')
|
164
164
|
}.to change(DummyDecorator.configuration.description, :options).to(length: 155, omission: '...', separator: ' ', foo: 'bar')
|
165
165
|
end
|
166
166
|
end
|
@@ -168,7 +168,7 @@ module Excalibur
|
|
168
168
|
describe '_combinator' do
|
169
169
|
it 'should change the description combinator' do
|
170
170
|
expect {
|
171
|
-
DummyDecorator.
|
171
|
+
DummyDecorator.exc_description_combinator(true)
|
172
172
|
}.to change(DummyDecorator.configuration.description, :combinator).to(true)
|
173
173
|
end
|
174
174
|
end
|
@@ -178,7 +178,7 @@ module Excalibur
|
|
178
178
|
it 'should change the meta tags' do
|
179
179
|
expect(DummyDecorator.configuration).to receive(:set_meta_tag).with(:name, :description, 'foobar')
|
180
180
|
|
181
|
-
DummyDecorator.
|
181
|
+
DummyDecorator.exc_meta_tag(:name, :description, 'foobar')
|
182
182
|
end
|
183
183
|
end
|
184
184
|
end
|
@@ -106,8 +106,8 @@ module Excalibur
|
|
106
106
|
|
107
107
|
context 'when the configuration changed' do
|
108
108
|
before do
|
109
|
-
DummyDecorator.
|
110
|
-
DummyDecorator.
|
109
|
+
DummyDecorator.exc_title_content :body, 'New custom title'
|
110
|
+
DummyDecorator.exc_title_content :prefix, '()==|::::::> '
|
111
111
|
|
112
112
|
helpers.entitle(::Dummy.new)
|
113
113
|
end
|
@@ -128,11 +128,11 @@ module Excalibur
|
|
128
128
|
|
129
129
|
context 'when the configuration changed' do
|
130
130
|
before do
|
131
|
-
DummyDecorator.
|
132
|
-
DummyDecorator.
|
133
|
-
DummyDecorator.
|
134
|
-
DummyDecorator.
|
135
|
-
DummyDecorator.
|
131
|
+
DummyDecorator.exc_description_content :body, 'New custom description'
|
132
|
+
DummyDecorator.exc_meta_tag :foo, :bar, 'baz'
|
133
|
+
DummyDecorator.exc_meta_tag :foo, :array, ['foo', 'bar', 'baz']
|
134
|
+
DummyDecorator.exc_meta_tag :foo, :proc, proc { |obj| obj.class.to_s }
|
135
|
+
DummyDecorator.exc_meta_tag :foo, :nil, nil
|
136
136
|
|
137
137
|
helpers.entitle(::Dummy.new)
|
138
138
|
end
|
metadata
CHANGED
@@ -1,155 +1,149 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excalibur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joost Elfering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.0'
|
20
|
-
- - '>='
|
17
|
+
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 3.0.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '3.0'
|
30
|
-
- - '>='
|
24
|
+
- - ">="
|
31
25
|
- !ruby/object:Gem::Version
|
32
26
|
version: 3.0.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: draper
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
|
-
- - ~>
|
31
|
+
- - "~>"
|
38
32
|
- !ruby/object:Gem::Version
|
39
33
|
version: '1.3'
|
40
|
-
- -
|
34
|
+
- - ">="
|
41
35
|
- !ruby/object:Gem::Version
|
42
36
|
version: 1.3.0
|
43
37
|
type: :runtime
|
44
38
|
prerelease: false
|
45
39
|
version_requirements: !ruby/object:Gem::Requirement
|
46
40
|
requirements:
|
47
|
-
- - ~>
|
41
|
+
- - "~>"
|
48
42
|
- !ruby/object:Gem::Version
|
49
43
|
version: '1.3'
|
50
|
-
- -
|
44
|
+
- - ">="
|
51
45
|
- !ruby/object:Gem::Version
|
52
46
|
version: 1.3.0
|
53
47
|
- !ruby/object:Gem::Dependency
|
54
48
|
name: bundler
|
55
49
|
requirement: !ruby/object:Gem::Requirement
|
56
50
|
requirements:
|
57
|
-
- - ~>
|
51
|
+
- - "~>"
|
58
52
|
- !ruby/object:Gem::Version
|
59
53
|
version: '1.6'
|
60
54
|
type: :development
|
61
55
|
prerelease: false
|
62
56
|
version_requirements: !ruby/object:Gem::Requirement
|
63
57
|
requirements:
|
64
|
-
- - ~>
|
58
|
+
- - "~>"
|
65
59
|
- !ruby/object:Gem::Version
|
66
60
|
version: '1.6'
|
67
61
|
- !ruby/object:Gem::Dependency
|
68
62
|
name: rake
|
69
63
|
requirement: !ruby/object:Gem::Requirement
|
70
64
|
requirements:
|
71
|
-
- - ~>
|
65
|
+
- - "~>"
|
72
66
|
- !ruby/object:Gem::Version
|
73
67
|
version: '10.3'
|
74
68
|
type: :development
|
75
69
|
prerelease: false
|
76
70
|
version_requirements: !ruby/object:Gem::Requirement
|
77
71
|
requirements:
|
78
|
-
- - ~>
|
72
|
+
- - "~>"
|
79
73
|
- !ruby/object:Gem::Version
|
80
74
|
version: '10.3'
|
81
75
|
- !ruby/object:Gem::Dependency
|
82
76
|
name: rspec
|
83
77
|
requirement: !ruby/object:Gem::Requirement
|
84
78
|
requirements:
|
85
|
-
- - ~>
|
79
|
+
- - "~>"
|
86
80
|
- !ruby/object:Gem::Version
|
87
81
|
version: '3.0'
|
88
82
|
type: :development
|
89
83
|
prerelease: false
|
90
84
|
version_requirements: !ruby/object:Gem::Requirement
|
91
85
|
requirements:
|
92
|
-
- - ~>
|
86
|
+
- - "~>"
|
93
87
|
- !ruby/object:Gem::Version
|
94
88
|
version: '3.0'
|
95
89
|
- !ruby/object:Gem::Dependency
|
96
90
|
name: generator_spec
|
97
91
|
requirement: !ruby/object:Gem::Requirement
|
98
92
|
requirements:
|
99
|
-
- - ~>
|
93
|
+
- - "~>"
|
100
94
|
- !ruby/object:Gem::Version
|
101
95
|
version: '0.9'
|
102
|
-
- -
|
96
|
+
- - ">="
|
103
97
|
- !ruby/object:Gem::Version
|
104
98
|
version: 0.9.2
|
105
99
|
type: :development
|
106
100
|
prerelease: false
|
107
101
|
version_requirements: !ruby/object:Gem::Requirement
|
108
102
|
requirements:
|
109
|
-
- - ~>
|
103
|
+
- - "~>"
|
110
104
|
- !ruby/object:Gem::Version
|
111
105
|
version: '0.9'
|
112
|
-
- -
|
106
|
+
- - ">="
|
113
107
|
- !ruby/object:Gem::Version
|
114
108
|
version: 0.9.2
|
115
109
|
- !ruby/object:Gem::Dependency
|
116
110
|
name: simplecov
|
117
111
|
requirement: !ruby/object:Gem::Requirement
|
118
112
|
requirements:
|
119
|
-
- - ~>
|
113
|
+
- - "~>"
|
120
114
|
- !ruby/object:Gem::Version
|
121
115
|
version: '0.8'
|
122
|
-
- -
|
116
|
+
- - ">="
|
123
117
|
- !ruby/object:Gem::Version
|
124
118
|
version: 0.8.0
|
125
119
|
type: :development
|
126
120
|
prerelease: false
|
127
121
|
version_requirements: !ruby/object:Gem::Requirement
|
128
122
|
requirements:
|
129
|
-
- - ~>
|
123
|
+
- - "~>"
|
130
124
|
- !ruby/object:Gem::Version
|
131
125
|
version: '0.8'
|
132
|
-
- -
|
126
|
+
- - ">="
|
133
127
|
- !ruby/object:Gem::Version
|
134
128
|
version: 0.8.0
|
135
129
|
- !ruby/object:Gem::Dependency
|
136
130
|
name: pry
|
137
131
|
requirement: !ruby/object:Gem::Requirement
|
138
132
|
requirements:
|
139
|
-
- - ~>
|
133
|
+
- - "~>"
|
140
134
|
- !ruby/object:Gem::Version
|
141
135
|
version: '0.10'
|
142
|
-
- -
|
136
|
+
- - ">="
|
143
137
|
- !ruby/object:Gem::Version
|
144
138
|
version: 0.10.1
|
145
139
|
type: :development
|
146
140
|
prerelease: false
|
147
141
|
version_requirements: !ruby/object:Gem::Requirement
|
148
142
|
requirements:
|
149
|
-
- - ~>
|
143
|
+
- - "~>"
|
150
144
|
- !ruby/object:Gem::Version
|
151
145
|
version: '0.10'
|
152
|
-
- -
|
146
|
+
- - ">="
|
153
147
|
- !ruby/object:Gem::Version
|
154
148
|
version: 0.10.1
|
155
149
|
description: |-
|
@@ -163,9 +157,9 @@ executables: []
|
|
163
157
|
extensions: []
|
164
158
|
extra_rdoc_files: []
|
165
159
|
files:
|
166
|
-
- .gitignore
|
167
|
-
- .rspec
|
168
|
-
- .travis.yml
|
160
|
+
- ".gitignore"
|
161
|
+
- ".rspec"
|
162
|
+
- ".travis.yml"
|
169
163
|
- Gemfile
|
170
164
|
- LICENSE.txt
|
171
165
|
- README.md
|
@@ -202,17 +196,17 @@ require_paths:
|
|
202
196
|
- lib
|
203
197
|
required_ruby_version: !ruby/object:Gem::Requirement
|
204
198
|
requirements:
|
205
|
-
- -
|
199
|
+
- - ">="
|
206
200
|
- !ruby/object:Gem::Version
|
207
201
|
version: 2.0.0
|
208
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
203
|
requirements:
|
210
|
-
- -
|
204
|
+
- - ">="
|
211
205
|
- !ruby/object:Gem::Version
|
212
206
|
version: '0'
|
213
207
|
requirements: []
|
214
208
|
rubyforge_project:
|
215
|
-
rubygems_version: 2.
|
209
|
+
rubygems_version: 2.4.3
|
216
210
|
signing_key:
|
217
211
|
specification_version: 4
|
218
212
|
summary: helper gem to set page title and meta tags in a rails app
|