flavicon 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +90 -0
- data/LICENSE.txt +20 -0
- data/README.md +21 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/lib/flavicon.rb +7 -0
- data/lib/flavicon/finder.rb +60 -0
- data/spec/fixtures/absolute.html +8 -0
- data/spec/fixtures/missing.html +8 -0
- data/spec/fixtures/multiple.html +9 -0
- data/spec/fixtures/relative.html +8 -0
- data/spec/flavicon/finder_spec.rb +133 -0
- data/spec/flavicon_spec.rb +18 -0
- data/spec/spec_helper.rb +33 -0
- metadata +177 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2fa853720ba3467ae1e98ffc4867714d2396e37e
|
4
|
+
data.tar.gz: f35b0bbc8a07845cf6c66e00a49576fafec4926e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ee1f8fda545e3927f39c8551975f63fca9ab7bd7a6c7c9dcb91ed88efa17100315d8eeb3b13a2172be33433417d2d48d2a2a0e28fe2b318a08265c9a15c37366
|
7
|
+
data.tar.gz: 6f115a44c07cc3069bb88dbb1a40908a14c2bc2370e9e435f399485d1df9d8fcd98cffca2827b14b7a8c2b56b5b3fdbf2fac7c8c6932f4d06ad3bf7f8f8cc3a2
|
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
flavicon
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.1
|
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'nokogiri', '~> 1.6'
|
4
|
+
|
5
|
+
# Add dependencies to develop your gem here.
|
6
|
+
# Include everything needed to run rake, tests, features, etc.
|
7
|
+
group :development do
|
8
|
+
gem 'rspec', '~> 2.14'
|
9
|
+
gem 'webmock', '~> 1.17'
|
10
|
+
gem 'rdoc', '~> 3.12'
|
11
|
+
gem 'bundler', '~> 1.0'
|
12
|
+
gem 'jeweler', '~> 2.0'
|
13
|
+
gem 'simplecov', '~> 0'
|
14
|
+
gem 'pry', '~> 0'
|
15
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.3.6)
|
5
|
+
builder (3.2.2)
|
6
|
+
coderay (1.1.0)
|
7
|
+
crack (0.4.2)
|
8
|
+
safe_yaml (~> 1.0.0)
|
9
|
+
descendants_tracker (0.0.4)
|
10
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
docile (1.1.3)
|
13
|
+
faraday (0.9.0)
|
14
|
+
multipart-post (>= 1.2, < 3)
|
15
|
+
git (1.2.6)
|
16
|
+
github_api (0.11.3)
|
17
|
+
addressable (~> 2.3)
|
18
|
+
descendants_tracker (~> 0.0.1)
|
19
|
+
faraday (~> 0.8, < 0.10)
|
20
|
+
hashie (>= 1.2)
|
21
|
+
multi_json (>= 1.7.5, < 2.0)
|
22
|
+
nokogiri (~> 1.6.0)
|
23
|
+
oauth2
|
24
|
+
hashie (2.1.1)
|
25
|
+
highline (1.6.21)
|
26
|
+
jeweler (2.0.1)
|
27
|
+
builder
|
28
|
+
bundler (>= 1.0)
|
29
|
+
git (>= 1.2.5)
|
30
|
+
github_api
|
31
|
+
highline (>= 1.6.15)
|
32
|
+
nokogiri (>= 1.5.10)
|
33
|
+
rake
|
34
|
+
rdoc
|
35
|
+
json (1.8.1)
|
36
|
+
jwt (0.1.11)
|
37
|
+
multi_json (>= 1.5)
|
38
|
+
method_source (0.8.2)
|
39
|
+
mini_portile (0.5.3)
|
40
|
+
multi_json (1.9.2)
|
41
|
+
multi_xml (0.5.5)
|
42
|
+
multipart-post (2.0.0)
|
43
|
+
nokogiri (1.6.1)
|
44
|
+
mini_portile (~> 0.5.0)
|
45
|
+
oauth2 (0.9.3)
|
46
|
+
faraday (>= 0.8, < 0.10)
|
47
|
+
jwt (~> 0.1.8)
|
48
|
+
multi_json (~> 1.3)
|
49
|
+
multi_xml (~> 0.5)
|
50
|
+
rack (~> 1.2)
|
51
|
+
pry (0.9.12.6)
|
52
|
+
coderay (~> 1.0)
|
53
|
+
method_source (~> 0.8)
|
54
|
+
slop (~> 3.4)
|
55
|
+
rack (1.5.2)
|
56
|
+
rake (10.3.1)
|
57
|
+
rdoc (3.12.2)
|
58
|
+
json (~> 1.4)
|
59
|
+
rspec (2.14.1)
|
60
|
+
rspec-core (~> 2.14.0)
|
61
|
+
rspec-expectations (~> 2.14.0)
|
62
|
+
rspec-mocks (~> 2.14.0)
|
63
|
+
rspec-core (2.14.8)
|
64
|
+
rspec-expectations (2.14.5)
|
65
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
66
|
+
rspec-mocks (2.14.6)
|
67
|
+
safe_yaml (1.0.2)
|
68
|
+
simplecov (0.8.2)
|
69
|
+
docile (~> 1.1.0)
|
70
|
+
multi_json
|
71
|
+
simplecov-html (~> 0.8.0)
|
72
|
+
simplecov-html (0.8.0)
|
73
|
+
slop (3.5.0)
|
74
|
+
thread_safe (0.3.3)
|
75
|
+
webmock (1.17.4)
|
76
|
+
addressable (>= 2.2.7)
|
77
|
+
crack (>= 0.3.2)
|
78
|
+
|
79
|
+
PLATFORMS
|
80
|
+
ruby
|
81
|
+
|
82
|
+
DEPENDENCIES
|
83
|
+
bundler (~> 1.0)
|
84
|
+
jeweler (~> 2.0)
|
85
|
+
nokogiri (~> 1.6)
|
86
|
+
pry (~> 0)
|
87
|
+
rdoc (~> 3.12)
|
88
|
+
rspec (~> 2.14)
|
89
|
+
simplecov (~> 0)
|
90
|
+
webmock (~> 1.17)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Hamed Asghari
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# flavicon
|
2
|
+
|
3
|
+
Disclaimer: This is a rewrite of the [www-favicon](https://github.com/youpy/www-favicon) gem for a couple reasons:
|
4
|
+
|
5
|
+
1. Update the project structure to conform to rubygems.org conventions
|
6
|
+
2. Handle relative URLs as the value for a Location header field on redirect responses.
|
7
|
+
|
8
|
+
## Contributing to flavicon
|
9
|
+
|
10
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
11
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
12
|
+
* Fork the project.
|
13
|
+
* Start a feature/bugfix branch.
|
14
|
+
* Commit and push until you are happy with your contribution.
|
15
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
16
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
17
|
+
|
18
|
+
## Copyright
|
19
|
+
|
20
|
+
Copyright (c) 2014 Hamed Asghari. See LICENSE.txt for further details.
|
21
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = 'flavicon'
|
18
|
+
gem.homepage = 'http://github.com/hasghari/flavicon'
|
19
|
+
gem.license = 'MIT'
|
20
|
+
gem.summary = 'fetch favicon url for provided url'
|
21
|
+
gem.description = 'fetch favicon url by parsing html and falling back on /favicon.ico as default'
|
22
|
+
gem.email = 'hasghari@gmail.com'
|
23
|
+
gem.authors = ['Hamed Asghari']
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'Code coverage detail'
|
35
|
+
task :simplecov do
|
36
|
+
ENV['COVERAGE'] = 'true'
|
37
|
+
Rake::Task['spec'].execute
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rdoc/task'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "flavicon #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/flavicon.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
module Flavicon
|
2
|
+
class Finder < Struct.new(:url)
|
3
|
+
require 'uri'
|
4
|
+
require 'net/http'
|
5
|
+
require 'nokogiri'
|
6
|
+
|
7
|
+
TooManyRedirects = Class.new(StandardError)
|
8
|
+
|
9
|
+
def find
|
10
|
+
response, resolved = request(url)
|
11
|
+
favicon_url = extract_from_html(response.body, resolved) || default_path(resolved)
|
12
|
+
valid_favicon_url?(favicon_url) ? favicon_url : nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def valid_favicon_url?(url)
|
16
|
+
response, _ = request(url)
|
17
|
+
response.is_a?(Net::HTTPSuccess) && response.body.to_s != '' && response.content_type =~ /image/i
|
18
|
+
end
|
19
|
+
|
20
|
+
def extract_from_html(html, url)
|
21
|
+
link = Nokogiri::HTML(html).css('head link').find do |link|
|
22
|
+
link[:rel] =~ /\A(shortcut )?icon\z/i
|
23
|
+
end
|
24
|
+
|
25
|
+
URI.join(url, link[:href]).to_s if link
|
26
|
+
end
|
27
|
+
|
28
|
+
def default_path(url)
|
29
|
+
URI.join(url, '/favicon.ico').to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
def request(url, limit = 10)
|
33
|
+
raise TooManyRedirects if limit < 0
|
34
|
+
|
35
|
+
uri = URI.parse(url)
|
36
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
37
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
38
|
+
|
39
|
+
if uri.scheme == 'https'
|
40
|
+
http.use_ssl = true
|
41
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
42
|
+
end
|
43
|
+
|
44
|
+
response = http.request(request)
|
45
|
+
|
46
|
+
if response.is_a? Net::HTTPRedirection
|
47
|
+
request(extract_location(response, url), limit - 1)
|
48
|
+
else
|
49
|
+
return response, url
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# While the soon-to-be obsolete IETF standard RFC 2616 (HTTP 1.1) requires a complete absolute URI for redirection,
|
54
|
+
# the most popular web browsers tolerate the passing of a relative URL as the value for a Location header field.
|
55
|
+
# Consequently, the current revision of HTTP/1.1 makes relative URLs conforming.
|
56
|
+
def extract_location(response, url)
|
57
|
+
URI.join(url, response['location']).to_s
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require 'flavicon/finder'
|
3
|
+
|
4
|
+
describe Flavicon::Finder do
|
5
|
+
subject { Flavicon::Finder.new('http://www.ex.com') }
|
6
|
+
|
7
|
+
describe '#find' do
|
8
|
+
it '' do
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#valid_favicon_url?' do
|
14
|
+
let(:favicon_url) { 'http://www.ex.com/favicon.ico' }
|
15
|
+
let(:response) do
|
16
|
+
{ status: 200, body: 'blah', headers: { 'Content-Type' => 'image/x-icon'} }
|
17
|
+
end
|
18
|
+
|
19
|
+
before do
|
20
|
+
stub_request(:get, favicon_url).to_return(response)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should be true by default' do
|
24
|
+
subject.valid_favicon_url?(favicon_url).should be_true
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'http failure' do
|
28
|
+
let(:response) do
|
29
|
+
{ status: 400, body: 'blah', headers: { 'Content-Type' => 'image/x-icon'} }
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should be false' do
|
33
|
+
subject.valid_favicon_url?(favicon_url).should be_false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'empty body' do
|
38
|
+
let(:response) do
|
39
|
+
{ status: 200, body: '', headers: { 'Content-Type' => 'image/x-icon'} }
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should be false' do
|
43
|
+
subject.valid_favicon_url?(favicon_url).should be_false
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'invalid content-type' do
|
48
|
+
let(:response) do
|
49
|
+
{ status: 200, body: 'blah', headers: { 'Content-Type' => 'text/javascript'} }
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should be false' do
|
53
|
+
subject.valid_favicon_url?(favicon_url).should be_false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#extract_from_html' do
|
59
|
+
def html(file)
|
60
|
+
File.read(File.expand_path(File.dirname(__FILE__) + "/../fixtures/#{file}"))
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should return nil for empty body' do
|
64
|
+
subject.extract_from_html('', 'http://www.ex.com').should be_nil
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should return nil if no favicon found' do
|
68
|
+
subject.extract_from_html(html('missing.html'), 'http://www.ex.com').should be_nil
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should handle absolute url' do
|
72
|
+
subject.extract_from_html(html('absolute.html'), 'http://www.ex.com')
|
73
|
+
.should == 'http://sub.example.com/absolute.ico'
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should handle relative url' do
|
77
|
+
subject.extract_from_html(html('relative.html'), 'http://www.ex.com')
|
78
|
+
.should == 'http://www.ex.com/relative.ico'
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should return first if multiple matches' do
|
82
|
+
subject.extract_from_html(html('multiple.html'), 'http://www.ex.com')
|
83
|
+
.should == 'http://www.ex.com/first.ico'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe '#request' do
|
88
|
+
before do
|
89
|
+
stub_request(:get, 'http://www.ex.com/abc/')
|
90
|
+
.to_return(status: 200, body: '', headers: {})
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'should raise error when redirect limit reached' do
|
94
|
+
expect {
|
95
|
+
subject.request('http://www.ex.com', -1)
|
96
|
+
}.to raise_error(Flavicon::Finder::TooManyRedirects)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should return response and url when successful' do
|
100
|
+
response, url = subject.request('http://www.ex.com/abc/')
|
101
|
+
response.should be_a Net::HTTPSuccess
|
102
|
+
url.should == 'http://www.ex.com/abc/'
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'redirect' do
|
106
|
+
before do
|
107
|
+
stub_request(:get, 'http://www.ex.com/abc')
|
108
|
+
.to_return(status: 301, body: '', headers: { 'Location' => 'http://www.ex.com/abc/' })
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'should follow redirect responses' do
|
112
|
+
response, resolved = subject.request('http://www.ex.com/abc')
|
113
|
+
response.should be_a Net::HTTPSuccess
|
114
|
+
resolved.should == 'http://www.ex.com/abc/'
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should recurse' do
|
118
|
+
subject.should_receive(:request).with('http://www.ex.com/abc', 2).and_call_original
|
119
|
+
subject.should_receive(:request).with('http://www.ex.com/abc/', 1)
|
120
|
+
subject.request('http://www.ex.com/abc', 2)
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'should handle relative redirect urls' do
|
124
|
+
stub_request(:get, 'http://www.ex.com/def')
|
125
|
+
.to_return(status: 301, body: '', headers: { 'Location' => '/ghi/' })
|
126
|
+
|
127
|
+
subject.should_receive(:request).with('http://www.ex.com/def').and_call_original
|
128
|
+
subject.should_receive(:request).with('http://www.ex.com/ghi/', 9)
|
129
|
+
subject.request('http://www.ex.com/def')
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'flavicon'
|
3
|
+
|
4
|
+
describe Flavicon do
|
5
|
+
describe '::find' do
|
6
|
+
it 'should delegate to Finder' do
|
7
|
+
double = double('Finder').as_null_object
|
8
|
+
Flavicon::Finder.should_receive(:new).with('http://www.example.com').and_return(double)
|
9
|
+
Flavicon.find('http://www.example.com')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should call find on Finder instance' do
|
13
|
+
double = double('Finder', find: 'http://www.example.com/favicon.ico')
|
14
|
+
Flavicon::Finder.should_receive(:new).with('http://www.example.com').and_return(double)
|
15
|
+
Flavicon.find('http://www.example.com').should eq('http://www.example.com/favicon.ico')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
module SimpleCov::Configuration
|
4
|
+
def clean_filters
|
5
|
+
@filters = []
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
SimpleCov.configure do
|
10
|
+
clean_filters
|
11
|
+
load_profile 'test_frameworks'
|
12
|
+
end
|
13
|
+
|
14
|
+
ENV['COVERAGE'] && SimpleCov.start do
|
15
|
+
add_filter '/.rvm/'
|
16
|
+
end
|
17
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
18
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
19
|
+
|
20
|
+
require 'rspec'
|
21
|
+
require 'flavicon'
|
22
|
+
require 'pry'
|
23
|
+
|
24
|
+
require 'webmock/rspec'
|
25
|
+
WebMock.disable_net_connect!(allow_localhost: true)
|
26
|
+
|
27
|
+
# Requires supporting files with custom matchers and macros, etc,
|
28
|
+
# in ./support/ and its subdirectories.
|
29
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
30
|
+
|
31
|
+
RSpec.configure do |config|
|
32
|
+
config.order = 'random'
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flavicon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hamed Asghari
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.14'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: webmock
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.17'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.17'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rdoc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.12'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: jeweler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: fetch favicon url by parsing html and falling back on /favicon.ico as
|
126
|
+
default
|
127
|
+
email: hasghari@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files:
|
131
|
+
- LICENSE.txt
|
132
|
+
- README.md
|
133
|
+
files:
|
134
|
+
- ".document"
|
135
|
+
- ".rspec"
|
136
|
+
- ".ruby-gemset"
|
137
|
+
- ".ruby-version"
|
138
|
+
- Gemfile
|
139
|
+
- Gemfile.lock
|
140
|
+
- LICENSE.txt
|
141
|
+
- README.md
|
142
|
+
- Rakefile
|
143
|
+
- VERSION
|
144
|
+
- lib/flavicon.rb
|
145
|
+
- lib/flavicon/finder.rb
|
146
|
+
- spec/fixtures/absolute.html
|
147
|
+
- spec/fixtures/missing.html
|
148
|
+
- spec/fixtures/multiple.html
|
149
|
+
- spec/fixtures/relative.html
|
150
|
+
- spec/flavicon/finder_spec.rb
|
151
|
+
- spec/flavicon_spec.rb
|
152
|
+
- spec/spec_helper.rb
|
153
|
+
homepage: http://github.com/hasghari/flavicon
|
154
|
+
licenses:
|
155
|
+
- MIT
|
156
|
+
metadata: {}
|
157
|
+
post_install_message:
|
158
|
+
rdoc_options: []
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubyforge_project:
|
173
|
+
rubygems_version: 2.2.2
|
174
|
+
signing_key:
|
175
|
+
specification_version: 4
|
176
|
+
summary: fetch favicon url for provided url
|
177
|
+
test_files: []
|