ficon 0.0.2 → 0.0.3

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: 581820b108b7f7ec7bbb5a4ff10e1f1e32219d3a
4
- data.tar.gz: c98a9550f44ffed18439928169760d874af665cb
3
+ metadata.gz: 983278b3457ed0fb97538fbea8c9c245c6431d29
4
+ data.tar.gz: 9c3425714495448a15b641264bee8fb1dd95220d
5
5
  SHA512:
6
- metadata.gz: 7192353c8f85c0c2ba22ce1d09ebf6514ad32a6ecf4c90a307c96edc2790f9fa49ecccdb2752a68d3ce567128d4570e04055345f9af0d8ec7c833527fb26e6c7
7
- data.tar.gz: e265acba7c61d0c9ecda8098f16ac2733a7aa25ab02c382c0f846738228a6d77b64122eb8d66f79a4af64a46a476f1d8e2e2e2fef84e43365229f2c4579e117d
6
+ metadata.gz: 48326e26ddeb8ee13f09d60ba5aa6fb5298700a153ebf872fd2f19e6329025db80b39dd876b37eaba31b9c8c938daa003e90e26d3eb30d4635a3357a0b08fae0
7
+ data.tar.gz: 58b8a3f1d77a1ad0e5af439a15fd718aa12d9b81dc4463f096f81d51bef5db428a01447b4182159881767a888901bfdcd01b36c564100ea91342f9ba4841058b
data/lib/ficon/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ficon
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/ficon.rb CHANGED
@@ -80,11 +80,13 @@ module Ficon
80
80
  raise ArgumentError
81
81
  end
82
82
 
83
- doc.xpath("//meta[@property='og:image']|//meta[@name='msapplication-TileImage']|//link[@type='image/ico' or @type='image/vnd.microsoft.icon']|//link[@rel='icon' or @rel='shortcut icon' or @rel='apple-touch-icon-precomposed' or @rel='apple-touch-icon']").collect {|e| e.values.select {|v| v =~ /\.png$|\.jpg$|\.gif$|\.ico$|\.svg$/ }}.flatten
84
-
83
+ doc.xpath("//meta[@property='og:image']|//meta[@name='msapplication-TileImage']|//link[@type='image/ico' or @type='image/vnd.microsoft.icon']|//link[@rel='icon' or @rel='shortcut icon' or @rel='apple-touch-icon-precomposed' or @rel='apple-touch-icon']").
84
+ collect {|e| e.values.select {|v| v =~ /\.png$|\.jpg$|\.gif$|\.ico$|\.svg$/ }}.
85
+ flatten.collect {|v| v[/^http/] || v[/^\//] ? v : '/' + v }
85
86
  end
86
87
 
87
88
  def self.normalise(base, candidate)
89
+ #candidate = '/' + candidate unless candidate[/^\//]
88
90
  parsed_candidate = URI(candidate);
89
91
 
90
92
  parsed_candidate.host = base.host if parsed_candidate.host.nil? # Set relative URLs to absolute
data/test/ficon_test.rb CHANGED
@@ -17,6 +17,7 @@ require 'ficon'
17
17
  Tests << { html: %Q{<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/wp-content/themes/torrentfreakredux/assets/img/icons/72.png">}, value: '/wp-content/themes/torrentfreakredux/assets/img/icons/72.png' }
18
18
  Tests << { html: %Q{<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/wp-content/themes/torrentfreakredux/assets/img/icons/144.png">}, value: '/wp-content/themes/torrentfreakredux/assets/img/icons/144.png' }
19
19
  Tests << { html: %Q{<link rel="shortcut icon" href="/favicon.png">}, value: '/favicon.png' }
20
+ Tests << { html: %Q{<link rel="shortcut icon" href="favicon.ico" />}, value: '/favicon.ico' }
20
21
  Tests << { html: %Q{<link rel="apple-touch-icon" href="/apple-touch-icon.png">}, value: '/apple-touch-icon.png' }
21
22
  Tests << { html: %Q{<link rel="shortcut icon" href="http://example.com/myicon.ico" />}, value: 'http://example.com/myicon.ico' }
22
23
  Tests << { html: %Q{<link rel="icon" href="http://example.com/image.ico" />}, value: 'http://example.com/image.ico' }
@@ -31,7 +32,8 @@ require 'ficon'
31
32
  class FiconTest < Test::Unit::TestCase
32
33
  def test_html_chunks
33
34
  Tests.each do |t|
34
- assert Ficon.from_page( t[:html] )[0] == t[:value], "Seaching |#{t[:html]}| expected #{t[:value]}"
35
+ result = Ficon.from_page( t[:html] )[0]
36
+ assert result == t[:value], "Seaching |#{t[:html]}| expected #{t[:value]}, got #{result}"
35
37
  end
36
38
  end
37
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ficon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Milne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-13 00:00:00.000000000 Z
11
+ date: 2014-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri