dry_css 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dry_css/site.rb +8 -2
- data/lib/dry_css/version.rb +1 -1
- data/spec/fixtures/example_relative.html +1 -0
- data/spec/lib/site_spec.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 715b08fff1108bbcfbd82a55c80c98f263c5338e
|
4
|
+
data.tar.gz: 9ff80abc74feef65d18959150a3fec5dd4b759d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8122f42b01fb9e686bfb2eb413854d04cb101681f1d857cbe9de1037f7a917a88941e5acce66f4ae6eff9409717048a0ba31d53e8986717bbeef03862f1e80f4
|
7
|
+
data.tar.gz: 14c54241520404ce04304cc5792b35b9cc9e78f5861d0e505767ff1f2915459cf4e913cff5a545f0effbc4fd239a193d429bb0d4b9bcf8b34a33a44d74a7aa9a
|
data/lib/dry_css/site.rb
CHANGED
@@ -7,7 +7,7 @@ module DryCss
|
|
7
7
|
class Site
|
8
8
|
def initialize(uri)
|
9
9
|
@uri = uri
|
10
|
-
@html = Nokogiri::HTML(open(uri, :allow_redirections => :
|
10
|
+
@html = Nokogiri::HTML(open(uri, :allow_redirections => :all))
|
11
11
|
end
|
12
12
|
|
13
13
|
def uris
|
@@ -23,7 +23,13 @@ module DryCss
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def ensure_full_uri(path)
|
26
|
-
path[0] == '
|
26
|
+
if path[0..1] == '//'
|
27
|
+
'http:' + path
|
28
|
+
elsif path[0] == '/'
|
29
|
+
@uri + path
|
30
|
+
else
|
31
|
+
path
|
32
|
+
end
|
27
33
|
end
|
28
34
|
|
29
35
|
end
|
data/lib/dry_css/version.rb
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
<title></title>
|
7
7
|
<link href="/example.css" media="all" rel="stylesheet" type="text/css" />
|
8
8
|
<link href="/example2.css" media="all" rel="stylesheet" type="text/css" />
|
9
|
+
<link href="//www.example.com/example2.css" media="all" rel="stylesheet" type="text/css" />
|
9
10
|
</head>
|
10
11
|
<body>
|
11
12
|
<h1>Example Page</h1>
|
data/spec/lib/site_spec.rb
CHANGED
@@ -11,7 +11,11 @@ describe DryCss::Site do
|
|
11
11
|
file_name = File.dirname(__FILE__) + '/../fixtures/example_relative.html'
|
12
12
|
@site = DryCss::Site.new(file_name)
|
13
13
|
# We prepend 'file_name' for tests in place of uri for production
|
14
|
-
@site.uris.should eq([
|
14
|
+
@site.uris.should eq([
|
15
|
+
file_name + '/example.css',
|
16
|
+
file_name + '/example2.css',
|
17
|
+
'http://www.example.com/example2.css'
|
18
|
+
])
|
15
19
|
end
|
16
20
|
|
17
21
|
end
|