tophat 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tophat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 2
9
- - 0
10
- version: 1.2.0
4
+ prerelease:
5
+ version: 1.3.0
11
6
  platform: ruby
12
7
  authors:
13
8
  - Steve Agalloco
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-08-29 00:00:00 -04:00
13
+ date: 2011-02-19 00:00:00 -05:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,42 +21,113 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 9
30
- segments:
31
- - 2
32
- - 3
33
- - 5
34
- version: 2.3.5
24
+ version: 3.0.0
35
25
  type: :runtime
36
26
  version_requirements: *id001
37
27
  - !ruby/object:Gem::Dependency
38
- name: shoulda
28
+ name: bundler
39
29
  prerelease: false
40
30
  requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: "1.0"
36
+ type: :development
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: rake
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: "0.8"
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ version: 2.5.0
58
+ type: :development
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: yard
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: "0.6"
69
+ type: :development
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: maruku
73
+ prerelease: false
74
+ requirement: &id006 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: "0.6"
80
+ type: :development
81
+ version_requirements: *id006
82
+ - !ruby/object:Gem::Dependency
83
+ name: simplecov
84
+ prerelease: false
85
+ requirement: &id007 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: "0.3"
91
+ type: :development
92
+ version_requirements: *id007
93
+ - !ruby/object:Gem::Dependency
94
+ name: shoulda
95
+ prerelease: false
96
+ requirement: &id008 !ruby/object:Gem::Requirement
41
97
  none: false
42
98
  requirements:
43
99
  - - ">="
44
100
  - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
101
  version: "0"
49
102
  type: :development
50
- version_requirements: *id002
103
+ version_requirements: *id008
104
+ - !ruby/object:Gem::Dependency
105
+ name: rails
106
+ prerelease: false
107
+ requirement: &id009 !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 3.0.0
113
+ type: :development
114
+ version_requirements: *id009
51
115
  description: simple view helpers for your layouts
52
- email: steve.agalloco@gmail.com
116
+ email:
117
+ - steve.agalloco@gmail.com
53
118
  executables: []
54
119
 
55
120
  extensions: []
56
121
 
57
- extra_rdoc_files:
58
- - LICENSE
59
- - README.textile
122
+ extra_rdoc_files: []
123
+
60
124
  files:
61
125
  - .document
62
126
  - .gitignore
127
+ - .rspec
128
+ - Gemfile
63
129
  - LICENSE
64
- - README.textile
130
+ - README.md
65
131
  - Rakefile
66
132
  - lib/tophat.rb
67
133
  - lib/tophat/meta.rb
@@ -70,22 +136,21 @@ files:
70
136
  - lib/tophat/stylesheet.rb
71
137
  - lib/tophat/title.rb
72
138
  - lib/tophat/version.rb
73
- - rails/init.rb
74
- - test/helper.rb
75
- - test/test_opengraph.rb
76
- - test/test_robots.rb
77
- - test/test_tophat.rb
78
- - test/test_tophat_meta.rb
79
- - test/test_tophat_stylesheets.rb
80
- - test/test_tophat_title.rb
139
+ - spec/spec_helper.rb
140
+ - spec/tophat/meta_helper_spec.rb
141
+ - spec/tophat/opengraph_helper_spec.rb
142
+ - spec/tophat/robots_helper_spec.rb
143
+ - spec/tophat/stylesheet_helper_spec.rb
144
+ - spec/tophat/title_helper_spec.rb
145
+ - spec/tophat_spec.rb
81
146
  - tophat.gemspec
82
147
  has_rdoc: true
83
- homepage: http://github.com/spagalloco/tophat
148
+ homepage: https://github.com/spagalloco/tophat
84
149
  licenses: []
85
150
 
86
151
  post_install_message:
87
- rdoc_options:
88
- - --charset=UTF-8
152
+ rdoc_options: []
153
+
89
154
  require_paths:
90
155
  - lib
91
156
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -93,31 +158,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
158
  requirements:
94
159
  - - ">="
95
160
  - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
161
  version: "0"
100
162
  required_rubygems_version: !ruby/object:Gem::Requirement
101
163
  none: false
102
164
  requirements:
103
165
  - - ">="
104
166
  - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
167
  version: "0"
109
168
  requirements: []
110
169
 
111
170
  rubyforge_project:
112
- rubygems_version: 1.3.7
171
+ rubygems_version: 1.5.0
113
172
  signing_key:
114
173
  specification_version: 3
115
174
  summary: simple view helpers for your layouts
116
175
  test_files:
117
- - test/helper.rb
118
- - test/test_opengraph.rb
119
- - test/test_robots.rb
120
- - test/test_tophat.rb
121
- - test/test_tophat_meta.rb
122
- - test/test_tophat_stylesheets.rb
123
- - test/test_tophat_title.rb
176
+ - spec/spec_helper.rb
177
+ - spec/tophat/meta_helper_spec.rb
178
+ - spec/tophat/opengraph_helper_spec.rb
179
+ - spec/tophat/robots_helper_spec.rb
180
+ - spec/tophat/stylesheet_helper_spec.rb
181
+ - spec/tophat/title_helper_spec.rb
182
+ - spec/tophat_spec.rb
data/README.textile DELETED
@@ -1,123 +0,0 @@
1
- h1. TopHat
2
-
3
- TopHat is a set of view helpers to keep your layouts and views DRY.
4
-
5
- h2. Installation
6
-
7
- To install as a gem, add the following to @config/environment.rb@:
8
-
9
- <pre>
10
- config.gem 'tophat', :version => '>= x.x'
11
- </pre>
12
-
13
- To install as a plugin:
14
-
15
- <pre>
16
- script/plugin install git://github.com/spagalloco/tophat.git
17
- </pre>
18
-
19
-
20
- h2. Layout Usage
21
-
22
- You'll want to add the relevant TopHat helpers to your layouts:
23
-
24
- <pre>
25
- <head>
26
- <%= title :site => "My website" %>
27
- <%= keywords :default => "Some default, keywords, that can be overridden" %>
28
- <%= description :default => "A description" %>
29
- </head>
30
- </pre>
31
-
32
- h2. View Usage
33
-
34
- To set the page title, use the title method to each of your views:
35
-
36
- <pre>
37
- <% title "My page title" %>
38
- </pre>
39
-
40
- When rendered, the page title will be included in your view.
41
-
42
- <pre>
43
- <head>
44
- <title>My website | My page title</title>
45
- </head>
46
- </pre>
47
-
48
- h2. Usage Options
49
-
50
- Use these options to customize the title format:
51
-
52
- * :prefix (text between site name and separator)
53
- * :separator (text used to separate website name from page title)
54
- * :suffix (text between separator and page title)
55
- * :lowercase (when true, the page name will be lowercase)
56
- * :reverse (when true, the page and site names will be reversed)
57
- * :default (default title to use when title is blank)
58
-
59
- And here are a few examples to give you ideas.
60
-
61
- <pre>
62
- <%= title :separator => "&mdash;" %>
63
- <%= title :prefix => false, :separator => ":" %>
64
- <%= title :lowercase => true %>
65
- <%= title :reverse => true, :prefix => false %>
66
- <%= title :default => "The ultimate site for Rails" %>
67
- </pre>
68
-
69
- These options can be set as defaults for your layout, or when setting the title in your views, you can override any of the default settings by passing an optional hash
70
-
71
- <pre>
72
- <% title "My page title", :lowercase => true, :separator => "~" %>
73
- </pre>
74
-
75
- h2. Meta Tag Usage
76
-
77
- TopHat also works with keywords and descriptions. In your view, simply declare the keywords and description.
78
-
79
- <pre>
80
- <% description('You say goodbye, I say hello.') %>
81
- <% keywords('John, Paul, George, Ringo') %>
82
- </pre>
83
-
84
- Keywords can also be passed as an array:
85
-
86
- <pre>
87
- <% keywords(%w{ John Paul George Ringo }) %>
88
- </pre>
89
-
90
- Then in your layout, add the keyword and description helpers:
91
-
92
- <pre>
93
- <%= keywords %>
94
- <%= description %>
95
- </pre>
96
-
97
- which will output the meta-tag:
98
-
99
- <pre>
100
- <meta name="keywords" content="John, Paul, George, Ringo" />
101
- <meta name="description" content="You say goodbye, I say hello." />
102
- </pre>
103
-
104
- keywords and descriptions can also take a default in the layout:
105
-
106
- <pre>
107
- <%= keywords :default => 'default keywords if none are passed' %>
108
- <%= description :default => 'default description if none is passed' %>
109
- </pre>
110
-
111
- h2. Note on Patches/Pull Requests
112
-
113
- * Fork the project.
114
- * Make your feature addition or bug fix.
115
- * Add tests for it. This is important so I don't break it in a
116
- future version unintentionally.
117
- * Commit, do not mess with rakefile, version, or history.
118
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
119
- * Send me a pull request. Bonus points for topic branches.
120
-
121
- h2. Copyright
122
-
123
- Copyright (c) 2010 Steve Agalloco. See LICENSE for details.
data/rails/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'tophat'
data/test/helper.rb DELETED
@@ -1,9 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'action_view'
4
- require 'shoulda'
5
- require 'action_controller'
6
-
7
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
- $LOAD_PATH.unshift(File.dirname(__FILE__))
9
- require 'tophat'
@@ -1,88 +0,0 @@
1
- require 'helper'
2
-
3
- class TopHatOpenGraphTestCase < Test::Unit::TestCase
4
-
5
- context "when using the open graph helpers" do
6
-
7
- setup do
8
- @template = ActionView::Base.new
9
- end
10
-
11
- context "site admins when configured" do
12
-
13
- context "as a string" do
14
-
15
- should "generate a site admin tag" do
16
- @template.opengraph(:admins => '123,124')
17
- assert_equal @template.opengraph, '<meta content="123,124" property="fb:admins" />\n'
18
- end
19
-
20
- end
21
-
22
- context "as an array" do
23
-
24
- should "generate a site admin tag" do
25
- @template.opengraph(:admins => [123, 124])
26
- assert_equal @template.opengraph, '<meta content="123,124" property="fb:admins" />\n'
27
- end
28
-
29
- end
30
-
31
- end
32
-
33
- context "app_id when configured" do
34
-
35
- should "generate an app_id meta tag" do
36
- @template.opengraph(:app_id => 'MyApp')
37
- assert_equal @template.opengraph, '<meta content="MyApp" property="fb:app_id" />\n'
38
- end
39
-
40
- end
41
-
42
- context "additional open graph properties" do
43
-
44
- should "generate tags" do
45
- @template.opengraph do |graph|
46
- graph.title 'The Great Gatsby'
47
- end
48
- assert_equal @template.opengraph, '<meta content="The Great Gatsby" property="og:title" />'
49
- end
50
-
51
- should "allow use of the tag 'type'" do
52
- @template.opengraph do |graph|
53
- graph.type 'sports_team'
54
- end
55
- assert_equal @template.opengraph, '<meta content="sports_team" property="og:type" />'
56
- end
57
-
58
- should "support multiple tags" do
59
- @template.opengraph do |graph|
60
- graph.title 'Austin Powers: International Man of Mystery'
61
- graph.type 'movie'
62
- end
63
- assert_equal @template.opengraph, '<meta content="movie" property="og:type" />\n<meta content="Austin Powers: International Man of Mystery" property="og:title" />\n'
64
- end
65
-
66
- end
67
-
68
- context "combined usage" do
69
- should "generate all tags" do
70
- @template.opengraph(:app_id => 'MyApp', :admins => [123, 1234]) do |graph|
71
- graph.title 'Rain Man'
72
- graph.type 'movie'
73
- end
74
- assert_equal @template.opengraph, '<meta content="MyApp" property="fb:app_id" />\n<meta content="123,1234" property="fb:admins" />\n<meta content="movie" property="og:type" />\n<meta content="Rain Man" property="og:title" />\n'
75
- end
76
-
77
- should "generate all tags - alternative usage" do
78
- @template.opengraph do |graph|
79
- graph.title 'Rain Man'
80
- graph.type 'movie'
81
- end
82
- assert_equal @template.opengraph(:app_id => 'MyApp', :admins => [123, 1234]), '<meta content="MyApp" property="fb:app_id" />\n<meta content="123,1234" property="fb:admins" />\n<meta content="movie" property="og:type" />\n<meta content="Rain Man" property="og:title" />\n'
83
- end
84
- end
85
-
86
- end
87
-
88
- end
data/test/test_robots.rb DELETED
@@ -1,54 +0,0 @@
1
- require 'helper'
2
-
3
- class TopHatRobotsTestCase < Test::Unit::TestCase
4
-
5
- context "using the meta helper" do
6
-
7
- setup do
8
- @template = ActionView::Base.new
9
- end
10
-
11
- context "robots" do
12
-
13
- context "nofollow" do
14
-
15
- should "default to all robots" do
16
- assert_equal @template.nofollow, "<meta content=\"nofollow\" name=\"robots\" />"
17
- end
18
-
19
- should "use a descriptor if one is provided" do
20
- assert_equal @template.nofollow('googlebot'), "<meta content=\"nofollow\" name=\"googlebot\" />"
21
- end
22
-
23
- end
24
-
25
- context "noindex" do
26
-
27
- should "default to all robots" do
28
- assert_equal @template.noindex, "<meta content=\"noindex\" name=\"robots\" />"
29
- end
30
-
31
- should "use a descriptor if one is provided" do
32
- assert_equal @template.noindex('googlebot'), "<meta content=\"noindex\" name=\"googlebot\" />"
33
- end
34
-
35
- end
36
-
37
- context "canonical" do
38
-
39
- should "not render when not passed a path" do
40
- assert_nil @template.canonical
41
- end
42
-
43
- should "render a tag when passed a path" do
44
- assert_equal @template.canonical('http://mysite.com/somepath/'), "<link href=\"http://mysite.com/somepath/\" rel=\"canonical\" />"
45
- end
46
-
47
- end
48
-
49
- end
50
-
51
-
52
- end
53
-
54
- end
data/test/test_tophat.rb DELETED
@@ -1,55 +0,0 @@
1
- require 'helper'
2
-
3
- class TopHatPluginTestCase < Test::Unit::TestCase
4
-
5
- context "loading the TopHat plugin" do
6
-
7
- setup do
8
- @template = ActionView::Base.new
9
- end
10
-
11
- should "be mixed into ActionView::Base" do
12
- assert ActionView::Base.included_modules.include?(TopHat::TitleHelper)
13
- assert ActionView::Base.included_modules.include?(TopHat::MetaHelper)
14
- assert ActionView::Base.included_modules.include?(TopHat::StylesheetHelper)
15
- end
16
-
17
- should "respond to 'title' helper" do
18
- assert @template.respond_to?(:title)
19
- end
20
-
21
- should "respond to 'title' helper alias" do
22
- assert @template.respond_to?(:t)
23
- end
24
-
25
- should "respond to 'description' helper" do
26
- assert @template.respond_to?(:description)
27
- end
28
-
29
- should "respond to 'keywords' helper" do
30
- assert @template.respond_to?(:keywords)
31
- end
32
-
33
- should "respondo to 'ie_5_conditional' helper" do
34
- assert @template.respond_to?(:ie_5_conditional)
35
- end
36
-
37
- should "respondo to 'ie_5_5_conditional' helper" do
38
- assert @template.respond_to?(:ie_5_5_conditional)
39
- end
40
-
41
- should "respondo to 'ie_6_conditional' helper" do
42
- assert @template.respond_to?(:ie_6_conditional)
43
- end
44
-
45
- should "respond to 'ie_7_conditional' helper" do
46
- assert @template.respond_to?(:ie_7_conditional)
47
- end
48
-
49
- should "respond to 'ie_8_conditional' helper" do
50
- assert @template.respond_to?(:ie_8_conditional)
51
- end
52
-
53
- end
54
-
55
- end
@@ -1,76 +0,0 @@
1
- require 'helper'
2
-
3
- class TopHatMetaTestCase < Test::Unit::TestCase
4
-
5
- context "using the meta helper" do
6
-
7
- setup do
8
- @template = ActionView::Base.new
9
- end
10
-
11
- context "keywords" do
12
-
13
- context "defined as an array" do
14
-
15
- setup do
16
- @keywords = %w{ John Paul George Ringo }
17
- end
18
-
19
- should "save keywords" do
20
- assert_equal @template.keywords(@keywords), @keywords.join(', ')
21
- end
22
-
23
- should "use default keywords if keywords is empty" do
24
- assert_equal @template.keywords(:default => @keywords), "<meta content=\"#{@keywords.join(', ')}\" name=\"keywords\" />"
25
- end
26
-
27
- end
28
-
29
- context "defined as a string" do
30
-
31
- setup do
32
- @keywords = "John, Paul, George, Ringo"
33
- end
34
-
35
- should "save keywords" do
36
- assert_equal @template.keywords(@keywords), @keywords
37
- end
38
-
39
- should "use default keywords passed as a string if keywords is empty" do
40
- assert_equal @template.keywords(:default => @keywords), "<meta content=\"#{@keywords}\" name=\"keywords\" />"
41
- end
42
-
43
- end
44
-
45
- should "not return a tag if no default is configured and no keywords are defined" do
46
- assert_nil @template.keywords
47
- end
48
-
49
- should "merge default tags with page tags, when merge_default is set to true" do
50
- @template.keywords("Stu, Pete")
51
- assert_equal @template.keywords(:default => "John, Paul, George, Ringo", :merge_default => true), "<meta content=\"Stu, Pete, John, Paul, George, Ringo\" name=\"keywords\" />"
52
- end
53
-
54
- end
55
-
56
- context "descriptions" do
57
-
58
- should "save the description" do
59
- desc = "Cinderella story. Outta nowhere. A former greenskeeper, now, about to become the Masters champion."
60
- assert_equal @template.description(desc), desc
61
- end
62
-
63
- should "use the default description if no description is defined" do
64
- desc = "A flute without holes, is not a flute. A donut without a hole, is a Danish."
65
- assert_equal @template.description(:default => desc), "<meta content=\"#{desc}\" name=\"description\" />"
66
- end
67
-
68
- should "not return a tag if no default is configured and no description is defined" do
69
- assert_nil @template.description
70
- end
71
-
72
- end
73
-
74
- end
75
-
76
- end