nazca 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +27 -0
- data/Gemfile.lock +70 -63
- data/README.markdown +41 -33
- data/gemfiles/rails-3-0-stable.gemfile +6 -0
- data/gemfiles/rails-3-1-stable.gemfile +6 -0
- data/gemfiles/rails-3-2-stable.gemfile +6 -0
- data/gemfiles/rails-4-0-stable.gemfile +6 -0
- data/gemfiles/rails-4-1-stable.gemfile +6 -0
- data/lib/nazca/railtie.rb +1 -1
- data/lib/nazca/version.rb +1 -1
- data/lib/nazca/view_helpers.rb +26 -26
- data/nazca.gemspec +3 -3
- metadata +55 -72
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 22a38ccf6d233df951407efd7c9c50f354086da8
|
4
|
+
data.tar.gz: c39766f2d23cf35e51eb4bfe00435b4226d0e6ab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ae75f4101dabdb4b08295f17df9c5d538f6ecac0bb17d32a108ed3580974c8bdd1c0a5d7ffdc123c39456e86daf40762a6a4ff21a18db2713951bc2d2ea4b29f
|
7
|
+
data.tar.gz: 791a21509259644e430c00ea283ef0817c78eba5b59bf6ccbc7ee1169c01c4da43be3978da836987ddec092474bbb9300166501f9565235fa4d8f0ae63819127
|
data/.travis.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
language: ruby
|
2
|
+
before_install:
|
3
|
+
- gem install bundler
|
4
|
+
install: bundle install --jobs=1 --retry=3
|
5
|
+
|
6
|
+
notifications:
|
7
|
+
email: false
|
8
|
+
rvm:
|
9
|
+
- 1.9.3
|
10
|
+
- 2.0.0
|
11
|
+
- 2.1.1
|
12
|
+
- 2.1.2
|
13
|
+
- 2.1.3
|
14
|
+
- ruby-head
|
15
|
+
- jruby-19mode
|
16
|
+
|
17
|
+
gemfile:
|
18
|
+
- Gemfile
|
19
|
+
- gemfiles/rails-3-0-stable.gemfile
|
20
|
+
- gemfiles/rails-3-1-stable.gemfile
|
21
|
+
- gemfiles/rails-3-2-stable.gemfile
|
22
|
+
- gemfiles/rails-4-0-stable.gemfile
|
23
|
+
- gemfiles/rails-4-1-stable.gemfile
|
24
|
+
|
25
|
+
matrix:
|
26
|
+
allow_failures:
|
27
|
+
- rvm: ruby-head
|
data/Gemfile.lock
CHANGED
@@ -1,71 +1,69 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nazca (0.0
|
5
|
-
rails (
|
4
|
+
nazca (0.2.0)
|
5
|
+
rails (>= 3.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
mail (~> 2.2.
|
14
|
-
actionpack (
|
15
|
-
|
16
|
-
activesupport (=
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
builder (2.1.2)
|
10
|
+
actionmailer (4.1.6)
|
11
|
+
actionpack (= 4.1.6)
|
12
|
+
actionview (= 4.1.6)
|
13
|
+
mail (~> 2.5, >= 2.5.4)
|
14
|
+
actionpack (4.1.6)
|
15
|
+
actionview (= 4.1.6)
|
16
|
+
activesupport (= 4.1.6)
|
17
|
+
rack (~> 1.5.2)
|
18
|
+
rack-test (~> 0.6.2)
|
19
|
+
actionview (4.1.6)
|
20
|
+
activesupport (= 4.1.6)
|
21
|
+
builder (~> 3.1)
|
22
|
+
erubis (~> 2.7.0)
|
23
|
+
activemodel (4.1.6)
|
24
|
+
activesupport (= 4.1.6)
|
25
|
+
builder (~> 3.1)
|
26
|
+
activerecord (4.1.6)
|
27
|
+
activemodel (= 4.1.6)
|
28
|
+
activesupport (= 4.1.6)
|
29
|
+
arel (~> 5.0.0)
|
30
|
+
activesupport (4.1.6)
|
31
|
+
i18n (~> 0.6, >= 0.6.9)
|
32
|
+
json (~> 1.7, >= 1.7.7)
|
33
|
+
minitest (~> 5.1)
|
34
|
+
thread_safe (~> 0.1)
|
35
|
+
tzinfo (~> 1.1)
|
36
|
+
arel (5.0.1.20140414130214)
|
37
|
+
builder (3.2.2)
|
39
38
|
diff-lcs (1.1.2)
|
40
|
-
erubis (2.
|
41
|
-
|
42
|
-
i18n (0.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
rack (
|
51
|
-
rack-mount (0.6.13)
|
52
|
-
rack (>= 1.0.0)
|
53
|
-
rack-test (0.5.7)
|
39
|
+
erubis (2.7.0)
|
40
|
+
hike (1.2.3)
|
41
|
+
i18n (0.6.11)
|
42
|
+
json (1.8.1)
|
43
|
+
mail (2.6.1)
|
44
|
+
mime-types (>= 1.16, < 3)
|
45
|
+
mime-types (2.4.1)
|
46
|
+
minitest (5.4.2)
|
47
|
+
multi_json (1.10.1)
|
48
|
+
rack (1.5.2)
|
49
|
+
rack-test (0.6.2)
|
54
50
|
rack (>= 1.0)
|
55
|
-
rails (
|
56
|
-
actionmailer (=
|
57
|
-
actionpack (=
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
51
|
+
rails (4.1.6)
|
52
|
+
actionmailer (= 4.1.6)
|
53
|
+
actionpack (= 4.1.6)
|
54
|
+
actionview (= 4.1.6)
|
55
|
+
activemodel (= 4.1.6)
|
56
|
+
activerecord (= 4.1.6)
|
57
|
+
activesupport (= 4.1.6)
|
58
|
+
bundler (>= 1.3.0, < 2.0)
|
59
|
+
railties (= 4.1.6)
|
60
|
+
sprockets-rails (~> 2.0)
|
61
|
+
railties (4.1.6)
|
62
|
+
actionpack (= 4.1.6)
|
63
|
+
activesupport (= 4.1.6)
|
66
64
|
rake (>= 0.8.7)
|
67
|
-
thor (
|
68
|
-
rake (
|
65
|
+
thor (>= 0.18.1, < 2.0)
|
66
|
+
rake (10.3.2)
|
69
67
|
rspec (2.4.0)
|
70
68
|
rspec-core (~> 2.4.0)
|
71
69
|
rspec-expectations (~> 2.4.0)
|
@@ -74,15 +72,24 @@ GEM
|
|
74
72
|
rspec-expectations (2.4.0)
|
75
73
|
diff-lcs (~> 1.1.2)
|
76
74
|
rspec-mocks (2.4.0)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
sprockets (2.12.2)
|
76
|
+
hike (~> 1.2)
|
77
|
+
multi_json (~> 1.0)
|
78
|
+
rack (~> 1.0)
|
79
|
+
tilt (~> 1.1, != 1.3.0)
|
80
|
+
sprockets-rails (2.1.4)
|
81
|
+
actionpack (>= 3.0)
|
82
|
+
activesupport (>= 3.0)
|
83
|
+
sprockets (~> 2.8)
|
84
|
+
thor (0.19.1)
|
85
|
+
thread_safe (0.3.4)
|
86
|
+
tilt (1.4.1)
|
87
|
+
tzinfo (1.2.2)
|
88
|
+
thread_safe (~> 0.1)
|
81
89
|
|
82
90
|
PLATFORMS
|
83
91
|
ruby
|
84
92
|
|
85
93
|
DEPENDENCIES
|
86
94
|
nazca!
|
87
|
-
rails (~> 3.0)
|
88
95
|
rspec (~> 2.0)
|
data/README.markdown
CHANGED
@@ -1,60 +1,68 @@
|
|
1
1
|
# nazca
|
2
2
|
|
3
|
-
Nazca is a Rails 3 plugin to easily deal with all your `<title>` and `<meta>` tags, making your app more usable for people and more visible for search engines.
|
4
|
-
|
3
|
+
Nazca is a Rails 3 / Rails 4 plugin to easily deal with all your `<title>` and `<meta>` tags, making your app more usable for people and more visible for search engines.
|
4
|
+
|
5
|
+
[![Build Status](https://travis-ci.org/razorjack/nazca.svg?branch=master)](https://travis-ci.org/razorjack/nazca)
|
6
|
+
|
5
7
|
## Why?
|
6
8
|
|
7
9
|
Using instance variables for this purpose seemed so scruffy. Wrapping some code in this little plugin made my layout templates much smaller and cleaner as I could add all my meta tags in a single line of code.
|
8
10
|
|
9
11
|
## Usage
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
```erb
|
14
|
+
<%= meta_tags "My awesome little site" %>
|
15
|
+
```
|
14
16
|
|
17
|
+
will yield: `<title>My awesome little site</title>`
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
```erb
|
20
|
+
# In views/posts/new.html.erb
|
21
|
+
<% title "Creating a post" %>
|
22
|
+
|
23
|
+
# In views/layouts/application.html.erb
|
24
|
+
<%= meta_tags "My awesome little site" %>
|
25
|
+
```
|
21
26
|
|
22
27
|
gives `<title>My awesome little site | Creating a new post</title>`.
|
23
28
|
|
24
29
|
You can specify the title inside a header tag as the `title` method returns the title itself:
|
25
30
|
|
26
|
-
|
31
|
+
```erb
|
32
|
+
<h1><%= title "Creating a post" %></h1>
|
33
|
+
```
|
34
|
+
|
35
|
+
### Reversing order
|
27
36
|
|
28
|
-
|
37
|
+
```erb
|
38
|
+
<%= meta_tags "My awesome little site", :reverse => true %>
|
39
|
+
```
|
29
40
|
|
30
|
-
<%= meta_tags "My awesome little site", :reverse => true %>
|
31
|
-
|
32
41
|
which yields `<title>Creating a new post | My awesome little site</title>`
|
33
42
|
|
34
|
-
|
43
|
+
### Setting a custom separator
|
35
44
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
Setting description and keywords meta tag:
|
45
|
+
```erb
|
46
|
+
<%= meta_tags "My awesome little site", :reverse => true, :separator => "::" %>
|
47
|
+
<title>Creating a new post :: My awesome little site</title>
|
48
|
+
```
|
41
49
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
50
|
+
### Setting description and keywords meta tag:
|
51
|
+
|
52
|
+
```erb
|
53
|
+
<% title "Creating a post" %>
|
54
|
+
<% keywords "omg,so,sweet" %>
|
55
|
+
<% description "Cute cats programming Ruby." %>
|
56
|
+
<%= meta_tags "My awesome little site" %>
|
57
|
+
|
58
|
+
<title>My awesome little site | Creating a post</title>
|
59
|
+
<meta content="Cute cats programming Ruby." name="description" />
|
60
|
+
<meta content="omg,so,sweet" name="keywords" />
|
61
|
+
```
|
46
62
|
|
47
|
-
<title>My awesome little site | Creating a post</title>
|
48
|
-
<meta content="Cute girls programming Ruby." name="description" />
|
49
|
-
<meta content="omg,they,are,so,hot" name="keywords" />
|
50
|
-
|
51
63
|
## Why there are no controller methods to globally set up meta tags?
|
52
64
|
|
53
65
|
Because I respect MVC. Meta tags are views-specific.
|
54
|
-
|
55
|
-
## Ruby 1.9?
|
56
|
-
|
57
|
-
Yup. Do you still use 1.8?
|
58
66
|
|
59
67
|
## Rails 2?
|
60
68
|
|
@@ -62,4 +70,4 @@ Fork you.
|
|
62
70
|
|
63
71
|
## License
|
64
72
|
|
65
|
-
MIT.
|
73
|
+
MIT.
|
data/lib/nazca/railtie.rb
CHANGED
data/lib/nazca/version.rb
CHANGED
data/lib/nazca/view_helpers.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Nazca
|
2
2
|
module ViewHelpers
|
3
3
|
def tag!(tags = {})
|
4
|
-
@
|
5
|
-
@
|
4
|
+
@_nazca_tags ||= {}
|
5
|
+
@_nazca_tags.merge!(tags)
|
6
6
|
end
|
7
7
|
|
8
8
|
def title(t)
|
@@ -15,7 +15,7 @@ module Nazca
|
|
15
15
|
k
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
def description(d)
|
19
19
|
tag!(:description => normalize(d))
|
20
20
|
d
|
21
21
|
end
|
@@ -30,38 +30,38 @@ module Nazca
|
|
30
30
|
tag!(:nofollow => true)
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
def canonical(href)
|
34
|
+
tag!(:canonical => true)
|
35
|
+
end
|
36
36
|
|
37
37
|
|
38
38
|
def meta_tags(site_name, options = {})
|
39
39
|
result = ""
|
40
|
-
|
40
|
+
@_nazca_tags ||= {}
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
options[:separator] ||= "|"
|
43
|
+
options[:reversed] ||= false
|
44
|
+
|
45
|
+
options.merge!(@_nazca_tags)
|
46
|
+
|
47
|
+
if options[:title].to_s.length > 0 # maybe use ActiveSupport and .present? method
|
48
|
+
title = [site_name, options[:separator], options[:title]]
|
49
|
+
else
|
50
|
+
title = [site_name]
|
51
|
+
end
|
46
52
|
|
47
|
-
|
48
|
-
|
49
|
-
else
|
50
|
-
title = [site_name]
|
51
|
-
end
|
52
|
-
|
53
|
-
title.reverse! if options[:reverse]
|
54
|
-
result << content_tag(:title, title.join(' ').html_safe)
|
53
|
+
title.reverse! if options[:reverse]
|
54
|
+
result << content_tag(:title, title.join(' ').html_safe)
|
55
55
|
|
56
|
-
|
57
|
-
|
56
|
+
result << tag(:meta, :name => :description, :content => options[:description]) if options[:description]
|
57
|
+
result << tag(:meta, :name => :keywords, :content => options[:keywords]) if options[:keywords]
|
58
58
|
return result.html_safe
|
59
59
|
end
|
60
60
|
|
61
61
|
private
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
# Normalizes output string so that it's tags are stripped
|
63
|
+
def normalize(str)
|
64
|
+
str.gsub(/<\/?[^>]*>/, "")
|
65
|
+
end
|
66
66
|
end
|
67
|
-
end
|
67
|
+
end
|
data/nazca.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Jacek Galanciak"]
|
10
10
|
s.email = ["jacek.galanciak@gmail.com"]
|
11
11
|
s.homepage = "http://github.com/razorjack/nazca"
|
12
|
-
s.summary = %q{Meta tags for Rails 3 views.}
|
13
|
-
s.description = %q{Rails 3 plugin that makes title and meta tags (keywords, description) easy and manageable.}
|
12
|
+
s.summary = %q{Meta tags for Rails 3 / Rails 4 views.}
|
13
|
+
s.description = %q{Rails 3 / Rails 4 plugin that makes title and meta tags (keywords, description) easy and manageable.}
|
14
14
|
|
15
15
|
s.rubyforge_project = "nazca"
|
16
16
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_dependency("rails", ["
|
22
|
+
s.add_dependency("rails", [">= 3.0"])
|
23
23
|
|
24
24
|
s.add_development_dependency "rspec", ["~> 2.0"]
|
25
25
|
end
|
metadata
CHANGED
@@ -1,69 +1,63 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: nazca
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Jacek Galanciak
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: rails
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 7
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
version: "3.0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
34
20
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rspec
|
38
21
|
prerelease: false
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
49
34
|
type: :development
|
50
|
-
|
51
|
-
|
52
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
description: Rails 3 / Rails 4 plugin that makes title and meta tags (keywords, description)
|
42
|
+
easy and manageable.
|
43
|
+
email:
|
53
44
|
- jacek.galanciak@gmail.com
|
54
45
|
executables: []
|
55
|
-
|
56
46
|
extensions: []
|
57
|
-
|
58
47
|
extra_rdoc_files: []
|
59
|
-
|
60
|
-
|
61
|
-
- .
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".travis.yml"
|
62
51
|
- Gemfile
|
63
52
|
- Gemfile.lock
|
64
53
|
- MIT-LICENSE
|
65
54
|
- README.markdown
|
66
55
|
- Rakefile
|
56
|
+
- gemfiles/rails-3-0-stable.gemfile
|
57
|
+
- gemfiles/rails-3-1-stable.gemfile
|
58
|
+
- gemfiles/rails-3-2-stable.gemfile
|
59
|
+
- gemfiles/rails-4-0-stable.gemfile
|
60
|
+
- gemfiles/rails-4-1-stable.gemfile
|
67
61
|
- lib/nazca.rb
|
68
62
|
- lib/nazca/railtie.rb
|
69
63
|
- lib/nazca/version.rb
|
@@ -71,40 +65,29 @@ files:
|
|
71
65
|
- nazca.gemspec
|
72
66
|
- spec/spec_helper.rb
|
73
67
|
- spec/view_helpers_spec.rb
|
74
|
-
has_rdoc: true
|
75
68
|
homepage: http://github.com/razorjack/nazca
|
76
69
|
licenses: []
|
77
|
-
|
70
|
+
metadata: {}
|
78
71
|
post_install_message:
|
79
72
|
rdoc_options: []
|
80
|
-
|
81
|
-
require_paths:
|
73
|
+
require_paths:
|
82
74
|
- lib
|
83
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
-
|
85
|
-
requirements:
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
86
77
|
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
version: "0"
|
92
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
|
-
requirements:
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
95
82
|
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
|
98
|
-
segments:
|
99
|
-
- 0
|
100
|
-
version: "0"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
101
85
|
requirements: []
|
102
|
-
|
103
86
|
rubyforge_project: nazca
|
104
|
-
rubygems_version:
|
87
|
+
rubygems_version: 2.2.2
|
105
88
|
signing_key:
|
106
|
-
specification_version:
|
107
|
-
summary: Meta tags for Rails 3 views.
|
108
|
-
test_files:
|
89
|
+
specification_version: 4
|
90
|
+
summary: Meta tags for Rails 3 / Rails 4 views.
|
91
|
+
test_files:
|
109
92
|
- spec/spec_helper.rb
|
110
93
|
- spec/view_helpers_spec.rb
|