metanol 0.0.1
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/.gitignore +19 -0
- data/Gemfile +11 -0
- data/LICENSE.txt +22 -0
- data/README.md +73 -0
- data/Rakefile +1 -0
- data/lib/metanol.rb +8 -0
- data/lib/metanol/engine.rb +4 -0
- data/lib/metanol/engine_controller.rb +81 -0
- data/lib/metanol/helpers.rb +46 -0
- data/lib/metanol/meta/base.rb +24 -0
- data/lib/metanol/meta/main.rb +9 -0
- data/lib/metanol/meta/open_graph.rb +21 -0
- data/lib/metanol/meta/webmaster.rb +22 -0
- data/lib/metanol/railtie.rb +8 -0
- data/lib/metanol/version.rb +3 -0
- data/metanol.gemspec +26 -0
- data/spec/controllers/home_controller_spec.rb +32 -0
- data/spec/controllers/tests_controller_spec.rb +81 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/support/application.rb +48 -0
- metadata +89 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Eugene Kondratyuk
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Metanol
|
2
|
+
|
3
|
+
This is a meta tags plugin which helps to manage meta tags in your Rails application. It supports some OpenGraph meta tags, Webmaster's meta tags (such as Google, Bing, Yandex, Alexa verification meta tags) and other standard HTML meta tags (such as a description). It can be used by Rails 3.2+ applications.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'metanol'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install metanol
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
There are two ways to set meta tags. The first one is a setting values for meta tags in a controller:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
class HomeController < ApplicationController
|
25
|
+
og_meta :type, 'website'
|
26
|
+
og_meta :locale, 'uk_UA'
|
27
|
+
|
28
|
+
wm_meta :alexa, 'alexa code'
|
29
|
+
wm_meta :bing, 'bing code'
|
30
|
+
wm_meta :google, 'google code'
|
31
|
+
wm_meta :yandex, 'yandex code'
|
32
|
+
|
33
|
+
def new
|
34
|
+
render :inline => <<-ERB
|
35
|
+
<%= metanol_wm_tags %>
|
36
|
+
ERB
|
37
|
+
end
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
The second one is a setting values for meta tags in a controller's action:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
class TestsController < ApplicationController
|
45
|
+
def index
|
46
|
+
meta :title, "Users List"
|
47
|
+
meta :description, "Description for a users list"
|
48
|
+
og_meta title: "OpenGraph Title", description: "OpenGraph Description"
|
49
|
+
render :inline => <<-ERB
|
50
|
+
<%= metanol_main_tags %>
|
51
|
+
ERB
|
52
|
+
end
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
There are three methods for setting values for meta tags:
|
57
|
+
* `meta(meta_name, value) or meta({meta_name: value, meta_name2: value2, ...})` - sets a value(s) for common meta tags
|
58
|
+
* `og_meta` - sets a value(s) for OpenGraph's meta tags
|
59
|
+
* `wm_meta` - sets a value(s) for Webmaster verification's meta tags
|
60
|
+
|
61
|
+
Here is the helper's methods for rendering meta tags:
|
62
|
+
* `metanol_tags` - renders all meta tags (Webmaster, OpenGraph and other)
|
63
|
+
* `metanol_og_tags` - renders only OpenGraph's meta tags
|
64
|
+
* `metanol_wm_tags` - renders Webmaster verification tags
|
65
|
+
* `metanol_main_tags` - renders other meta tags, such as keywords, description, etc.
|
66
|
+
|
67
|
+
## Contributing
|
68
|
+
|
69
|
+
1. Fork it
|
70
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
71
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
72
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
73
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/metanol.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'meta/base')
|
2
|
+
require File.join(File.dirname(__FILE__), 'meta/main')
|
3
|
+
require File.join(File.dirname(__FILE__), 'meta/open_graph')
|
4
|
+
require File.join(File.dirname(__FILE__), 'meta/webmaster')
|
5
|
+
require 'active_support/dependencies'
|
6
|
+
|
7
|
+
module Metanol
|
8
|
+
|
9
|
+
# Engine's controller which has all methods for storing and processing meta tag's data
|
10
|
+
module EngineController
|
11
|
+
extend ActiveSupport::Concern
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
def metanol_options
|
15
|
+
@metanol_options ||= {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def meta(*args)
|
19
|
+
add_meta_tag(:main, *args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def og_meta(*args)
|
23
|
+
add_meta_tag(:og, *args)
|
24
|
+
end
|
25
|
+
|
26
|
+
def wm_meta(*args)
|
27
|
+
add_meta_tag(:wm, *args)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def add_meta_tag(type, *args)
|
33
|
+
if args[0].is_a? Hash
|
34
|
+
args[0].each do |name, value|
|
35
|
+
add_meta_by_type type, name, value
|
36
|
+
end
|
37
|
+
elsif args.length == 2
|
38
|
+
name = args[0].to_sym
|
39
|
+
value = args[1].to_sym
|
40
|
+
add_meta_by_type type, name, value
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_meta_by_type(type, name, value)
|
45
|
+
data = meta_data(name)[type]
|
46
|
+
key = data[:key]
|
47
|
+
if metanol_options.key? key
|
48
|
+
metanol_options[key].value = value
|
49
|
+
else
|
50
|
+
metanol_options[key] = data[:type].new(name, value)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def meta_data(name)
|
55
|
+
{
|
56
|
+
main: { key: name, type: Meta::Main },
|
57
|
+
og: { key: "og:#{name}", type: Meta::OpenGraph },
|
58
|
+
wm: { key: "wm:#{name}", type: Meta::Webmaster }
|
59
|
+
}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def meta(*args)
|
64
|
+
self.class.meta(*args)
|
65
|
+
end
|
66
|
+
|
67
|
+
def og_meta(*args)
|
68
|
+
self.class.og_meta(*args)
|
69
|
+
end
|
70
|
+
|
71
|
+
def wm_meta(*args)
|
72
|
+
self.class.wm_meta(*args)
|
73
|
+
end
|
74
|
+
|
75
|
+
def metanol_options
|
76
|
+
self.class.metanol_options
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Metanol
|
2
|
+
module Helpers
|
3
|
+
|
4
|
+
# Render all meta tags
|
5
|
+
def metanol_tags
|
6
|
+
result = metanol_main_tags
|
7
|
+
result << metanol_og_tags
|
8
|
+
result << metanol_wm_tags
|
9
|
+
result
|
10
|
+
end
|
11
|
+
|
12
|
+
# Render OpenGraph meta tags
|
13
|
+
def metanol_og_tags
|
14
|
+
result = metanol_render_tags ::Metanol::Meta::OpenGraph
|
15
|
+
result << ::Metanol::Meta::OpenGraph.render_current_url(current_url).html_safe
|
16
|
+
result
|
17
|
+
end
|
18
|
+
|
19
|
+
# Render Webmaster verification tags
|
20
|
+
def metanol_wm_tags
|
21
|
+
metanol_render_tags ::Metanol::Meta::Webmaster
|
22
|
+
end
|
23
|
+
|
24
|
+
# Render main tags, such as keywords, description, etc.
|
25
|
+
def metanol_main_tags
|
26
|
+
metanol_render_tags ::Metanol::Meta::Main
|
27
|
+
end
|
28
|
+
|
29
|
+
# Return a current URL
|
30
|
+
def current_url
|
31
|
+
request.original_url
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def metanol_render_tags(type)
|
37
|
+
result = ""
|
38
|
+
self.controller.metanol_options.each_value do |value|
|
39
|
+
next unless value.is_a? type
|
40
|
+
result << value.render
|
41
|
+
end
|
42
|
+
result.html_safe
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Metanol::Meta
|
2
|
+
|
3
|
+
class Base
|
4
|
+
attr_reader :name
|
5
|
+
attr_accessor :value
|
6
|
+
|
7
|
+
def initialize(name, value)
|
8
|
+
raise NameError.new "The meta tag '#{name}' isn't supported.", name unless valid?(name)
|
9
|
+
@name = name
|
10
|
+
@value = value
|
11
|
+
end
|
12
|
+
|
13
|
+
def render
|
14
|
+
raise StandardError.new "Please override this method in a child class"
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def valid?(name)
|
20
|
+
true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Metanol::Meta
|
2
|
+
|
3
|
+
class OpenGraph < Base
|
4
|
+
SUPPORT_TAGS = [:title, :description, :url, :type, :locale, :site_name, :image]
|
5
|
+
|
6
|
+
def render
|
7
|
+
"<meta property=\"og:#{@name}\" content=\"#{@value}\" />"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.render_current_url(url)
|
11
|
+
"<meta property=\"og:url\" content=\"#{url}\" />"
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
def valid?(name)
|
17
|
+
SUPPORT_TAGS.include? name.to_sym
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Metanol::Meta
|
2
|
+
class Webmaster < Base
|
3
|
+
|
4
|
+
SUPPORT_TAGS = {
|
5
|
+
yandex: 'yandex-verification',
|
6
|
+
google: 'google-site-verification',
|
7
|
+
bing: 'msvalidate.01',
|
8
|
+
alexa: 'alexaVerifyID'
|
9
|
+
}
|
10
|
+
|
11
|
+
def render
|
12
|
+
"<meta name=\"#{SUPPORT_TAGS[@name]}\" content=\"#{@value}\" />"
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def valid?(name)
|
18
|
+
!SUPPORT_TAGS[name.to_sym].nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
data/metanol.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'metanol/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "metanol"
|
8
|
+
gem.version = Metanol::VERSION
|
9
|
+
gem.platform = Gem::Platform::RUBY
|
10
|
+
gem.authors = ["Eugene Kondratyuk"]
|
11
|
+
gem.email = ["ekondr@gmail.com"]
|
12
|
+
gem.description = %q{This is a meta tags plugin which helps to manage meta tags in your Rails application. It supports some OpenGraph meta tags, Webmaster's meta tags (such as Google, Bing, Yandex, Alexa verification meta tags) and other standard HTML meta tags (such as a description). It can be used by Rails 3.2+ applications}
|
13
|
+
gem.summary = %q{A meta tags engine plugin for Rails 3.2+ applications}
|
14
|
+
gem.homepage = "https://github.com/ekondr/metanol"
|
15
|
+
|
16
|
+
gem.rubyforge_project = 'metanol'
|
17
|
+
|
18
|
+
gem.files = `git ls-files`.split($/)
|
19
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
20
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
21
|
+
gem.require_paths = ["lib"]
|
22
|
+
|
23
|
+
gem.licenses = ['MIT']
|
24
|
+
|
25
|
+
gem.add_dependency "rails", "~> 3.2"
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HomeController do
|
4
|
+
context "render meta tags with some global ones" do
|
5
|
+
|
6
|
+
context "all meta tags" do
|
7
|
+
before { get :index }
|
8
|
+
|
9
|
+
it { response.should have_selector("meta[content=\"#{url_for(controller: :home, action: :index, host: 'test.host')}\"]", property: 'og:url') }
|
10
|
+
it { response.should have_selector('meta[content="OpenGraph Title"]', property: 'og:title') }
|
11
|
+
it { response.should have_selector('meta[content="OpenGraph Description"]', property: 'og:description') }
|
12
|
+
it { response.should have_selector('meta[content="website"]', property: 'og:type') }
|
13
|
+
it { response.should have_selector('meta[content="uk_UA"]', property: 'og:locale') }
|
14
|
+
it { response.should have_selector('meta[content="bing code"]', name: 'msvalidate.01') }
|
15
|
+
it { response.should have_selector('meta[content="alexa code"]', name: 'alexaVerifyID') }
|
16
|
+
it { response.should have_selector('meta[content="google code"]', name: 'google-site-verification') }
|
17
|
+
it { response.should have_selector('meta[content="yandex code"]', name: 'yandex-verification') }
|
18
|
+
end
|
19
|
+
|
20
|
+
context "only WebMaster's meta tags" do
|
21
|
+
before { get :new }
|
22
|
+
|
23
|
+
it { response.should_not have_selector('meta[content="website"]', property: 'og:type') }
|
24
|
+
it { response.should_not have_selector('meta[content="uk_UA"]', property: 'og:locale') }
|
25
|
+
it { response.should have_selector('meta[content="bing code"]', name: 'msvalidate.01') }
|
26
|
+
it { response.should have_selector('meta[content="alexa code"]', name: 'alexaVerifyID') }
|
27
|
+
it { response.should have_selector('meta[content="google code"]', name: 'google-site-verification') }
|
28
|
+
it { response.should have_selector('meta[content="yandex code"]', name: 'yandex-verification') }
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class TestsController < ApplicationController; end
|
4
|
+
|
5
|
+
describe TestsController do
|
6
|
+
|
7
|
+
context "render only main meta tags" do
|
8
|
+
controller do
|
9
|
+
def index
|
10
|
+
meta :title, "Users List"
|
11
|
+
meta :description, "Description for a users list"
|
12
|
+
og_meta title: "OpenGraph Title", description: "OpenGraph Description"
|
13
|
+
render :inline => <<-ERB
|
14
|
+
<%= metanol_main_tags %>
|
15
|
+
ERB
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
before { get :index }
|
20
|
+
|
21
|
+
it { response.should_not have_selector('meta[content="OpenGraph Title"]', property: 'og:title') }
|
22
|
+
it { response.should_not have_selector('meta[content="OpenGraph Description"]', property: 'og:description') }
|
23
|
+
it { response.should have_selector('meta[content="Users List"]', name: 'title') }
|
24
|
+
it { response.should have_selector('meta[content="Description for a users list"]', name: 'description') }
|
25
|
+
end
|
26
|
+
|
27
|
+
context "render only open graph meta tags" do
|
28
|
+
controller do
|
29
|
+
def index
|
30
|
+
meta :title, "Users List"
|
31
|
+
meta :description, "Description for a users list"
|
32
|
+
og_meta title: "OpenGraph Title", description: "OpenGraph Description"
|
33
|
+
render :inline => <<-ERB
|
34
|
+
<%= metanol_og_tags %>
|
35
|
+
ERB
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
before { get :index }
|
40
|
+
|
41
|
+
it { response.should have_selector('meta[content="OpenGraph Title"]', property: 'og:title') }
|
42
|
+
it { response.should have_selector('meta[content="OpenGraph Description"]', property: 'og:description') }
|
43
|
+
it { response.should_not have_selector('meta[content="Users List"]', name: 'title') }
|
44
|
+
it { response.should_not have_selector('meta[content="Description for a users list"]', name: 'description') }
|
45
|
+
end
|
46
|
+
|
47
|
+
context "render all meta tags" do
|
48
|
+
controller do
|
49
|
+
def index
|
50
|
+
meta :title, "Users List"
|
51
|
+
meta :description, "Description for a users list"
|
52
|
+
og_meta title: "OpenGraph Title", description: "OpenGraph Description"
|
53
|
+
render :inline => <<-ERB
|
54
|
+
<%= metanol_tags %>
|
55
|
+
ERB
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
before { get :index }
|
60
|
+
|
61
|
+
it { response.should have_selector('meta[content="OpenGraph Title"]', property: 'og:title') }
|
62
|
+
it { response.should have_selector('meta[content="OpenGraph Description"]', property: 'og:description') }
|
63
|
+
it { response.should have_selector('meta[content="Users List"]', name: 'title') }
|
64
|
+
it { response.should have_selector('meta[content="Description for a users list"]', name: 'description') }
|
65
|
+
end
|
66
|
+
|
67
|
+
context "raise exception for unsupported metas" do
|
68
|
+
controller do
|
69
|
+
def index
|
70
|
+
meta :title, "Users List"
|
71
|
+
og_meta fake: "OpenGraph Description"
|
72
|
+
render :inline => <<-ERB
|
73
|
+
<%= metanol_tags %>
|
74
|
+
ERB
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it { expect { get :index }.to raise_error(NameError, "The meta tag 'fake' isn't supported.") }
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'rspec/autorun'
|
3
|
+
require 'metanol'
|
4
|
+
|
5
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
6
|
+
require 'rspec/rails'
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
|
10
|
+
# If true, the base class of anonymous controllers will be inferred
|
11
|
+
# automatically. This will be the default behavior in future versions of
|
12
|
+
# rspec-rails.
|
13
|
+
config.infer_base_class_for_anonymous_controllers = true
|
14
|
+
|
15
|
+
# Run specs in random order to surface order dependencies. If you find an
|
16
|
+
# order dependency and want to debug it, you can fix the order by providing
|
17
|
+
# the seed, which is printed after each run.
|
18
|
+
# --seed 1234
|
19
|
+
config.order = "random"
|
20
|
+
|
21
|
+
config.include Rails.application.routes.url_helpers
|
22
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#require 'rails/all'
|
2
|
+
require 'action_controller/railtie'
|
3
|
+
require 'action_view/railtie'
|
4
|
+
require 'active_record'
|
5
|
+
|
6
|
+
ActiveRecord::Base.configurations = {'test' => {:adapter => 'sqlite3', :database => ':memory:'}}
|
7
|
+
ActiveRecord::Base.establish_connection('test')
|
8
|
+
|
9
|
+
app = Class.new(Rails::Application)
|
10
|
+
app.config.secret_token = "f974ebb750a8e200c85f7a749d589fa2"
|
11
|
+
app.config.session_store :cookie_store, :key => "_myapp_session"
|
12
|
+
app.config.active_support.deprecation = :log
|
13
|
+
app.config.eager_load = false
|
14
|
+
app.config.root = File.dirname(__FILE__)
|
15
|
+
Rails.backtrace_cleaner.remove_silencers!
|
16
|
+
app.initialize!
|
17
|
+
|
18
|
+
app.routes.draw do
|
19
|
+
resources :tests
|
20
|
+
resources :home
|
21
|
+
end
|
22
|
+
|
23
|
+
class ApplicationController < ActionController::Base; end
|
24
|
+
|
25
|
+
class HomeController < ApplicationController
|
26
|
+
og_meta :type, 'website'
|
27
|
+
og_meta :locale, 'uk_UA'
|
28
|
+
|
29
|
+
wm_meta :alexa, 'alexa code'
|
30
|
+
wm_meta :bing, 'bing code'
|
31
|
+
wm_meta :google, 'google code'
|
32
|
+
wm_meta :yandex, 'yandex code'
|
33
|
+
|
34
|
+
def new
|
35
|
+
render :inline => <<-ERB
|
36
|
+
<%= metanol_wm_tags %>
|
37
|
+
ERB
|
38
|
+
end
|
39
|
+
|
40
|
+
def index
|
41
|
+
og_meta title: "OpenGraph Title", description: "OpenGraph Description"
|
42
|
+
render :inline => <<-ERB
|
43
|
+
<%= metanol_tags %>
|
44
|
+
ERB
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
Object.const_set(:ApplicationHelper, Module.new)
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: metanol
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Eugene Kondratyuk
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-11-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.2'
|
30
|
+
description: This is a meta tags plugin which helps to manage meta tags in your Rails
|
31
|
+
application. It supports some OpenGraph meta tags, Webmaster's meta tags (such as
|
32
|
+
Google, Bing, Yandex, Alexa verification meta tags) and other standard HTML meta
|
33
|
+
tags (such as a description). It can be used by Rails 3.2+ applications
|
34
|
+
email:
|
35
|
+
- ekondr@gmail.com
|
36
|
+
executables: []
|
37
|
+
extensions: []
|
38
|
+
extra_rdoc_files: []
|
39
|
+
files:
|
40
|
+
- .gitignore
|
41
|
+
- Gemfile
|
42
|
+
- LICENSE.txt
|
43
|
+
- README.md
|
44
|
+
- Rakefile
|
45
|
+
- lib/metanol.rb
|
46
|
+
- lib/metanol/engine.rb
|
47
|
+
- lib/metanol/engine_controller.rb
|
48
|
+
- lib/metanol/helpers.rb
|
49
|
+
- lib/metanol/meta/base.rb
|
50
|
+
- lib/metanol/meta/main.rb
|
51
|
+
- lib/metanol/meta/open_graph.rb
|
52
|
+
- lib/metanol/meta/webmaster.rb
|
53
|
+
- lib/metanol/railtie.rb
|
54
|
+
- lib/metanol/version.rb
|
55
|
+
- metanol.gemspec
|
56
|
+
- spec/controllers/home_controller_spec.rb
|
57
|
+
- spec/controllers/tests_controller_spec.rb
|
58
|
+
- spec/spec_helper.rb
|
59
|
+
- spec/support/application.rb
|
60
|
+
homepage: https://github.com/ekondr/metanol
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project: metanol
|
81
|
+
rubygems_version: 1.8.25
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: A meta tags engine plugin for Rails 3.2+ applications
|
85
|
+
test_files:
|
86
|
+
- spec/controllers/home_controller_spec.rb
|
87
|
+
- spec/controllers/tests_controller_spec.rb
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
- spec/support/application.rb
|