site_meta 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .bundle
1
2
  doc
2
3
  pkg
3
4
  *~
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ # A sample Gemfile
2
+ source "http://rubygems.org"
3
+
4
+ gem "rails"
5
+ gem "jeweler"
6
+ gem "gemcutter"
7
+ gem "rspec"
data/Gemfile.lock ADDED
@@ -0,0 +1,84 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ abstract (1.0.0)
5
+ actionmailer (3.0.0)
6
+ actionpack (= 3.0.0)
7
+ mail (~> 2.2.5)
8
+ actionpack (3.0.0)
9
+ activemodel (= 3.0.0)
10
+ activesupport (= 3.0.0)
11
+ builder (~> 2.1.2)
12
+ erubis (~> 2.6.6)
13
+ i18n (~> 0.4.1)
14
+ rack (~> 1.2.1)
15
+ rack-mount (~> 0.6.12)
16
+ rack-test (~> 0.5.4)
17
+ tzinfo (~> 0.3.23)
18
+ activemodel (3.0.0)
19
+ activesupport (= 3.0.0)
20
+ builder (~> 2.1.2)
21
+ i18n (~> 0.4.1)
22
+ activerecord (3.0.0)
23
+ activemodel (= 3.0.0)
24
+ activesupport (= 3.0.0)
25
+ arel (~> 1.0.0)
26
+ tzinfo (~> 0.3.23)
27
+ activeresource (3.0.0)
28
+ activemodel (= 3.0.0)
29
+ activesupport (= 3.0.0)
30
+ activesupport (3.0.0)
31
+ arel (1.0.1)
32
+ activesupport (~> 3.0.0)
33
+ builder (2.1.2)
34
+ erubis (2.6.6)
35
+ abstract (>= 1.0.0)
36
+ gemcutter (0.6.1)
37
+ git (1.2.5)
38
+ i18n (0.4.1)
39
+ jeweler (1.4.0)
40
+ gemcutter (>= 0.1.0)
41
+ git (>= 1.2.5)
42
+ rubyforge (>= 2.0.0)
43
+ json_pure (1.4.6)
44
+ mail (2.2.6.1)
45
+ activesupport (>= 2.3.6)
46
+ mime-types
47
+ treetop (>= 1.4.5)
48
+ mime-types (1.16)
49
+ polyglot (0.3.1)
50
+ rack (1.2.1)
51
+ rack-mount (0.6.13)
52
+ rack (>= 1.0.0)
53
+ rack-test (0.5.4)
54
+ rack (>= 1.0)
55
+ rails (3.0.0)
56
+ actionmailer (= 3.0.0)
57
+ actionpack (= 3.0.0)
58
+ activerecord (= 3.0.0)
59
+ activeresource (= 3.0.0)
60
+ activesupport (= 3.0.0)
61
+ bundler (~> 1.0.0)
62
+ railties (= 3.0.0)
63
+ railties (3.0.0)
64
+ actionpack (= 3.0.0)
65
+ activesupport (= 3.0.0)
66
+ rake (>= 0.8.4)
67
+ thor (~> 0.14.0)
68
+ rake (0.8.7)
69
+ rspec (1.3.0)
70
+ rubyforge (2.0.4)
71
+ json_pure (>= 1.1.7)
72
+ thor (0.14.0)
73
+ treetop (1.4.8)
74
+ polyglot (>= 0.3.1)
75
+ tzinfo (0.3.23)
76
+
77
+ PLATFORMS
78
+ ruby
79
+
80
+ DEPENDENCIES
81
+ gemcutter
82
+ jeweler
83
+ rails
84
+ rspec
data/History.txt CHANGED
@@ -1,3 +1,5 @@
1
+ == 1.0.0
2
+ * Rails 3 only
1
3
  == 0.3.0
2
4
  * Uses tag and content_tag when available (in Rails for example)
3
5
  == 0.2.0
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = site_meta
2
2
 
3
- * http://bragi.github.com/site_meta
3
+ * http://github.com/bragi/site_meta
4
4
 
5
5
  == DESCRIPTION:
6
6
 
@@ -12,6 +12,7 @@ Provides helpers for easy adding of html meta information to Rails applications.
12
12
  * Customize meta tags on per-view basis
13
13
  * Add head title tag with breadcrubms
14
14
  * Add page title
15
+ * Add encoding meta tag
15
16
 
16
17
  == PROBLEMS:
17
18
 
@@ -24,6 +25,7 @@ Use lighthouse to report problems/feature requests:
24
25
  In your layout (haml assumed):
25
26
 
26
27
  %head
28
+ = meta_content_type
27
29
  = meta_description("Default meta description")
28
30
  = meta_keywords("some, default, keywords")
29
31
  = head_title("Site name")
@@ -34,22 +36,39 @@ In your view:
34
36
 
35
37
  - set_meta_description(h(@item.description))
36
38
  - set_meta_keywords(h(@item.tags.join(",")))
37
- - set_head_title([h(@item.title), "Showing item"])
39
+ - set_head_title(h(@item.title), "Showing item")
38
40
  - set_page_title(h(@item.title))
41
+ - set_head_and_page_title((h(@item.title), "Showing item")
39
42
 
40
- == INSTALL:
43
+ == USING:
41
44
 
42
- * sudo gem install bragi-site_meta
45
+ Add following line to your Gemfile
46
+ gem "site_meta", "1.0.0"
47
+
48
+ For Rails 2.3.x you can use version 0.3.0:
49
+
50
+ * <code>gem install site_meta -v "0.3.0"</code>
43
51
  * Add following line to your config/environment.rb
44
52
  Rails::Initializer.run do |config|
45
- config.gem 'bragi-site_meta'
53
+ config.gem 'site_meta', :version => "0.3.0"
46
54
  end
47
55
 
56
+ == CONTRIBUTING:
57
+
58
+ * Fork it.
59
+ * Create a branch (git checkout -b my_new_feature)
60
+ * Install dependencies: <code>$ bundle install</code>
61
+ * Run specs to make sure you start clean : <code>$ bundle exec rake spec</code>
62
+ * Add your feature with specs
63
+ * Commit your changes (git commit -am "Added Snarkdown")
64
+ * Push to the branch (git push origin my_markup)
65
+ * Send pull request
66
+
48
67
  == LICENSE:
49
68
 
50
69
  (The MIT License)
51
70
 
52
- Copyright (c) 2009 Łukasz Piestrzeniewicz
71
+ Copyright (c) 2009, 2010 Łukasz Piestrzeniewicz
53
72
 
54
73
  Permission is hereby granted, free of charge, to any person obtaining
55
74
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -14,6 +14,7 @@ begin
14
14
  gem.email = "bragi@ragnarson.com"
15
15
  gem.homepage = "http://github.com/bragi/site_meta"
16
16
  gem.authors = ["Łukasz Piestrzeniewicz"]
17
+ gem.add_dependency("rails", ">=2.3.5")
17
18
  gem.add_development_dependency "rspec", ">= 1.2.9"
18
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
20
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 1.0.0
@@ -0,0 +1,197 @@
1
+ # Provides helpers for easily adding metadata to your views and layouts.
2
+ #
3
+ # In your layout use helpers +head_title+, +meta_description+, +meta_keywords+
4
+ # with optional defaults. In each view you can override the defaults using
5
+ # helpers +set_head_title+, +set_meta_description+, +set_meta_keywords+.
6
+ #
7
+ # == Providing description meta
8
+ #
9
+ # In your layout use +meta_description+ in head section of HTML with optional
10
+ # default description:
11
+ #
12
+ # %head
13
+ # = meta_description("Site_meta is the easiest way to provide metadata in your Rails application")
14
+ #
15
+ # In each view you can override default setting using +set_meta_description+.
16
+ # In view app/views/pages/show.html.haml
17
+ #
18
+ # - set_meta_description(h(@page.description))
19
+ #
20
+ # == Providing keywords meta
21
+ #
22
+ # In your layout use +meta_keywords+ in head section of HTML with optional
23
+ # list of default keywords:
24
+ #
25
+ # %head
26
+ # = meta_keywords("rails,gem,plugin,ruby,meta,metadata,html")
27
+ #
28
+ # In each view you can override or add keywords using +set_meta_keywords+.
29
+ # In view app/views/pages/show.html.haml
30
+ #
31
+ # - set_meta_keywords(h(@page.tags.join(",")))
32
+ #
33
+ # which will add keywords to the default set or
34
+ #
35
+ # - set_meta_keywords("pricing,information", :replace)
36
+ #
37
+ # to replace the whole list.
38
+ #
39
+ # == Providing title
40
+ #
41
+ # In your layout use +head_title+ in head section and provide last element of
42
+ # breadcrumb trail (usually site name)
43
+ #
44
+ # %head
45
+ # = head_title("Site_meta")
46
+ #
47
+ # In each view you provide title using +set_head_title+, where you can provide
48
+ # more elements of breadcrumbs. In view app/views/pages/show.html.haml
49
+ #
50
+ # - set_head_title(h(@page.title))
51
+ #
52
+ # or in app/views/pages/edit.html.haml
53
+ #
54
+ # - set_head_title("Editing #{h(@page.title)}", "Pages")
55
+ #
56
+ # This will result in title set to:
57
+ #
58
+ # "Page title - Site_meta"
59
+ #
60
+ # in first case and:
61
+ #
62
+ # "Editing Page title - Pages - Site_meta"
63
+ #
64
+ # in second case
65
+ #
66
+ # == Providing title in HTML
67
+ #
68
+ # Title that is presented in the body part of HTML doesn't need the
69
+ # breadcrumbs and may differ from the title presented in HTML head part.
70
+ # Use +page_title+ helper in your layout:
71
+ #
72
+ # %body
73
+ # %h1= page_title
74
+ #
75
+ # In each view set the page title using +set_page_title+ helper. In view
76
+ # app/views/pages/show.html.haml:
77
+ #
78
+ # - set_page_title(h(@page.title))
79
+ #
80
+ # == Providing head and page title at the same time
81
+ #
82
+ # In most situations (like in case of show.html.haml mentioned above) you want
83
+ # to have the same title used as a page title and as a beginning of the
84
+ # breadcrumb trail. In that case use +set_head_and_page_title+ helper.
85
+ # In view app/views/pages/show.html.haml
86
+ #
87
+ # - set_head_and_page_title(h(@page.title), "Pages")
88
+ #
89
+ # This will set page title to first element and set proper trail in head.
90
+ #
91
+ # == Providing encoding
92
+ #
93
+ # To provide encoding information use +meta_content_type+ in your layout use
94
+ #
95
+ # %head
96
+ # = meta_content_type
97
+ #
98
+ # This will provide utf-8 charset by default.
99
+ module SiteMetaHelper
100
+ # Returns meta tag with appropriate encoding specified. +type+ may be any
101
+ # string, it's inserted verbatim. Popular encodings include "utf-8",
102
+ # "iso-8859-1" and others.
103
+ def meta_content_type(type=:utf)
104
+ type = "utf-8" if type == :utf
105
+ meta_tag("Content-Type", "text/html; charset=#{type}", "http-equiv")
106
+ end
107
+
108
+ # Returns string with title tag to use in html head. It uses +default_title+
109
+ # unless you provide breadcrumb elements using +set_head_title+ or
110
+ # +set_head_and_page_title+. Elements of title (with +default_title+
111
+ # being the last one) are joined using +separator+.
112
+ def head_title(default_title, separator=" - ")
113
+ title = [@head_title, default_title].flatten.compact.join(separator)
114
+ title_tag(title)
115
+ end
116
+
117
+ # Returns description meta tag with +default_description+ to use in html
118
+ # head. You can override it on per-view base using +set_meta_description+.
119
+ # Returns nil when +default_description+ is nil and you did not provide one
120
+ # using +set_meta_description+.
121
+ def meta_description(default_description=nil)
122
+ description = @meta_description || default_description
123
+ if description
124
+ meta_tag(:description, description)
125
+ end
126
+ end
127
+
128
+ # Returns keywords meta tag with +default_keywords+ to use in html head.
129
+ # You can override keywords on per-view base using +set_meta_keywords+.
130
+ # Optional +default_keywords+ may be a comma separated string or array of
131
+ # strings. Returns nil when +default_keywords+ is nil and none additional
132
+ # keywords were provided through +set_meta_keywords+.
133
+ def meta_keywords(default_keywords=[])
134
+ merge_mode = @meta_keywords_merge_mode || :merge
135
+ meta_keywords = split_keywords(@meta_keywords)
136
+ keywords = if merge_mode == :merge
137
+ default_keywords = split_keywords(default_keywords)
138
+ (meta_keywords + default_keywords).uniq
139
+ else
140
+ meta_keywords
141
+ end
142
+
143
+ unless keywords.empty?
144
+ meta_tag(:keywords, keywords.join(","))
145
+ end
146
+ end
147
+
148
+ # Returns page title set using +set_page_title+
149
+ def page_title
150
+ @page_title
151
+ end
152
+
153
+ # Sets head title breadcrumbs trail
154
+ def set_head_title(*title)
155
+ @head_title = title.flatten
156
+ end
157
+
158
+ # Sets head title breadcrumbs trail and page title to the leftmost element.
159
+ def set_head_and_page_title(*title)
160
+ title = [title].flatten.compact
161
+ set_head_title title
162
+ set_page_title title.first
163
+ end
164
+
165
+ # Sets page title to use with +page_title+
166
+ def set_page_title(title)
167
+ @page_title = title
168
+ end
169
+
170
+ # Sets meta +description+ to use with +meta_description+.
171
+ def set_meta_description(description)
172
+ @meta_description = description
173
+ end
174
+
175
+ # Sets +keywords+ to use with +meta_keywords+. Optional +merge_mode+ may be
176
+ # set to either :merge (default) or :replace. In the second mode provided
177
+ # keywords are not merged with defaults when output using +meta_keywords+.
178
+ def set_meta_keywords(keywords, merge_mode=:merge)
179
+ raise(ArgumentError, "Allowed merge modes are only :replace, :merge") unless [:replace,:merge].include?(merge_mode)
180
+ @meta_keywords = keywords
181
+ @meta_keywords_merge_mode = merge_mode
182
+ end
183
+
184
+ def split_keywords(keywords) #:nodoc:
185
+ return [] unless keywords
186
+ keywords = keywords.split(",") if keywords.is_a? String
187
+ keywords.flatten.map {|k| k.strip}
188
+ end
189
+
190
+ def meta_tag(name, content, key='name') #:nodoc:
191
+ tag 'meta', key => name, :content => content
192
+ end
193
+
194
+ def title_tag(content) #:nodoc:
195
+ content_tag "title", content
196
+ end
197
+ end
data/lib/site_meta.rb CHANGED
@@ -1,208 +1,3 @@
1
- # Provides helpers for easily adding metadata to your views and layouts.
2
- #
3
- # In your layout use helpers +head_title+, +meta_description+, +meta_keywords+
4
- # with optional defaults. In each view you can override the defaults using
5
- # helpers +set_head_title+, +set_meta_description+, +set_meta_keywords+.
6
- #
7
- # == Providing description meta
8
- #
9
- # In your layout use +meta_description+ in head section of HTML with optional
10
- # default description:
11
- #
12
- # %head
13
- # = meta_description("Site_meta is the easiest way to provide metadata in your Rails application")
14
- #
15
- # In each view you can override default setting using +set_meta_description+.
16
- # In view app/views/pages/show.html.haml
17
- #
18
- # - set_meta_description(h(@page.description))
19
- #
20
- # == Providing keywords meta
21
- #
22
- # In your layout use +meta_keywords+ in head section of HTML with optional
23
- # list of default keywords:
24
- #
25
- # %head
26
- # = meta_keywords("rails,gem,plugin,ruby,meta,metadata,html")
27
- #
28
- # In each view you can override or add keywords using +set_meta_keywords+.
29
- # In view app/views/pages/show.html.haml
30
- #
31
- # - set_meta_keywords(h(@page.tags.join(",")))
32
- #
33
- # which will add keywords to the default set or
34
- #
35
- # - set_meta_keywords("pricing,information", :replace)
36
- #
37
- # to replace the whole list.
38
- #
39
- # == Providing title
40
- #
41
- # In your layout use +head_title+ in head section and provide last element of
42
- # breadcrumb trail (usually site name)
43
- #
44
- # %head
45
- # = head_title("Site_meta")
46
- #
47
- # In each view you provide title using +set_head_title+, where you can provide
48
- # more elements of breadcrumbs. In view app/views/pages/show.html.haml
49
- #
50
- # - set_head_title(h(@page.title))
51
- #
52
- # or in app/views/pages/edit.html.haml
53
- #
54
- # - set_head_title("Editing #{h(@page.title)}", "Pages")
55
- #
56
- # This will result in title set to:
57
- #
58
- # "Page title - Site_meta"
59
- #
60
- # in first case and:
61
- #
62
- # "Editing Page title - Pages - Site_meta"
63
- #
64
- # in second case
65
- #
66
- # == Providing title in HTML
67
- #
68
- # Title that is presented in the body part of HTML doesn't need the
69
- # breadcrumbs and may differ from the title presented in HTML head part.
70
- # Use +page_title+ helper in your layout:
71
- #
72
- # %body
73
- # %h1= page_title
74
- #
75
- # In each view set the page title using +set_page_title+ helper. In view
76
- # app/views/pages/show.html.haml:
77
- #
78
- # - set_page_title(h(@page.title))
79
- #
80
- # == Providing head and page title at the same time
81
- #
82
- # In most situations (like in case of show.html.haml mentioned above) you want
83
- # to have the same title used as a page title and as a beginning of the
84
- # breadcrumb trail. In that case use +set_head_and_page_title+ helper.
85
- # In view app/views/pages/show.html.haml
86
- #
87
- # - set_head_and_page_title(h(@page.title), "Pages")
88
- #
89
- # This will set page title to first element and set proper trail in head.
90
- #
91
- # == Providing encoding
92
- #
93
- # To provide encoding information use +meta_content_type+ in your layout use
94
- #
95
- # %head
96
- # = meta_content_type
97
- #
98
- # This will provide utf-8 charset by default.
99
- module SiteMeta
100
- VERSION = '0.2.0'
1
+ require File.join(File.dirname(__FILE__), 'app', 'helpers','site_meta_helper')
101
2
 
102
- # Returns meta tag with appropriate encoding specified. +type+ may be any
103
- # string, it's inserted verbatim. Popular encodings include "utf-8",
104
- # "iso-8859-1" and others.
105
- def meta_content_type(type=:utf)
106
- type = "utf-8" if type == :utf
107
- meta_tag("Content-Type", "text/html; charset=#{type}", "http-equiv")
108
- end
109
-
110
- # Returns string with title tag to use in html head. It uses +default_title+
111
- # unless you provide breadcrumb elements using +set_head_title+ or
112
- # +set_head_and_page_title+. Elements of title (with +default_title+
113
- # being the last one) are joined using +separator+.
114
- def head_title(default_title, separator=" - ")
115
- title = [@head_title, default_title].flatten.compact.join(separator)
116
- title_tag(title)
117
- end
118
-
119
- # Returns description meta tag with +default_description+ to use in html
120
- # head. You can override it on per-view base using +set_meta_description+.
121
- # Returns nil when +default_description+ is nil and you did not provide one
122
- # using +set_meta_description+.
123
- def meta_description(default_description=nil)
124
- description = @meta_description || default_description
125
- if description
126
- meta_tag(:description, description)
127
- end
128
- end
129
-
130
- # Returns keywords meta tag with +default_keywords+ to use in html head.
131
- # You can override keywords on per-view base using +set_meta_keywords+.
132
- # Optional +default_keywords+ may be a comma separated string or array of
133
- # strings. Returns nil when +default_keywords+ is nil and none additional
134
- # keywords were provided through +set_meta_keywords+.
135
- def meta_keywords(default_keywords=[])
136
- merge_mode = @meta_keywords_merge_mode || :merge
137
- meta_keywords = split_keywords(@meta_keywords)
138
- keywords = if merge_mode == :merge
139
- default_keywords = split_keywords(default_keywords)
140
- (meta_keywords + default_keywords).uniq
141
- else
142
- meta_keywords
143
- end
144
-
145
- unless keywords.empty?
146
- meta_tag(:keywords, keywords.join(","))
147
- end
148
- end
149
-
150
- # Returns page title set using +set_page_title+
151
- def page_title
152
- @page_title
153
- end
154
-
155
- # Sets head title breadcrumbs trail
156
- def set_head_title(*title)
157
- @head_title = title.flatten
158
- end
159
-
160
- # Sets head title breadcrumbs trail and page title to the leftmost element.
161
- def set_head_and_page_title(*title)
162
- title = [title].flatten.compact
163
- set_head_title title
164
- set_page_title title.first
165
- end
166
-
167
- # Sets page title to use with +page_title+
168
- def set_page_title(title)
169
- @page_title = title
170
- end
171
-
172
- # Sets meta +description+ to use with +meta_description+.
173
- def set_meta_description(description)
174
- @meta_description = description
175
- end
176
-
177
- # Sets +keywords+ to use with +meta_keywords+. Optional +merge_mode+ may be
178
- # set to either :merge (default) or :replace. In the second mode provided
179
- # keywords are not merged with defaults when output using +meta_keywords+.
180
- def set_meta_keywords(keywords, merge_mode=:merge)
181
- raise(ArgumentError, "Allowed merge modes are only :replace, :merge") unless [:replace,:merge].include?(merge_mode)
182
- @meta_keywords = keywords
183
- @meta_keywords_merge_mode = merge_mode
184
- end
185
-
186
- def split_keywords(keywords) #:nodoc:
187
- return [] unless keywords
188
- keywords = keywords.split(",") if keywords.is_a? String
189
- keywords.flatten.map {|k| k.strip}
190
- end
191
-
192
- def meta_tag(name, content, key='name') #:nodoc:
193
- if respond_to?(:tag)
194
- tag 'meta', key => name, :content => content
195
- else
196
- "<meta #{key}=\"#{name}\" content=\"#{content}\" />"
197
- end
198
- end
199
-
200
- def title_tag(content) #:nodoc:
201
- if respond_to?(:content_tag)
202
- content_tag "title", content
203
- else
204
- "<title>#{content}</title>"
205
- end
206
- end
207
-
208
- end
3
+ ActionController::Base.helper(SiteMetaHelper)
data/rails/init.rb CHANGED
@@ -1,3 +1 @@
1
- ActionView::Base.class_eval do
2
- include SiteMeta
3
- end
1
+ require 'site_meta'
data/site_meta.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{site_meta}
8
- s.version = "0.3.0"
8
+ s.version = "1.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["\305\201ukasz Piestrzeniewicz"]
12
- s.date = %q{2010-05-20}
12
+ s.date = %q{2010-09-15}
13
13
  s.description = %q{Provides helpers for easy adding of html meta information to Rails applications.
14
14
  * Easily add default description and keywords meta tags.
15
15
  * Customize meta tags on per-view basis
@@ -23,6 +23,8 @@ Gem::Specification.new do |s|
23
23
  s.files = [
24
24
  ".document",
25
25
  ".gitignore",
26
+ "Gemfile",
27
+ "Gemfile.lock",
26
28
  "History.txt",
27
29
  "LICENSE",
28
30
  "Manifest.txt",
@@ -30,6 +32,7 @@ Gem::Specification.new do |s|
30
32
  "Rakefile",
31
33
  "VERSION",
32
34
  "init.rb",
35
+ "lib/app/helpers/site_meta_helper.rb",
33
36
  "lib/site_meta.rb",
34
37
  "rails/init.rb",
35
38
  "script/console",
@@ -44,7 +47,7 @@ Gem::Specification.new do |s|
44
47
  s.homepage = %q{http://github.com/bragi/site_meta}
45
48
  s.rdoc_options = ["--charset=UTF-8"]
46
49
  s.require_paths = ["lib"]
47
- s.rubygems_version = %q{1.3.6}
50
+ s.rubygems_version = %q{1.3.7}
48
51
  s.summary = %q{helpers for easy adding of html meta information in web applications}
49
52
  s.test_files = [
50
53
  "spec/site_meta_spec.rb",
@@ -55,12 +58,15 @@ Gem::Specification.new do |s|
55
58
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
56
59
  s.specification_version = 3
57
60
 
58
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
61
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
62
+ s.add_runtime_dependency(%q<rails>, [">= 2.3.5"])
59
63
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
60
64
  else
65
+ s.add_dependency(%q<rails>, [">= 2.3.5"])
61
66
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
62
67
  end
63
68
  else
69
+ s.add_dependency(%q<rails>, [">= 2.3.5"])
64
70
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
65
71
  end
66
72
  end
@@ -1,7 +1,8 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  class SiteMetaInstance
4
- include SiteMeta
4
+ include ActionView::Helpers::TagHelper
5
+ include SiteMetaHelper
5
6
  end
6
7
 
7
8
  class NilClass
@@ -10,33 +11,19 @@ class NilClass
10
11
  end
11
12
  end
12
13
 
13
- describe SiteMeta do
14
+ describe SiteMetaHelper do
14
15
  before(:each) do
15
16
  @helper = SiteMetaInstance.new
16
17
  end
17
18
 
18
19
  it "should use given name and content for meta tag" do
19
- @helper.meta_tag(:description, "Default").should == '<meta name="description" content="Default" />'
20
+ @helper.meta_tag(:description, "Default").should == '<meta content="Default" name="description" />'
20
21
  end
21
22
 
22
23
  it "should use provided content for title tag" do
23
24
  @helper.title_tag("Content").should == "<title>Content</title>"
24
25
  end
25
26
 
26
- describe "when used in ActionPack context" do
27
- it "should use tag for meta" do
28
- @helper.should_receive(:respond_to?).with(:tag).and_return(true)
29
- @helper.should_receive("tag").with("meta", {"name" => :description, :content => "Default"})
30
- @helper.meta_tag(:description, "Default")
31
- end
32
-
33
- it "should use content_tag for title" do
34
- @helper.should_receive(:respond_to?).with(:content_tag).and_return(true)
35
- @helper.should_receive("content_tag").with("title", "Content")
36
- @helper.title_tag("Content")
37
- end
38
- end
39
-
40
27
  describe "when providing description" do
41
28
  it "should accept empty default description" do
42
29
  @helper.meta_description
data/spec/spec_helper.rb CHANGED
@@ -7,4 +7,5 @@ rescue LoadError
7
7
  end
8
8
 
9
9
  $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'action_controller'
10
11
  require 'site_meta'
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: site_meta
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
7
+ - 1
6
8
  - 0
7
- - 3
8
9
  - 0
9
- version: 0.3.0
10
+ version: 1.0.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - "\xC5\x81ukasz Piestrzeniewicz"
@@ -14,23 +15,41 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-20 00:00:00 +02:00
18
+ date: 2010-09-15 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: rspec
22
+ name: rails
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 9
30
+ segments:
31
+ - 2
32
+ - 3
33
+ - 5
34
+ version: 2.3.5
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: rspec
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 13
27
46
  segments:
28
47
  - 1
29
48
  - 2
30
49
  - 9
31
50
  version: 1.2.9
32
51
  type: :development
33
- version_requirements: *id001
52
+ version_requirements: *id002
34
53
  description: |-
35
54
  Provides helpers for easy adding of html meta information to Rails applications.
36
55
  * Easily add default description and keywords meta tags.
@@ -48,6 +67,8 @@ extra_rdoc_files:
48
67
  files:
49
68
  - .document
50
69
  - .gitignore
70
+ - Gemfile
71
+ - Gemfile.lock
51
72
  - History.txt
52
73
  - LICENSE
53
74
  - Manifest.txt
@@ -55,6 +76,7 @@ files:
55
76
  - Rakefile
56
77
  - VERSION
57
78
  - init.rb
79
+ - lib/app/helpers/site_meta_helper.rb
58
80
  - lib/site_meta.rb
59
81
  - rails/init.rb
60
82
  - script/console
@@ -75,23 +97,27 @@ rdoc_options:
75
97
  require_paths:
76
98
  - lib
77
99
  required_ruby_version: !ruby/object:Gem::Requirement
100
+ none: false
78
101
  requirements:
79
102
  - - ">="
80
103
  - !ruby/object:Gem::Version
104
+ hash: 3
81
105
  segments:
82
106
  - 0
83
107
  version: "0"
84
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
+ none: false
85
110
  requirements:
86
111
  - - ">="
87
112
  - !ruby/object:Gem::Version
113
+ hash: 3
88
114
  segments:
89
115
  - 0
90
116
  version: "0"
91
117
  requirements: []
92
118
 
93
119
  rubyforge_project:
94
- rubygems_version: 1.3.6
120
+ rubygems_version: 1.3.7
95
121
  signing_key:
96
122
  specification_version: 3
97
123
  summary: helpers for easy adding of html meta information in web applications