metanol 0.0.4 → 0.0.9
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.
- checksums.yaml +7 -0
- data/.gitignore +27 -18
- data/.overcommit.yml +73 -0
- data/.overcommit_gems +8 -0
- data/.overcommit_gems.lock +72 -0
- data/.rspec +1 -0
- data/.rubocop.yml +139 -0
- data/.rubocop_todo.yml +0 -0
- data/Gemfile +5 -8
- data/Gemfile.lock +194 -0
- data/README.md +12 -4
- data/Rakefile +1 -1
- data/lib/metanol/engine.rb +1 -1
- data/lib/metanol/engine_controller.rb +46 -72
- data/lib/metanol/helpers.rb +25 -31
- data/lib/metanol/meta/base.rb +82 -57
- data/lib/metanol/meta/main.rb +10 -7
- data/lib/metanol/meta/micro_data.rb +13 -0
- data/lib/metanol/meta/open_graph.rb +19 -9
- data/lib/metanol/meta/webmaster.rb +17 -15
- data/lib/metanol/railtie.rb +5 -5
- data/lib/metanol/support.rb +8 -0
- data/lib/metanol/version.rb +1 -1
- data/lib/metanol.rb +7 -0
- data/metanol.gemspec +36 -18
- metadata +101 -34
- data/spec/controllers/home_controller_spec.rb +0 -32
- data/spec/controllers/tests_controller_spec.rb +0 -187
- data/spec/spec_helper.rb +0 -22
- data/spec/support/application.rb +0 -48
metadata
CHANGED
@@ -1,44 +1,119 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.9
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
9
|
-
autorequire:
|
7
|
+
- Yevhen Kondratiuk
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2021-10-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '6.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
26
|
+
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: capybara
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry-byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sqlite3
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
30
97
|
description: This is a meta tags plugin which helps to manage meta tags in your Rails
|
31
98
|
application. It supports some OpenGraph meta tags, Webmaster's meta tags (such as
|
32
|
-
Google, Bing, Yandex, Alexa verification meta tags
|
33
|
-
tags (such as a description). It can be used by Rails 3.2+
|
99
|
+
Google, Bing, Yandex, Alexa verification tags), MicroData meta tags and other standard
|
100
|
+
HTML meta tags (such as a <description>, <title> etc). It can be used by Rails 3.2+
|
101
|
+
applications.
|
34
102
|
email:
|
35
103
|
- ekondr@gmail.com
|
36
104
|
executables: []
|
37
105
|
extensions: []
|
38
106
|
extra_rdoc_files: []
|
39
107
|
files:
|
40
|
-
- .gitignore
|
108
|
+
- ".gitignore"
|
109
|
+
- ".overcommit.yml"
|
110
|
+
- ".overcommit_gems"
|
111
|
+
- ".overcommit_gems.lock"
|
112
|
+
- ".rspec"
|
113
|
+
- ".rubocop.yml"
|
114
|
+
- ".rubocop_todo.yml"
|
41
115
|
- Gemfile
|
116
|
+
- Gemfile.lock
|
42
117
|
- LICENSE.txt
|
43
118
|
- README.md
|
44
119
|
- Rakefile
|
@@ -48,42 +123,34 @@ files:
|
|
48
123
|
- lib/metanol/helpers.rb
|
49
124
|
- lib/metanol/meta/base.rb
|
50
125
|
- lib/metanol/meta/main.rb
|
126
|
+
- lib/metanol/meta/micro_data.rb
|
51
127
|
- lib/metanol/meta/open_graph.rb
|
52
128
|
- lib/metanol/meta/webmaster.rb
|
53
129
|
- lib/metanol/railtie.rb
|
130
|
+
- lib/metanol/support.rb
|
54
131
|
- lib/metanol/version.rb
|
55
132
|
- 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
133
|
homepage: https://github.com/ekondr/metanol
|
61
134
|
licenses:
|
62
135
|
- MIT
|
63
|
-
|
136
|
+
metadata: {}
|
137
|
+
post_install_message:
|
64
138
|
rdoc_options: []
|
65
139
|
require_paths:
|
66
140
|
- lib
|
67
141
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
142
|
requirements:
|
70
|
-
- -
|
143
|
+
- - ">="
|
71
144
|
- !ruby/object:Gem::Version
|
72
|
-
version: '
|
145
|
+
version: '2.3'
|
73
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
147
|
requirements:
|
76
|
-
- -
|
148
|
+
- - ">="
|
77
149
|
- !ruby/object:Gem::Version
|
78
150
|
version: '0'
|
79
151
|
requirements: []
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
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
|
152
|
+
rubygems_version: 3.1.2
|
153
|
+
signing_key:
|
154
|
+
specification_version: 4
|
155
|
+
summary: "<META> tags engine plugin for Ruby on Rails applications"
|
156
|
+
test_files: []
|
@@ -1,32 +0,0 @@
|
|
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
|
@@ -1,187 +0,0 @@
|
|
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('title', content: 'Users List') }
|
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('title', content: 'Users List') }
|
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('title', content: 'Users List') }
|
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
|
-
wm_meta fake: "Fake value"
|
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
|
-
context "filter whitespaces" do
|
82
|
-
controller do
|
83
|
-
def index
|
84
|
-
meta :description, "Description \t\nfor \ta \tusers \r\nlist", :whitespaces
|
85
|
-
render :inline => <<-ERB
|
86
|
-
<%= metanol_main_tags %>
|
87
|
-
ERB
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
before { get :index }
|
92
|
-
|
93
|
-
it('success') { response.should have_selector('meta[content="Description for a users list"]', name: 'description') }
|
94
|
-
end
|
95
|
-
|
96
|
-
context "filter HTML tags" do
|
97
|
-
controller do
|
98
|
-
def index
|
99
|
-
meta({description: "<div>Description <br/>for <b>a users</b> <br>list</div>", keywords: "key,word"}, :html)
|
100
|
-
render :inline => <<-ERB
|
101
|
-
<%= metanol_main_tags %>
|
102
|
-
ERB
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
before { get :index }
|
107
|
-
|
108
|
-
it('success') { response.should have_selector('meta[content="Description for a users list"]', name: 'description') }
|
109
|
-
end
|
110
|
-
|
111
|
-
context "filter HTML tags and whitespaces" do
|
112
|
-
controller do
|
113
|
-
def index
|
114
|
-
meta(:description, "<div>\tDescription \r\n<br/>for \t<b>a users</b> \r\n<br>list</div>", :html, :whitespaces)
|
115
|
-
render :inline => <<-ERB
|
116
|
-
<%= metanol_main_tags %>
|
117
|
-
ERB
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
before { get :index }
|
122
|
-
|
123
|
-
it('success') { response.should have_selector('meta[content=" Description for a users list"]', name: 'description') }
|
124
|
-
end
|
125
|
-
|
126
|
-
context "filter spaces - leave only 1 space between words" do
|
127
|
-
controller do
|
128
|
-
def index
|
129
|
-
meta :description, "Description for a users list", :overspaces
|
130
|
-
render :inline => <<-ERB
|
131
|
-
<%= metanol_main_tags %>
|
132
|
-
ERB
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
before { get :index }
|
137
|
-
|
138
|
-
it('success') { response.should have_selector('meta[content="Description for a users list"]', name: 'description') }
|
139
|
-
end
|
140
|
-
|
141
|
-
context "clean up a value from whitespaces, html tags etc (run all filters)" do
|
142
|
-
controller do
|
143
|
-
def index
|
144
|
-
meta(:description, "<div>\tDescription \r\n<br/>for \t<b>a users</b> \r\n<br>list</div>", :clean)
|
145
|
-
render :inline => <<-ERB
|
146
|
-
<%= metanol_main_tags %>
|
147
|
-
ERB
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
before { get :index }
|
152
|
-
|
153
|
-
it { response.should have_selector('meta[content=" Description for a users list"]', name: 'description') }
|
154
|
-
end
|
155
|
-
|
156
|
-
context "returns meta values in a controller and in a view" do
|
157
|
-
controller do
|
158
|
-
def index
|
159
|
-
meta :title, 'Users List'
|
160
|
-
wm_meta :alexa, 'alexa code'
|
161
|
-
og_meta title: 'OpenGraph Title'
|
162
|
-
|
163
|
-
@meta = get_meta :title
|
164
|
-
@wm_meta = get_wm_meta :alexa
|
165
|
-
@og_meta = get_og_meta :title
|
166
|
-
@og_no_meta = get_og_meta :bad_meta_name
|
167
|
-
|
168
|
-
render :inline => <<-ERB
|
169
|
-
<span>Main meta is <%= get_meta :title %></span>
|
170
|
-
<span>OpenGraph meta is <%= get_og_meta :title %></span>
|
171
|
-
<span>Webmaster meta is <%= get_wm_meta :alexa %></span>
|
172
|
-
ERB
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
before { get :index }
|
177
|
-
|
178
|
-
it { response.should have_selector('span', content: 'Main meta is Users List') }
|
179
|
-
it { response.should have_selector('span', content: 'OpenGraph meta is OpenGraph Title') }
|
180
|
-
it { response.should have_selector('span', content: 'Webmaster meta is alexa code') }
|
181
|
-
it { assigns(:meta).should == 'Users List' }
|
182
|
-
it { assigns(:wm_meta).should == 'alexa code' }
|
183
|
-
it { assigns(:og_meta).should == 'OpenGraph Title' }
|
184
|
-
it { assigns(:og_no_meta).should == nil }
|
185
|
-
end
|
186
|
-
|
187
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,22 +0,0 @@
|
|
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
|
data/spec/support/application.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'action_controller/railtie'
|
2
|
-
require 'action_view/railtie'
|
3
|
-
require 'active_record'
|
4
|
-
|
5
|
-
ActiveRecord::Base.configurations = {'test' => {:adapter => 'sqlite3', :database => ':memory:'}}
|
6
|
-
ActiveRecord::Base.establish_connection('test')
|
7
|
-
|
8
|
-
app = Class.new(Rails::Application)
|
9
|
-
app.config.secret_token = "f974ebb750a8e200c85f7a749d589fa2"
|
10
|
-
app.config.session_store :cookie_store, :key => "_myapp_session"
|
11
|
-
app.config.active_support.deprecation = :log
|
12
|
-
app.config.eager_load = false
|
13
|
-
app.config.root = File.dirname(__FILE__)
|
14
|
-
Rails.backtrace_cleaner.remove_silencers!
|
15
|
-
app.initialize!
|
16
|
-
|
17
|
-
app.routes.draw do
|
18
|
-
resources :tests
|
19
|
-
resources :home
|
20
|
-
end
|
21
|
-
|
22
|
-
class ApplicationController < ActionController::Base; end
|
23
|
-
|
24
|
-
class ParentController < ApplicationController
|
25
|
-
wm_meta :alexa, 'alexa code'
|
26
|
-
wm_meta :yandex, 'yandex code'
|
27
|
-
wm_meta bing: 'bing code', google: 'google code'
|
28
|
-
end
|
29
|
-
|
30
|
-
class HomeController < ParentController
|
31
|
-
og_meta :type, 'website'
|
32
|
-
og_meta :locale, 'uk_UA'
|
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)
|