tophat 1.4.0 → 1.5.0
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.
- data/lib/tophat/meta.rb +2 -0
- data/lib/tophat/robots.rb +6 -2
- data/lib/tophat/version.rb +1 -1
- data/spec/tophat/meta_helper_spec.rb +8 -0
- data/spec/tophat/robots_helper_spec.rb +12 -0
- metadata +18 -18
data/lib/tophat/meta.rb
CHANGED
@@ -4,6 +4,7 @@ module TopHat
|
|
4
4
|
# page descriptions
|
5
5
|
# <meta name="description" content="Description goes here." />
|
6
6
|
def description(options={})
|
7
|
+
options ||= {}
|
7
8
|
if options.is_a? String
|
8
9
|
TopHat.current['description'] = options
|
9
10
|
|
@@ -18,6 +19,7 @@ module TopHat
|
|
18
19
|
# keywords
|
19
20
|
# <meta name="keywords" content="Keywords go here." />
|
20
21
|
def keywords(options={})
|
22
|
+
options ||= {}
|
21
23
|
if options.is_a?(String)
|
22
24
|
TopHat.current['keywords'] = options
|
23
25
|
|
data/lib/tophat/robots.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
module TopHat
|
2
2
|
module RobotsHelper
|
3
3
|
|
4
|
-
|
4
|
+
DEFAULT_DESCRIPTOR = 'robots'
|
5
|
+
|
6
|
+
def noindex(descriptor=DEFAULT_DESCRIPTOR)
|
7
|
+
descriptor ||= DEFAULT_DESCRIPTOR
|
5
8
|
tag(:meta, :name => descriptor, :content => 'noindex')
|
6
9
|
end
|
7
10
|
|
8
|
-
def nofollow(descriptor=
|
11
|
+
def nofollow(descriptor=DEFAULT_DESCRIPTOR)
|
12
|
+
descriptor ||= DEFAULT_DESCRIPTOR
|
9
13
|
tag(:meta, :name => descriptor, :content => 'nofollow')
|
10
14
|
end
|
11
15
|
|
data/lib/tophat/version.rb
CHANGED
@@ -39,6 +39,10 @@ describe TopHat::MetaHelper do
|
|
39
39
|
@template.keywords.should be_nil
|
40
40
|
end
|
41
41
|
|
42
|
+
it "doesn't blow up on nil" do
|
43
|
+
@template.keywords(nil).should be_nil
|
44
|
+
end
|
45
|
+
|
42
46
|
it "should merge default tags with page tags, when merge_default is set to true" do
|
43
47
|
@template.keywords("Stu, Pete")
|
44
48
|
@template.keywords(:default => "John, Paul, George, Ringo", :merge_default => true).should == "<meta content=\"Stu, Pete, John, Paul, George, Ringo\" name=\"keywords\" />"
|
@@ -56,6 +60,10 @@ describe TopHat::MetaHelper do
|
|
56
60
|
@template.description(:default => desc).should == "<meta content=\"#{desc}\" name=\"description\" />"
|
57
61
|
end
|
58
62
|
|
63
|
+
it "doesn't blow up on nil" do
|
64
|
+
@template.description(nil).should be_nil
|
65
|
+
end
|
66
|
+
|
59
67
|
it "should not return a tag if no default is configured and no description is defined" do
|
60
68
|
@template.description.should be_nil
|
61
69
|
end
|
@@ -14,6 +14,10 @@ describe TopHat::RobotsHelper do
|
|
14
14
|
it "should use a descriptor if one is provided" do
|
15
15
|
@template.nofollow('googlebot').should == "<meta content=\"nofollow\" name=\"googlebot\" />"
|
16
16
|
end
|
17
|
+
|
18
|
+
it "doesn't blow up on nil" do
|
19
|
+
@template.nofollow(nil).should == "<meta content=\"nofollow\" name=\"robots\" />"
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
23
|
describe ".noindex" do
|
@@ -24,6 +28,10 @@ describe TopHat::RobotsHelper do
|
|
24
28
|
it "should use a descriptor if one is provided" do
|
25
29
|
@template.noindex('googlebot').should == "<meta content=\"noindex\" name=\"googlebot\" />"
|
26
30
|
end
|
31
|
+
|
32
|
+
it "doesn't blow up on nil" do
|
33
|
+
@template.noindex(nil).should == "<meta content=\"noindex\" name=\"robots\" />"
|
34
|
+
end
|
27
35
|
end
|
28
36
|
|
29
37
|
describe ".canonical" do
|
@@ -34,6 +42,10 @@ describe TopHat::RobotsHelper do
|
|
34
42
|
it "should render a tag when passed a path" do
|
35
43
|
@template.canonical('http://mysite.com/somepath/').should == "<link href=\"http://mysite.com/somepath/\" rel=\"canonical\" />"
|
36
44
|
end
|
45
|
+
|
46
|
+
it "doesn't blow up on nil" do
|
47
|
+
@template.canonical(nil).should be_nil
|
48
|
+
end
|
37
49
|
end
|
38
50
|
|
39
51
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tophat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-14 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
16
|
-
requirement: &
|
16
|
+
requirement: &70226951969300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70226951969300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70226951967240 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.9'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70226951967240
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70226951956180 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '2.7'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70226951956180
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yard
|
49
|
-
requirement: &
|
49
|
+
requirement: &70226951954820 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0.7'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70226951954820
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rdiscount
|
60
|
-
requirement: &
|
60
|
+
requirement: &70226951953100 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '1.6'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70226951953100
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
|
-
requirement: &
|
71
|
+
requirement: &70226951951360 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0.5'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70226951951360
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rails
|
82
|
-
requirement: &
|
82
|
+
requirement: &70226951950300 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 3.0.0
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70226951950300
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: guard-rspec
|
93
|
-
requirement: &
|
93
|
+
requirement: &70226951949340 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0.5'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70226951949340
|
102
102
|
description: Simple view helpers for your layouts
|
103
103
|
email:
|
104
104
|
- steve.agalloco@gmail.com
|