metainspector 1.12.1 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), 'meta_inspector/scraper'))
4
- require File.expand_path(File.join(File.dirname(__FILE__), 'meta_inspector/open_uri'))
5
4
 
6
5
  module MetaInspector
7
6
  extend self
@@ -1,6 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  require 'open-uri'
4
+ require 'open_uri_redirections'
4
5
  require 'nokogiri'
5
6
  require 'hashie/rash'
6
7
  require 'timeout'
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module MetaInspector
4
- VERSION = "1.12.1"
4
+ VERSION = "1.13.0"
5
5
  end
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
16
16
 
17
17
  gem.add_dependency 'nokogiri', '~> 1.5'
18
18
  gem.add_dependency 'rash', '0.3.2'
19
+ gem.add_dependency 'open_uri_redirections', '0.0.1'
19
20
 
20
21
  gem.add_development_dependency 'rspec', '2.12.0'
21
22
  gem.add_development_dependency 'fakeweb', '1.3.0'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metainspector
3
3
  version: !ruby/object:Gem::Version
4
- hash: 37
4
+ hash: 35
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 12
9
- - 1
10
- version: 1.12.1
8
+ - 13
9
+ - 0
10
+ version: 1.13.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jaime Iniesta
@@ -49,9 +49,25 @@ dependencies:
49
49
  type: :runtime
50
50
  version_requirements: *id002
51
51
  - !ruby/object:Gem::Dependency
52
- name: rspec
52
+ name: open_uri_redirections
53
53
  prerelease: false
54
54
  requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - "="
58
+ - !ruby/object:Gem::Version
59
+ hash: 29
60
+ segments:
61
+ - 0
62
+ - 0
63
+ - 1
64
+ version: 0.0.1
65
+ type: :runtime
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: rspec
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
55
71
  none: false
56
72
  requirements:
57
73
  - - "="
@@ -63,11 +79,11 @@ dependencies:
63
79
  - 0
64
80
  version: 2.12.0
65
81
  type: :development
66
- version_requirements: *id003
82
+ version_requirements: *id004
67
83
  - !ruby/object:Gem::Dependency
68
84
  name: fakeweb
69
85
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
86
+ requirement: &id005 !ruby/object:Gem::Requirement
71
87
  none: false
72
88
  requirements:
73
89
  - - "="
@@ -79,11 +95,11 @@ dependencies:
79
95
  - 0
80
96
  version: 1.3.0
81
97
  type: :development
82
- version_requirements: *id004
98
+ version_requirements: *id005
83
99
  - !ruby/object:Gem::Dependency
84
100
  name: awesome_print
85
101
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
102
+ requirement: &id006 !ruby/object:Gem::Requirement
87
103
  none: false
88
104
  requirements:
89
105
  - - "="
@@ -95,11 +111,11 @@ dependencies:
95
111
  - 0
96
112
  version: 1.1.0
97
113
  type: :development
98
- version_requirements: *id005
114
+ version_requirements: *id006
99
115
  - !ruby/object:Gem::Dependency
100
116
  name: rake
101
117
  prerelease: false
102
- requirement: &id006 !ruby/object:Gem::Requirement
118
+ requirement: &id007 !ruby/object:Gem::Requirement
103
119
  none: false
104
120
  requirements:
105
121
  - - "="
@@ -111,7 +127,7 @@ dependencies:
111
127
  - 2
112
128
  version: 10.0.2
113
129
  type: :development
114
- version_requirements: *id006
130
+ version_requirements: *id007
115
131
  description: MetaInspector lets you scrape a web page and get its title, charset, link and meta tags
116
132
  email:
117
133
  - jaimeiniesta@gmail.com
@@ -130,7 +146,6 @@ files:
130
146
  - README.md
131
147
  - Rakefile
132
148
  - lib/meta_inspector.rb
133
- - lib/meta_inspector/open_uri.rb
134
149
  - lib/meta_inspector/scraper.rb
135
150
  - lib/meta_inspector/version.rb
136
151
  - lib/metainspector.rb
@@ -1,50 +0,0 @@
1
- # Patch to allow open-uri to follow safe (http to https) and unsafe redirects (https to http).
2
- # Original gist URL:
3
- # https://gist.github.com/1271420
4
- #
5
- # Relevant issue:
6
- # http://redmine.ruby-lang.org/issues/3719
7
- #
8
- # Source here:
9
- # https://github.com/ruby/ruby/blob/trunk/lib/open-uri.rb
10
-
11
- module OpenURI
12
- class <<self
13
- alias_method :open_uri_original, :open_uri
14
- alias_method :redirectable_cautious?, :redirectable?
15
-
16
- def redirectable_safe?(uri1, uri2)
17
- uri1.scheme.downcase == uri2.scheme.downcase || (uri1.scheme.downcase == "http" && uri2.scheme.downcase == "https")
18
- end
19
-
20
- def redirectable_unsafe?(uri1, uri2)
21
- !redirectable_safe?(uri1, uri2)
22
- end
23
- end
24
-
25
- # The original open_uri takes *args but then doesn't do anything with them.
26
- # Assume we can only handle a hash.
27
- def self.open_uri(name, options = {})
28
- redirectable_unsafe = options.delete :allow_unsafe_redirections
29
- redirectable_safe = options.delete :allow_safe_redirections
30
-
31
- if redirectable_unsafe
32
- class <<self
33
- remove_method :redirectable?
34
- alias_method :redirectable?, :redirectable_unsafe?
35
- end
36
- elsif redirectable_safe
37
- class <<self
38
- remove_method :redirectable?
39
- alias_method :redirectable?, :redirectable_safe?
40
- end
41
- else
42
- class <<self
43
- remove_method :redirectable?
44
- alias_method :redirectable?, :redirectable_cautious?
45
- end
46
- end
47
-
48
- self.open_uri_original name, options
49
- end
50
- end