metatag_cop 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b699a58b7d2c344ba5162cc93dd6fa00627e4d9
4
- data.tar.gz: 961c0ca29e2fcc37aeec5ba42c4fe44a878ef814
3
+ metadata.gz: 35678b5fe8efcdcaaeadb0a8674499dca32641f7
4
+ data.tar.gz: 947de54b6c3bff07bd88e8c27e8df89c11ad9be3
5
5
  SHA512:
6
- metadata.gz: b1d83924b720e8f865ffd8ddcb6e2293f580714bcc2d0108a93bbff5816ad04efc412b06171c3422ba63d7a11a99c0ef3bdc1ec7902baa6ac5fd07dc7e0e9227
7
- data.tar.gz: 197316a16bf961c78a8c5306c659954bdf67ca59c3c4bd5882b3ffa96880f3ec3224a43c96dc9a7cc1042cb7d7882813c982afda4b5a0cd996ae77768d587ba0
6
+ metadata.gz: 4734bbcd13f42db37f47544d31264f5a733debcd680a646ce8b2c400858e14243428f755a89c539133b993eb4ffea5a1a215fe357466c7053bb51cc14dc03e52
7
+ data.tar.gz: 025fc2becf5d887e5b0a4397ec3df5cb3d7c106721db7c34bd6304e3b2e85d235c4a06d8c60d767bdf672d2ff80cc7fd42f5bb89919088e913e80c0249464305
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # MetatagCop
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/metatag_cop`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ MetatagCop loads csv file and checks whether meta tags is set proper value.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,18 +20,23 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ 1. Prepare csv file like this.
26
24
 
27
- ## Development
25
+ ```
26
+ url, title, description, h1
27
+ https://www.google.co.jp/, exepected title here, exepected description here, exepected h1 here
28
+ https://www.google.com/doodles, exepected title here, exepected description here, exepected h1 here
29
+ ```
28
30
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
31
+ 2. Run ` $ metatag_cop file_path `
30
32
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
33
+ ## Development
32
34
 
33
- ## Contributing
35
+ - TODO
34
36
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/metatag_cop. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
37
+ ## Contributing
36
38
 
39
+ - TODO
37
40
 
38
41
  ## License
39
42
 
@@ -18,15 +18,19 @@ module MetatagCop
18
18
  end
19
19
 
20
20
  def description
21
- document.at('meta[name=description]')['content']
21
+ description = document.at('meta[name=description]')
22
+ description['content'] unless description.nil?
22
23
  end
23
24
 
24
25
  def keywords
25
- document.at('meta[name=keywords]')['content']
26
+ keywords = document.at('meta[name=keywords]')
27
+ keywords['content'] unless keywords.nil?
26
28
  end
27
29
 
28
30
  def h1
29
31
  h1 = document.at('h1')
32
+
33
+ return if h1.nil?
30
34
  return h1['content'] unless h1['content'].nil?
31
35
 
32
36
  # it regards alt as h1 content if h1 content is blank.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MetatagCop
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
data/sample/sample.csv ADDED
@@ -0,0 +1,3 @@
1
+ url,title,description,keywords,h1
2
+ https://www.google.co.jp/,exepected title here,exepected description here,exepected keywords here,exepected h1 here
3
+ https://www.google.com/doodles,exepected title here,exepected description here,exepected keywords here,exepected h1 here
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metatag_cop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - tackeyy
@@ -97,6 +97,7 @@ files:
97
97
  - lib/metatag_cop/parser.rb
98
98
  - lib/metatag_cop/version.rb
99
99
  - metatag_cop.gemspec
100
+ - sample/sample.csv
100
101
  homepage: http://tackeyy.com/
101
102
  licenses:
102
103
  - MIT