metainspector 5.10.0 → 5.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/lib/meta_inspector/parsers/links.rb +2 -1
- data/lib/meta_inspector/version.rb +1 -1
- data/spec/fixtures/relative_links_with_empty_base.response +22 -0
- data/spec/meta_inspector/links_spec.rb +7 -0
- data/spec/spec_helper.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97b670ec8a7026383d659037318206d8262e17bbc35b0ec51f34609b6a6ebc95
|
4
|
+
data.tar.gz: 326230360c0199174e39bf495e00de74057a208e155ca0f4ec584f9e728f59bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e89cc17ea97453f74935883267851f1a2f0e1a9255ea5a1a259a850950d9633227a41f4ed06af0b43a7e1f1a2331368b274c7a715ea6779e3ba60e616e11aa7
|
7
|
+
data.tar.gz: 656a52071ada09f4ac45703f1a688ec85f17f30b5e89f9f1965f81478c21ad3feb651df7773caf5a447c07bea6ee78cb84505f53f5ab5ac689a847ccbdb5ee15
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# MetaInpector Changelog
|
2
2
|
|
3
|
+
## [Changes in 5.10](https://github.com/jaimeiniesta/metainspector/compare/v5.9.0...v5.10.0)
|
4
|
+
|
5
|
+
* Upgrade to Faraday 1.0.
|
6
|
+
|
3
7
|
## [Changes in 5.9](https://github.com/jaimeiniesta/metainspector/compare/v5.8.0...v5.9.0)
|
4
8
|
|
5
9
|
* Added #feeds method to retrieve all feeds of a page.
|
data/README.md
CHANGED
@@ -22,6 +22,8 @@ If you're using it on a Rails application, just add it to your Gemfile and run `
|
|
22
22
|
gem 'metainspector'
|
23
23
|
```
|
24
24
|
|
25
|
+
Supported Ruby versions are defined in [`.travis.yml`](.travis.yml).
|
26
|
+
|
25
27
|
## Usage
|
26
28
|
|
27
29
|
Initialize a MetaInspector instance for an URL, like this:
|
@@ -47,7 +47,8 @@ module MetaInspector
|
|
47
47
|
# This can be the one set on a <base> tag,
|
48
48
|
# or the url of the document if no <base> tag was found.
|
49
49
|
def base_url
|
50
|
-
base_href
|
50
|
+
current_base_href = base_href.to_s.strip.empty? ? nil : base_href
|
51
|
+
current_base_href || url
|
51
52
|
end
|
52
53
|
|
53
54
|
# Returns the value of the href attribute on the <base /> tag, if exists
|
@@ -0,0 +1,22 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: nginx/1.0.5
|
3
|
+
Date: Thu, 29 Dec 2011 23:10:13 GMT
|
4
|
+
Content-Type: text/html
|
5
|
+
Content-Length: 15013
|
6
|
+
Last-Modified: Fri, 02 Dec 2011 21:00:49 GMT
|
7
|
+
Connection: keep-alive
|
8
|
+
Accept-Ranges: bytes
|
9
|
+
|
10
|
+
<!DOCTYPE html>
|
11
|
+
<html>
|
12
|
+
<head>
|
13
|
+
<base href=""/>
|
14
|
+
<meta charset="utf-8" />
|
15
|
+
<title>Relative links</title>
|
16
|
+
</head>
|
17
|
+
<body>
|
18
|
+
<p>Relative links</p>
|
19
|
+
<a href="about">About</a>
|
20
|
+
<a href="../sitemap">Sitemap</a>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -145,6 +145,13 @@ describe MetaInspector do
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
+
describe 'Relative links with empty or blank base' do
|
149
|
+
it 'should get the relative links from a document' do
|
150
|
+
m = MetaInspector.new('http://relativewithemptybase.com/company')
|
151
|
+
expect(m.links.internal).to eq(['http://relativewithemptybase.com/about', 'http://relativewithemptybase.com/sitemap'])
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
148
155
|
describe 'Relative links with base' do
|
149
156
|
it 'should get the relative links from a document' do
|
150
157
|
m = MetaInspector.new('http://relativewithbase.com/company/page2')
|
data/spec/spec_helper.rb
CHANGED
@@ -65,6 +65,7 @@ RSpec.configure do |config|
|
|
65
65
|
stub_request(:get, "http://relativewithbase.com/").to_return(fixture_file("relative_links_with_base.response"))
|
66
66
|
stub_request(:get, "http://relativewithbase.com/company/page2").to_return(fixture_file("relative_links_with_base.response"))
|
67
67
|
stub_request(:get, "http://relativewithbase.com/company/page2/").to_return(fixture_file("relative_links_with_base.response"))
|
68
|
+
stub_request(:get, "http://relativewithemptybase.com/company").to_return(fixture_file("relative_links_with_empty_base.response"))
|
68
69
|
stub_request(:get, "http://theonion-no-description.com").to_return(fixture_file("theonion-no-description.com.response"))
|
69
70
|
stub_request(:get, "http://www.24-horas.mx/mexico-firma-acuerdo-bilateral-automotriz-con-argentina/").to_return(fixture_file("relative_og_image.response"))
|
70
71
|
stub_request(:get, "http://www.alazan.com").to_return(fixture_file("alazan.com.response"))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metainspector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.10.
|
4
|
+
version: 5.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaime Iniesta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -302,6 +302,7 @@ files:
|
|
302
302
|
- spec/fixtures/protocol_relative.response
|
303
303
|
- spec/fixtures/relative_links.response
|
304
304
|
- spec/fixtures/relative_links_with_base.response
|
305
|
+
- spec/fixtures/relative_links_with_empty_base.response
|
305
306
|
- spec/fixtures/relative_og_image.response
|
306
307
|
- spec/fixtures/theonion-no-description.com.response
|
307
308
|
- spec/fixtures/theonion.com.response
|