meta_tags-rails 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08c61215c330314bcbee5e80a86098d964f102d6
4
- data.tar.gz: c64995388c5381275aef544dba93aab23249966f
3
+ metadata.gz: 807097d6d5b1ccf24d1ab4ea890f6c4eb99f17d4
4
+ data.tar.gz: 706635320906ea8377d49bb3025fca4d4a886d1c
5
5
  SHA512:
6
- metadata.gz: e74bc2a195aa7ebd1c4954452411c0386ca537c3a0307f603f1f568f585deb1ee5b2f25f468eb30f34adfc0f8089e687d474d5eb3a767bd9055abfb47f326819
7
- data.tar.gz: 5f90b7bb8abb85f3761441c7ba9f3a4e467d3bec8683fb496e52245cfefac602773e050165be7235b9c57074f920962587c15f19beec60cbc9df514094e29930
6
+ metadata.gz: 86a9ae9bb75d89e9321321012e7564eddc0c0057322a768ced90a70baa7a568be6c7672377cb9327f89f3cd1f71121ae7252b86f12fd617250f58baee684524f
7
+ data.tar.gz: cf90284bae016aeb2121e508e04eb4142d370e363df6a888510f9bad70b061b2ed05aab880071ff9194da3645e7fe1f15e5ef920f346e1fc7e612d7a6096b4b3
data/.travis.yml CHANGED
@@ -1,7 +1,10 @@
1
+ sudo: false
2
+ cache: bundler
3
+
1
4
  rvm:
2
5
  - 2.0.0
3
6
  - 2.1.7
4
- - 2.2.3
7
+ - 2.2.2
5
8
 
6
9
  env:
7
10
  - "RAILS_VERSION=3.1.0"
@@ -9,13 +12,15 @@ env:
9
12
  - "RAILS_VERSION=4.0.0"
10
13
  - "RAILS_VERSION=4.1.0"
11
14
  - "RAILS_VERSION=4.2.0"
15
+ - "RAILS_VERSION=5.0.0"
12
16
 
13
17
  matrix:
18
+ allow_failures:
19
+ - env: "RAILS_VERSION=5.0.0"
20
+ rvm:
21
+ - 2.0.0
22
+ - 2.1.7
14
23
 
15
24
  notifications:
16
25
  recipients:
17
- - kpumuk@kpumuk.info
18
-
19
- addons:
20
- code_climate:
21
- repo_token: "8792cbc0d1780830ddd3dd7eb1c25f09f386ba8f04449ad830039469406a6ab3"
26
+ - Elektron1c97@gmail.com
data/README.md CHANGED
@@ -1,9 +1,6 @@
1
1
  # MetaTags: a gem to make your Rails application SEO-friendly
2
2
 
3
- [![Travis-CI build status](https://secure.travis-ci.org/kpumuk/meta-tags.svg)](http://travis-ci.org/kpumuk/meta-tags)
4
- [![Gem Version](https://badge.fury.io/rb/meta-tags.svg)](http://badge.fury.io/rb/meta-tags)
5
- [![Code Climate](https://codeclimate.com/github/kpumuk/meta-tags.png)](https://codeclimate.com/github/kpumuk/meta-tags)
6
- [![Coverage](https://codeclimate.com/github/kpumuk/meta-tags/coverage.png)](https://codeclimate.com/github/kpumuk/meta-tags)
3
+ [![Travis-CI build status](https://travis-ci.org/Elektron1c97/meta_tags-rails.svg?branch=master)](https://travis-ci.org/Elektron1c97/meta_tags-rails)
7
4
 
8
5
  Search Engine Optimization (SEO) plugin for Ruby on Rails applications.
9
6
 
@@ -12,20 +12,14 @@ module MetaTags
12
12
  module ControllerHelper
13
13
  extend ActiveSupport::Concern
14
14
 
15
- included do
16
- alias_method_chain :render, :meta_tags
17
- end
18
-
19
15
  # Processes the <tt>@page_title</tt>, <tt>@page_keywords</tt>, and
20
16
  # <tt>@page_description</tt> instance variables and calls +render+.
21
- def render_with_meta_tags(*args, &block)
17
+ def render(*args, &block)
22
18
  self.meta_tags[:title] = @page_title if @page_title
23
19
  self.meta_tags[:keywords] = @page_keywords if @page_keywords
24
20
  self.meta_tags[:description] = @page_description if @page_description
25
-
26
- render_without_meta_tags(*args, &block)
21
+ super
27
22
  end
28
- protected :render_with_meta_tags
29
23
 
30
24
  # Set meta tags for the page.
31
25
  #
@@ -30,6 +30,8 @@ module MetaTags
30
30
  render_links(tags)
31
31
 
32
32
  render_hash(tags, :og, name_key: :property)
33
+ render_hash(tags, :fb, name_key: :property)
34
+ render_hash(tags, :al, name_key: :property)
33
35
  render_hashes(tags)
34
36
  render_custom(tags)
35
37
 
@@ -147,7 +149,7 @@ module MetaTags
147
149
  # @param [Array<Tag>] tags a buffer object to store tag in.
148
150
  #
149
151
  def render_links(tags)
150
- [ :canonical, :prev, :next, :author, :publisher ].each do |tag_name|
152
+ [ :canonical, :prev, :next, :author, :publisher, :amphtml ].each do |tag_name|
151
153
  href = meta_tags.extract(tag_name)
152
154
  if href.present?
153
155
  @normalized_meta_tags[tag_name] = href
@@ -1,4 +1,4 @@
1
1
  module MetaTags
2
2
  # Gem version.
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
@@ -34,4 +34,4 @@ require 'meta_tags-rails/text_normalizer'
34
34
  require 'meta_tags-rails/view_helper'
35
35
 
36
36
  ActionView::Base.send :include, MetaTags::ViewHelper
37
- ActionController::Base.send :include, MetaTags::ControllerHelper
37
+ ActionController::Base.send :prepend, MetaTags::ControllerHelper
@@ -1,11 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
- class MetaTagsController < ActionController::Base
3
+ class ActionController::Base
4
4
  attr_reader :rendered
5
5
 
6
- def render_without_meta_tags
6
+ def render(*args, &block)
7
7
  @rendered = true
8
8
  end
9
+ end
10
+
11
+ class MetaTagsController < ActionController::Base
9
12
 
10
13
  def index
11
14
  @page_title = 'title'
@@ -75,12 +75,6 @@ describe MetaTags::ViewHelper do
75
75
  subject.display_meta_tags(site: 'someSite', separator: ':').tap do |meta|
76
76
  expect(meta).to eq('<title>someSite : someTitle</title>')
77
77
  end
78
- subject.display_meta_tags(site: 'someSite', separator: '&amp;').tap do |meta|
79
- expect(meta).to eq('<title>someSite &amp;amp;amp; someTitle</title>')
80
- end
81
- subject.display_meta_tags(site: 'someSite', separator: '&amp;'.html_safe).tap do |meta|
82
- expect(meta).to eq('<title>someSite &amp;amp; someTitle</title>')
83
- end
84
78
  subject.display_meta_tags(site: 'someSite: ', separator: false).tap do |meta|
85
79
  expect(meta).to eq('<title>someSite: someTitle</title>')
86
80
  end
@@ -51,6 +51,35 @@ describe MetaTags::ViewHelper do
51
51
  expect(meta).to have_tag('meta', with: { content: "facebook description", property: "og:description" })
52
52
  end
53
53
  end
54
+
55
+ it 'should work with app links parameters' do
56
+ subject.set_meta_tags('al' => {
57
+ 'ios' => {
58
+ 'url' => 'http://example.com',
59
+ 'app_name' => 'My App'
60
+ }
61
+ })
62
+ subject.display_meta_tags(site: 'someSite').tap do |meta|
63
+ expect(meta).to have_tag('meta', with: { content: "http://example.com", property: "al:ios:url" })
64
+ expect(meta).to have_tag('meta', with: { content: "My App", property: "al:ios:app_name" })
65
+ end
66
+ end
67
+
68
+ it 'should work with amp url parameters' do
69
+ subject.set_meta_tags('amphtml' => 'http://example.com')
70
+ subject.display_meta_tags(site: 'someSite').tap do |meta|
71
+ expect(meta).to have_tag('link', with: { rel: "amphtml", href: "http://example.com" })
72
+ end
73
+ end
74
+
75
+ it 'should work with facebook parameters' do
76
+ subject.set_meta_tags('fb' => {
77
+ 'app_id' => 'something'
78
+ })
79
+ subject.display_meta_tags(site: 'someSite').tap do |meta|
80
+ expect(meta).to have_tag('meta', with: { content: "something", property: "fb:app_id" })
81
+ end
82
+ end
54
83
  end
55
84
 
56
85
  it_behaves_like '.set_meta_tags'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta_tags-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmytro Shteflyuk
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-03 00:00:00.000000000 Z
12
+ date: 2016-08-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack