meta-rails 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 63895f5fa9581f62af607f1b116a4545d484ec1b
4
+ data.tar.gz: ee296a6e450ccf4eadce9645ff4791093850115f
5
+ SHA512:
6
+ metadata.gz: 1f6e324080e0dbccef952aa37439d6242bba4df60ede27659782623675837551d95a85f30367baf053487512cb698ae485b12bf307489ef04e48714aeaa51d82
7
+ data.tar.gz: a988c2f82f828974f4e5873723a0b210bf0c101a5bea43b576ac0a49a27a6947c6b2749739e4355d9f30969a2f9f6b06ed0973b14807efc4ea37851a3f66c10f
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.7
6
+ - 2.2.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 (2015-11-16)
2
+
3
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in meta-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Dmitriy Tarasov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # Meta Rails
2
+
3
+ Collection of view helpers to improve search engine optimization of Ruby on Rails application by including appropriate meta tags.
4
+
5
+ ## Installation
6
+
7
+ Open your Rails application's `Gemfile` and add this line:
8
+
9
+ ```ruby
10
+ gem 'meta-rails'
11
+ ```
12
+
13
+ Save `Gemfile` and execute `bundle` command to install the gem.
14
+
15
+ ## Contributing
16
+
17
+ Anyone is welcome to contribute to Meta Rails. Please [raise an issue](https://github.com/rubysamurai/meta-rails/issues), fork the project, make changes to your forked repository and submit a pull request.
18
+
19
+ ## License
20
+
21
+ `meta-rails` © Dmitriy Tarasov, 2015. Released under the [MIT](https://github.com/rubysamurai/meta-rails/blob/master/LICENSE.txt) license.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'meta-rails'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,27 @@
1
+ module MetaRailsHelpers
2
+ module TitleHelper
3
+ # Produces html title element
4
+ def title(options = {})
5
+ page_title = content_for(options[:page_title] || :title)
6
+ separator = options[:separator] || '|'
7
+ brand = options[:brand] || default_brand
8
+ reverse = options[:reverse] || false
9
+
10
+ if page_title.present?
11
+ if reverse
12
+ content_tag(:title, brand + ' ' + separator + ' ' + page_title)
13
+ else
14
+ content_tag(:title, page_title + ' ' + separator + ' ' + brand)
15
+ end
16
+ else
17
+ content_tag(:title, base_title)
18
+ end
19
+ end
20
+
21
+ private
22
+ # Returns Rails application name as default brand
23
+ def default_brand
24
+ Rails.application.class.to_s.split('::').first
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,9 @@
1
+ module MetaRailsHelpers
2
+ class Railtie < Rails::Railtie
3
+ initializer 'title.helper' do
4
+ ActiveSupport.on_load :action_view do
5
+ include MetaRailsHelpers::TitleHelper
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Meta
2
+ module Rails
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
data/lib/meta-rails.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'meta/rails/version'
2
+ require 'meta/rails/helpers/title_helper'
3
+ require 'meta/rails/railtie' if defined? Rails
4
+
5
+ module Meta
6
+ module Rails
7
+ end
8
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'meta/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'meta-rails'
8
+ spec.version = Meta::Rails::VERSION
9
+ spec.authors = ['Dmitriy Tarasov']
10
+ spec.email = ['info@rubysamurai.com']
11
+
12
+ spec.summary = 'Meta tags helpers for search engine optimization (SEO)'
13
+ spec.description = 'Meta tags helpers to improve search engine optimization (SEO) of Rails application'
14
+ spec.homepage = 'https://github.com/rubysamurai/meta-rails'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.required_ruby_version = '>= 1.9.3'
23
+
24
+ spec.add_development_dependency 'rails', '~> 4.2'
25
+ spec.add_development_dependency 'rspec-rails', '~> 3.3'
26
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meta-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dmitriy Tarasov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-11-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.3'
41
+ description: Meta tags helpers to improve search engine optimization (SEO) of Rails
42
+ application
43
+ email:
44
+ - info@rubysamurai.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - ".rspec"
51
+ - ".travis.yml"
52
+ - CHANGELOG.md
53
+ - Gemfile
54
+ - LICENSE.txt
55
+ - README.md
56
+ - Rakefile
57
+ - bin/console
58
+ - bin/setup
59
+ - lib/meta-rails.rb
60
+ - lib/meta/rails/helpers/title_helper.rb
61
+ - lib/meta/rails/railtie.rb
62
+ - lib/meta/rails/version.rb
63
+ - meta-rails.gemspec
64
+ homepage: https://github.com/rubysamurai/meta-rails
65
+ licenses:
66
+ - MIT
67
+ metadata: {}
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 1.9.3
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.4.7
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Meta tags helpers for search engine optimization (SEO)
88
+ test_files: []