middleman-generator-tag 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 424945de32b543333f0e9dd7f4b0f73c1f2d6718
4
+ data.tar.gz: 9212fc5add4413be8092b314b66e91de9a5d8ef4
5
+ SHA512:
6
+ metadata.gz: 9fc63cff5c29546753fcf1c2e23f93eaab0c337e281e5c11334ca0a290c041419458fd3558f2da197e4c5f8193995b9c85bbbc19431b4f8c6acd84d0818fa871
7
+ data.tar.gz: 60c5774ef17c92d3f06a2b96d33a14307beba92d607c923a11b3893b3bfc9a53caec178c2504a2969db6ae835ca0f4dd195a7b5a3a633ad0bc0149959baa5be2
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/.travis.yml ADDED
@@ -0,0 +1,24 @@
1
+ language: ruby
2
+ sudo: false
3
+ rvm:
4
+ - ruby-head
5
+ - jruby-head
6
+ - jruby-19mode
7
+ - 2.2
8
+ - 2.1
9
+ - 2.0
10
+ os:
11
+ - linux
12
+ - osx
13
+ matrix:
14
+ fast_finish: true
15
+ allow_failures:
16
+ - rvm: ruby-head
17
+ - rvm: jruby-19mode
18
+ - rvm: jruby-head
19
+ script: bundle exec cucumber
20
+ cache: bundler
21
+ env: TEST=true
22
+ notifications:
23
+ slack:
24
+ secure: OOP0jFNrVVXj/k7VQwMIjimYDZoOKatD4LHORmU8bYNUYCZdMUC1qp8MZ/TlLOx1+P9/SD0U8UWfGSQGOa0y9a5q0iQYCxDDjaJp612DOoLPO0sp4jRKmf7d2eERILZPgjQnsedyr9niKfJqqnBLFmqOVSpEpC6iWjLZeaQFcsg=
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in middleman-generator-tag.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Yuya Terajima
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,36 @@
1
+ # middleman-generator-tag
2
+
3
+ middleman-generator-tag is a plugin for Middleman.
4
+ This plugin always insert '<meta name='generator' content="Middleman vX.X.X">` into html.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'middleman-generator-tag'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install middleman-generator-tag
21
+
22
+ ## Usage
23
+
24
+ In config.rb:
25
+
26
+ ```ruby
27
+ activate :generator_tag
28
+ ```
29
+
30
+ ## Contributing
31
+
32
+ 1. Fork it ( https://github.com/yterajima/middleman-generator-tag/fork )
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
34
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
35
+ 4. Push to the branch (`git push origin my-new-feature`)
36
+ 5. Create a new Pull Request
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 "middleman/generator/tag"
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
File without changes
@@ -0,0 +1 @@
1
+ activate :generator_tag
@@ -0,0 +1,14 @@
1
+ ---
2
+ layout: false
3
+ ---
4
+ <!DOCTYPE html>
5
+ <html>
6
+ <head>
7
+ <meta charset="utf-8">
8
+ <title>Title</title>
9
+ <meta name="keyword" content="something">
10
+ <meta name="description" content="something description">
11
+ </head>
12
+ <body>
13
+ </body>
14
+ </html>
@@ -0,0 +1,29 @@
1
+ module Middleman
2
+ module GeneratorTag
3
+ class Extension < ::Middleman::Extension
4
+ def initialize(app, options_hash = {}, &block)
5
+ super
6
+
7
+ extension = self
8
+ app.after_render do |content, path, locs|
9
+ if /<html>/ =~ content
10
+ html = Nokogiri::HTML(content)
11
+ if html.css("meta[name='generator']").length == 0
12
+ content = extension.insert_tag(html)
13
+ end
14
+ content
15
+ end
16
+ end
17
+ end
18
+
19
+ def insert_tag(html)
20
+ title = html.at_css('title')
21
+ meta = Nokogiri::XML::Node.new "meta", html
22
+ meta[:name] = 'generator'
23
+ meta[:content] = "Middleman v#{::Middleman::VERSION}"
24
+ title.add_next_sibling(meta)
25
+ html.to_s
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ module Middleman
2
+ module GeneratorTag
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'middleman-core'
2
+ require 'middleman-generator-tag/version'
3
+
4
+ ::Middleman::Extensions.register(:generator_tag) do
5
+ require 'middleman-generator-tag/extension'
6
+ ::Middleman::GeneratorTag::Extension
7
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'middleman-generator-tag/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "middleman-generator-tag"
8
+ spec.version = Middleman::GeneratorTag::VERSION
9
+ spec.authors = ["Yuya Terajima"]
10
+ spec.email = ["terra@e2esound.com"]
11
+
12
+ spec.summary = %q{Add generator meta tag in html files.}
13
+ spec.description = %q{Add generator meta tag in html files.}
14
+ spec.homepage = "https://github.com/yterajima/middleman-generator-tag"
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 = '>= 2.0.0'
23
+
24
+ spec.add_runtime_dependency "middleman", "~> 3.3"
25
+ spec.add_runtime_dependency "nokogiri", "~> 1.6"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.7"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "cucumber", "~> 1.3"
30
+ spec.add_development_dependency "aruba", "~> 0.6"
31
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middleman-generator-tag
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yuya Terajima
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: middleman
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: cucumber
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: aruba
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.6'
97
+ description: Add generator meta tag in html files.
98
+ email:
99
+ - terra@e2esound.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".travis.yml"
106
+ - CODE_OF_CONDUCT.md
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/console
112
+ - bin/setup
113
+ - fixtures/empty-app/config.rb
114
+ - fixtures/tag-app/config.rb
115
+ - fixtures/tag-app/source/index.html.erb
116
+ - lib/middleman-generator-tag.rb
117
+ - lib/middleman-generator-tag/extension.rb
118
+ - lib/middleman-generator-tag/version.rb
119
+ - middleman-generator-tag.gemspec
120
+ homepage: https://github.com/yterajima/middleman-generator-tag
121
+ licenses:
122
+ - MIT
123
+ metadata: {}
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 2.0.0
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.4.5
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: Add generator meta tag in html files.
144
+ test_files: []