metainspector 5.17.0 → 5.17.2

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
  SHA256:
3
- metadata.gz: 293357cd2d7638ce799d31024e708ba8b82ae8c6bb376304ab8b400aa959be05
4
- data.tar.gz: a358b95df5bb28c81325d8f48ff6dfff85b423054ddd25195a91d3906e04c409
3
+ metadata.gz: 2e9605e47f410256715a5a3944362e203535eaa37603f1e8cfdf4f5a94d55890
4
+ data.tar.gz: 46cdbfdb7ecfa22091777a49f81f5bf261fed551ed624a7ea80d5c7c19c51008
5
5
  SHA512:
6
- metadata.gz: 113e3d9d929b7e9df03b107ba40a5b813ce9732510ccf858764048a607074cee10208a50686f0f1b3efb952de1185dff5b1739d41d8a278ec8097de010677137
7
- data.tar.gz: 8c090ead5bb14f40a2c6c867da1e9178d6cc8665bdae7853395c28ed9ddee3de235880bc9727622964afab3ba24408c67a0a68e6b7c082ebb67f88c6a6eae42e
6
+ metadata.gz: c0f771666159eda7086cfc912fa5db8bccf00924248da36483574198716ff527d558d106b53d08d0bb774e59db70a6225b9fe3441658a387eef170a239726007
7
+ data.tar.gz: ef0d3abdf02d14777c06fdc529e20f801e6c7a7061adf2230837d877d80b0f57b3cf010b1e745444f2df442971afc2bc78b4cf20c4a41742069be1b23d4f0b9e
data/.circleci/config.yml CHANGED
@@ -1,43 +1,51 @@
1
1
  version: 2.1
2
- orbs:
3
- ruby: circleci/ruby@1.0.4
2
+
4
3
  jobs:
5
4
  test_3_2:
6
5
  docker:
7
- - image: cimg/ruby:3.2.9
6
+ - image: cimg/ruby:3.2
8
7
  steps:
9
8
  - checkout
10
- - ruby/install-deps
9
+ - run:
10
+ name: Install dependencies
11
+ command: bundle install
11
12
  - run:
12
13
  name: Run tests
13
14
  command: bundle exec rake
14
15
  test_3_3:
15
16
  docker:
16
- - image: cimg/ruby:3.3.10
17
+ - image: cimg/ruby:3.3
17
18
  steps:
18
19
  - checkout
19
- - ruby/install-deps
20
+ - run:
21
+ name: Install dependencies
22
+ command: bundle install
20
23
  - run:
21
24
  name: Run tests
22
25
  command: bundle exec rake
23
26
  test_3_4:
24
27
  docker:
25
- - image: cimg/ruby:3.4.8
28
+ - image: cimg/ruby:3.4
26
29
  steps:
27
30
  - checkout
28
- - ruby/install-deps
31
+ - run:
32
+ name: Install dependencies
33
+ command: bundle install
29
34
  - run:
30
35
  name: Run tests
31
36
  command: bundle exec rake
32
37
  test_4_0:
33
38
  docker:
34
- - image: cimg/ruby:4.0.0
39
+ - image: cimg/ruby:4.0
35
40
  steps:
36
41
  - checkout
37
- - ruby/install-deps
42
+ - run:
43
+ name: Install dependencies
44
+ command: bundle install
38
45
  - run:
39
46
  name: Run tests
40
47
  command: bundle exec rake
48
+
41
49
  workflows:
42
50
  version: 2
43
51
  deploy:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # MetaInspector Changelog
2
2
 
3
+ ## [Changes in 5.17.1](https://github.com/jaimeiniesta/metainspector/compare/v5.17.0...v5.17.1)
4
+
5
+ * Upgrade addressable and puma dependencies
6
+
7
+ ## [Changes in 5.17.0](https://github.com/jaimeiniesta/metainspector/compare/v5.16.0...v5.17.0)
8
+
9
+ * Add support for Ruby 4.0
10
+ * Remove support for Ruby 3.1
11
+ * Several dependencies upgrade
12
+
3
13
  ## [Changes in 5.16.0](https://github.com/jaimeiniesta/metainspector/compare/v5.15.0...v5.16.0)
4
14
 
5
15
  * Upgraded dependencies and supported Ruby versions.
@@ -86,7 +86,7 @@ module MetaInspector
86
86
  candidates.compact!
87
87
  candidates.map! { |c| (c.respond_to? :inner_text) ? c.inner_text : c }
88
88
  candidates.map! { |c| c.strip.gsub(/\s+/, ' ') }
89
- candidates.first
89
+ candidates.find { |c| !c.to_s.empty? }
90
90
  end
91
91
 
92
92
  def find_best_author
@@ -100,7 +100,7 @@ module MetaInspector
100
100
  candidates.compact!
101
101
  candidates.map! { |c| (c.respond_to? :inner_text) ? c.inner_text : c }
102
102
  candidates.map! { |c| c.strip.gsub(/\s+/, ' ') }
103
- candidates.first
103
+ candidates.find { |c| !c.to_s.empty? }
104
104
  end
105
105
 
106
106
  def find_best_description
@@ -1,3 +1,4 @@
1
+ require 'http/cookie'
1
2
  require 'faraday'
2
3
  require 'faraday-cookie_jar'
3
4
  require 'faraday-http-cache'
@@ -1,3 +1,3 @@
1
1
  module MetaInspector
2
- VERSION = '5.17.0'
2
+ VERSION = '5.17.2'
3
3
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency 'faraday-gzip', '>= 0.1', '< 4.0'
23
23
  gem.add_dependency 'faraday-http-cache', '~> 2.5'
24
24
  gem.add_dependency 'faraday-retry', '~> 2.0'
25
- gem.add_dependency 'addressable', '~> 2.8.4'
25
+ gem.add_dependency 'addressable', '~> 2.9.0'
26
26
  gem.add_dependency 'fastimage', '~> 2.2'
27
27
  gem.add_dependency 'nesty', '~> 1.0'
28
28
 
@@ -31,8 +31,8 @@ Gem::Specification.new do |gem|
31
31
  gem.add_development_dependency 'awesome_print', '~> 1.9'
32
32
  gem.add_development_dependency 'rake', '~> 13.0'
33
33
  gem.add_development_dependency 'pry', '~> 0.14'
34
- gem.add_development_dependency 'puma', '~> 7.0.2'
34
+ gem.add_development_dependency 'puma', '~> 8.0.0'
35
35
  gem.add_development_dependency 'rubocop', '~> 1.34'
36
- gem.add_development_dependency 'resolv', '~> 0.6.2'
36
+ gem.add_development_dependency 'resolv', '~> 0.7.1'
37
37
  gem.add_development_dependency 'sinatra', '~> 4.2.0'
38
38
  end
@@ -0,0 +1,23 @@
1
+ HTTP/1.1 200 OK
2
+ Age: 13
3
+ Cache-Control: max-age=120
4
+ Content-Type: text/html
5
+ Date: Mon, 06 Jan 2014 12:47:42 GMT
6
+ Expires: Mon, 06 Jan 2014 12:49:28 GMT
7
+ Server: Apache/2.2.14 (Ubuntu)
8
+ Vary: Accept-Encoding
9
+ Via: 1.1 varnish
10
+ X-Powered-By: PHP/5.3.2-1ubuntu4.22
11
+ X-Varnish: 1188792404 1188790413
12
+ Content-Length: 320
13
+ Connection: keep-alive
14
+
15
+ <!DOCTYPE html>
16
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
17
+ <head>
18
+ <meta name="author" content="" />
19
+ </head>
20
+ <body>
21
+ <a rel="author">This author came from the link when the meta author was empty</a>
22
+ </body>
23
+ </html>
@@ -0,0 +1,24 @@
1
+ HTTP/1.1 200 OK
2
+ Age: 13
3
+ Cache-Control: max-age=120
4
+ Content-Type: text/html
5
+ Date: Mon, 06 Jan 2014 12:47:42 GMT
6
+ Expires: Mon, 06 Jan 2014 12:49:28 GMT
7
+ Server: Apache/2.2.14 (Ubuntu)
8
+ Vary: Accept-Encoding
9
+ Via: 1.1 varnish
10
+ X-Powered-By: PHP/5.3.2-1ubuntu4.22
11
+ X-Varnish: 1188792404 1188790413
12
+ Content-Length: 365
13
+ Connection: keep-alive
14
+
15
+ <!DOCTYPE html>
16
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
17
+ <head>
18
+ <title>This title came from the head when og:title was empty</title>
19
+ <meta property="og:title" content="" />
20
+ </head>
21
+ <body>
22
+ <p>A sample page with an empty og:title that should fall through to the head title</p>
23
+ </body>
24
+ </html>
@@ -79,6 +79,11 @@ describe MetaInspector do
79
79
  expect(page.best_title).to eq('This title came from the head and has leading and trailing whitespace')
80
80
  end
81
81
 
82
+ it "should skip empty candidates and fall back to the next one" do
83
+ page = MetaInspector.new('http://example.com/title_in_head_with_empty_og_title')
84
+ expect(page.best_title).to eq('This title came from the head when og:title was empty')
85
+ end
86
+
82
87
  it "should return nil if none of the candidates are present" do
83
88
  page = MetaInspector.new('http://example.com/title_not_present')
84
89
  expect(page.best_title).to be(nil)
@@ -122,6 +127,11 @@ describe MetaInspector do
122
127
  expect(page.best_author).to eq("This author came from the twitter creator tag")
123
128
  end
124
129
 
130
+ it "should skip empty candidates and fall back to the next one" do
131
+ page = MetaInspector.new('http://example.com/author_in_link_with_empty_meta_author')
132
+ expect(page.best_author).to eq("This author came from the link when the meta author was empty")
133
+ end
134
+
125
135
  it "should return nil if no author information present" do
126
136
  page = MetaInspector.new('http://example.com/empty')
127
137
 
data/spec/spec_helper.rb CHANGED
@@ -45,10 +45,12 @@ RSpec.configure do |config|
45
45
  stub_request(:get, "http://example.com/title_in_h1").to_return(fixture_file("title_in_h1.response"))
46
46
  stub_request(:get, "http://example.com/title_in_head").to_return(fixture_file("title_in_head.response"))
47
47
  stub_request(:get, "http://example.com/title_in_head_with_whitespace").to_return(fixture_file("title_in_head_with_whitespace.response"))
48
+ stub_request(:get, "http://example.com/title_in_head_with_empty_og_title").to_return(fixture_file("title_in_head_with_empty_og_title.response"))
48
49
  stub_request(:get, "http://example.com/title_not_present").to_return(fixture_file("title_not_present.response"))
49
50
  stub_request(:get, "http://example.com/author_in_meta").to_return(fixture_file("author_in_meta.response"))
50
51
  stub_request(:get, "http://example.com/author_in_body").to_return(fixture_file("author_in_body.response"))
51
52
  stub_request(:get, "http://example.com/author_in_link").to_return(fixture_file("author_in_link.response"))
53
+ stub_request(:get, "http://example.com/author_in_link_with_empty_meta_author").to_return(fixture_file("author_in_link_with_empty_meta_author.response"))
52
54
  stub_request(:get, "http://example.com/author_in_twitter").to_return(fixture_file("author_in_twitter.response"))
53
55
  stub_request(:get, "http://example.com/?name=joe martins").to_return(fixture_file("example.response"))
54
56
  stub_request(:get, "http://example.com/?name=joe+martins").to_return(fixture_file("example.response"))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metainspector
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.17.0
4
+ version: 5.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Iniesta
@@ -133,14 +133,14 @@ dependencies:
133
133
  requirements:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
- version: 2.8.4
136
+ version: 2.9.0
137
137
  type: :runtime
138
138
  prerelease: false
139
139
  version_requirements: !ruby/object:Gem::Requirement
140
140
  requirements:
141
141
  - - "~>"
142
142
  - !ruby/object:Gem::Version
143
- version: 2.8.4
143
+ version: 2.9.0
144
144
  - !ruby/object:Gem::Dependency
145
145
  name: fastimage
146
146
  requirement: !ruby/object:Gem::Requirement
@@ -245,14 +245,14 @@ dependencies:
245
245
  requirements:
246
246
  - - "~>"
247
247
  - !ruby/object:Gem::Version
248
- version: 7.0.2
248
+ version: 8.0.0
249
249
  type: :development
250
250
  prerelease: false
251
251
  version_requirements: !ruby/object:Gem::Requirement
252
252
  requirements:
253
253
  - - "~>"
254
254
  - !ruby/object:Gem::Version
255
- version: 7.0.2
255
+ version: 8.0.0
256
256
  - !ruby/object:Gem::Dependency
257
257
  name: rubocop
258
258
  requirement: !ruby/object:Gem::Requirement
@@ -273,14 +273,14 @@ dependencies:
273
273
  requirements:
274
274
  - - "~>"
275
275
  - !ruby/object:Gem::Version
276
- version: 0.6.2
276
+ version: 0.7.1
277
277
  type: :development
278
278
  prerelease: false
279
279
  version_requirements: !ruby/object:Gem::Requirement
280
280
  requirements:
281
281
  - - "~>"
282
282
  - !ruby/object:Gem::Version
283
- version: 0.6.2
283
+ version: 0.7.1
284
284
  - !ruby/object:Gem::Dependency
285
285
  name: sinatra
286
286
  requirement: !ruby/object:Gem::Requirement
@@ -344,6 +344,7 @@ files:
344
344
  - spec/fixtures/alazan_websolution.response
345
345
  - spec/fixtures/author_in_body.response
346
346
  - spec/fixtures/author_in_link.response
347
+ - spec/fixtures/author_in_link_with_empty_meta_author.response
347
348
  - spec/fixtures/author_in_meta.response
348
349
  - spec/fixtures/author_in_twitter.response
349
350
  - spec/fixtures/broken_head_links.response
@@ -394,6 +395,7 @@ files:
394
395
  - spec/fixtures/title_in_body.response
395
396
  - spec/fixtures/title_in_h1.response
396
397
  - spec/fixtures/title_in_head.response
398
+ - spec/fixtures/title_in_head_with_empty_og_title.response
397
399
  - spec/fixtures/title_in_head_with_whitespace.response
398
400
  - spec/fixtures/title_not_present.response
399
401
  - spec/fixtures/twitter_markupvalidator.response