metainspector 5.0.0.rc1 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb39fe43b5a67a67f0543043ded76d44001eb677
4
- data.tar.gz: 3183a8d0f564b3acda845436470b07b466345050
3
+ metadata.gz: 70611d34eb28467a1b3ae1950b4e56f62e27aad1
4
+ data.tar.gz: 39eed33ee8c1a90dd48734ee74caafe68da97c92
5
5
  SHA512:
6
- metadata.gz: f0d5f4b1dda14174e082956f354c4995b34525f0da33c81c002f422dc12d06c3af9eed5b919c39030daedc3305957ed54dc7462d596e564d51cb9d3b38f069c7
7
- data.tar.gz: 478ef7aef64b6310106733dd32bdd111e9342a84831d93369d35d275149196613acea262e02d3c058ce0b2daeb55aed4b1729a886031e7a7697df1e3f72b6017
6
+ metadata.gz: aafccfa73f466485093c4eb7c8af88593557fd124fbfa945034080606ed4aeec32a89d115f3e397e03eaff3045b1268ba16e03ba2737a0da5ccd728370fc8491
7
+ data.tar.gz: ccaa60674d85635828f6dc835351011b841f1e53f385e1a68e0d579dcdba7ccdaf381e1cf1a58085d1e07243f2a0428e4d31ea346050d7ba24988f43f3175f61
@@ -1,3 +1,4 @@
1
1
  rvm:
2
2
  - 2.0.0
3
- - 2.1.3
3
+ - 2.1.8
4
+ - 2.2.4
data/README.md CHANGED
@@ -22,7 +22,7 @@ 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
- This gem is tested on Ruby versions 2.0.0 and 2.1.3.
25
+ This gem is tested on Ruby versions 2.0.0, 2.1.8 and 2.2.4.
26
26
 
27
27
  ## Usage
28
28
 
@@ -322,7 +322,7 @@ customize the way we request the page, like for example disabling SSL verificati
322
322
  MetaInspector.new('https://example.com')
323
323
  # Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
324
324
 
325
- MetaInpector.new('https://example.com', faraday_options: { ssl: { verify: false } })
325
+ MetaInspector.new('https://example.com', faraday_options: { ssl: { verify: false } })
326
326
  # Now we can access the page
327
327
  ```
328
328
 
@@ -37,7 +37,7 @@ module MetaInspector
37
37
  @response ||= fetch
38
38
  rescue Faraday::TimeoutError => e
39
39
  raise MetaInspector::TimeoutError.new(e)
40
- rescue Faraday::Error::ConnectionFailed, Faraday::SSLError, URI::InvalidURIError => e
40
+ rescue Faraday::Error::ConnectionFailed, Faraday::SSLError, URI::InvalidURIError, FaradayMiddleware::RedirectLimitReached => e
41
41
  raise MetaInspector::RequestError.new(e)
42
42
  end
43
43
 
@@ -62,7 +62,7 @@ module MetaInspector
62
62
  else
63
63
  Addressable::URI.join(base_url, url).normalize.to_s
64
64
  end
65
- rescue MetaInspector::ParserError
65
+ rescue MetaInspector::ParserError, Addressable::URI::InvalidURIError
66
66
  nil
67
67
  end
68
68
 
@@ -1,3 +1,3 @@
1
1
  module MetaInspector
2
- VERSION = '5.0.0.rc1'
2
+ VERSION = '5.0.0'
3
3
  end
@@ -15,12 +15,12 @@ Gem::Specification.new do |gem|
15
15
  gem.version = MetaInspector::VERSION
16
16
 
17
17
  gem.add_dependency 'nokogiri', '~> 1.6'
18
- gem.add_dependency 'faraday', '~> 0.9.0'
18
+ gem.add_dependency 'faraday', '~> 0.9'
19
19
  gem.add_dependency 'faraday_middleware', '~> 0.10'
20
- gem.add_dependency 'faraday-cookie_jar', '~> 0.0.6'
21
- gem.add_dependency 'faraday-http-cache', '~> 1.2.2'
22
- gem.add_dependency 'addressable', '~> 2.3.5'
23
- gem.add_dependency 'fastimage'
20
+ gem.add_dependency 'faraday-cookie_jar', '~> 0.0'
21
+ gem.add_dependency 'faraday-http-cache', '~> 1.2'
22
+ gem.add_dependency 'addressable', '~> 2.4'
23
+ gem.add_dependency 'fastimage', '~> 1.8'
24
24
  gem.add_dependency 'nesty', '~> 1.0'
25
25
 
26
26
  gem.add_development_dependency 'rspec', '~> 3.0'
@@ -101,9 +101,9 @@ describe MetaInspector do
101
101
  end
102
102
  end
103
103
 
104
- it "should not crash with links that have weird href values" do
104
+ it "should not crash with links that have weird href values, filtering them out" do
105
105
  m = MetaInspector.new('http://example.com/invalid_href')
106
- expect(m.links.non_http).to eq(["%3Cp%3Eftp://ftp.cdrom.com", "skype:joeuser?call", "telnet://telnet.cdrom.com"])
106
+ expect(m.links.non_http).to eq(["skype:joeuser?call", "telnet://telnet.cdrom.com"])
107
107
  end
108
108
  end
109
109
 
@@ -18,6 +18,21 @@ describe MetaInspector do
18
18
  end
19
19
  end
20
20
 
21
+ context "when there are too many redirects" do
22
+ before(:all) { WebMock.enable! }
23
+ after(:all) { WebMock.disable! }
24
+
25
+ before do
26
+ 12.times { |i| register_redirect(i, i+1) }
27
+ end
28
+
29
+ it "raises an error" do
30
+ expect {
31
+ MetaInspector.new("http://example.org/1")
32
+ }.to raise_error MetaInspector::RequestError
33
+ end
34
+ end
35
+
21
36
  context "when there are cookies required for proper redirection" do
22
37
  before(:all) { WebMock.enable! }
23
38
  after(:all) { WebMock.disable! }
@@ -39,4 +54,11 @@ describe MetaInspector do
39
54
  end
40
55
  end
41
56
  end
57
+
58
+ private
59
+
60
+ def register_redirect(from, to)
61
+ stub_request(:get, "http://example.org/#{from}")
62
+ .to_return(:status => 302, :body => "", :headers => { "Location" => "http://example.org/#{to}" })
63
+ end
42
64
  end
@@ -63,6 +63,14 @@ describe MetaInspector::Request do
63
63
  MetaInspector::Request.new(url('http://example.com/fail'))
64
64
  end.to raise_error(MetaInspector::RequestError)
65
65
  end
66
+
67
+ it "should handle ssl errors" do
68
+ allow(TCPSocket).to receive(:open).and_raise(OpenSSL::SSL::SSLError)
69
+
70
+ expect do
71
+ MetaInspector::Request.new(url('https://example.com'))
72
+ end.to raise_error(MetaInspector::RequestError)
73
+ end
66
74
  end
67
75
 
68
76
  private
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.0.0.rc1
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Iniesta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-18 00:00:00.000000000 Z
11
+ date: 2015-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.0
33
+ version: '0.9'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.9.0
40
+ version: '0.9'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faraday_middleware
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,56 +58,56 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.0.6
61
+ version: '0.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.0.6
68
+ version: '0.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: faraday-http-cache
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.2.2
75
+ version: '1.2'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.2.2
82
+ version: '1.2'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: addressable
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 2.3.5
89
+ version: '2.4'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 2.3.5
96
+ version: '2.4'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: fastimage
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '1.8'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '1.8'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: nesty
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -360,12 +360,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
360
360
  version: '0'
361
361
  required_rubygems_version: !ruby/object:Gem::Requirement
362
362
  requirements:
363
- - - ">"
363
+ - - ">="
364
364
  - !ruby/object:Gem::Version
365
- version: 1.3.1
365
+ version: '0'
366
366
  requirements: []
367
367
  rubyforge_project:
368
- rubygems_version: 2.4.8
368
+ rubygems_version: 2.2.2
369
369
  signing_key:
370
370
  specification_version: 4
371
371
  summary: MetaInspector is a ruby gem for web scraping purposes, that returns metadata