dry_css 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/dry_css/css.rb +5 -2
- data/lib/dry_css/version.rb +1 -1
- data/spec/lib/css_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7251789431c477dd2ec11073ee3c7efbcd416963
|
|
4
|
+
data.tar.gz: e791dd2e16745cc828699dc40aed089e945ce4de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 35208f3c8419a4dca7d54b30765df4089e8a7c35401f0a274c2cb7ced5fa4c79cd6aa9be595a79a3d835b32ac7d19ccc69b424d4b152aaf77d8dfdc505db1370
|
|
7
|
+
data.tar.gz: 77f0fa8a118cabbe39cf91f6852b0ef56b4b9c77ea56c544a25ba49be2cb0d361006d93e1c59bec18c0cade2c4b7c8f3bb886fadb5c473e5e7336958f81b71fa
|
data/.gitignore
CHANGED
data/lib/dry_css/css.rb
CHANGED
|
@@ -20,7 +20,10 @@ module DryCss
|
|
|
20
20
|
threads = []
|
|
21
21
|
uris.each do |u|
|
|
22
22
|
threads << Thread.new(u) do |uri|
|
|
23
|
-
|
|
23
|
+
begin
|
|
24
|
+
parser.load_uri!(uri)
|
|
25
|
+
rescue CssParser::RemoteFileError
|
|
26
|
+
end
|
|
24
27
|
end
|
|
25
28
|
end
|
|
26
29
|
threads.each{|thr| thr.join }
|
|
@@ -30,7 +33,7 @@ module DryCss
|
|
|
30
33
|
def scan_for(property)
|
|
31
34
|
values_hash = {:counts => Hash.new(0), :total => 0}
|
|
32
35
|
@parser.each_selector do |selector, declarations, specificity|
|
|
33
|
-
declarations.scan(/([
|
|
36
|
+
declarations.scan(/([\.\w:]+)?(#{property})/) do |prop,val|
|
|
34
37
|
values_hash[:counts][val.to_sym] += 1
|
|
35
38
|
values_hash[:total] += 1
|
|
36
39
|
end
|
data/lib/dry_css/version.rb
CHANGED
data/spec/lib/css_spec.rb
CHANGED
|
@@ -21,4 +21,11 @@ describe DryCss::CSS do
|
|
|
21
21
|
@css.colors.should eq({:counts => {:"#fff;"=>2, :"#000;"=>4}, :total => 6})
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
it 'ignores bad uris' do
|
|
25
|
+
file_name = 'file://' + File.expand_path(File.dirname(__FILE__)) + '/../fixtures/example.css'
|
|
26
|
+
file_name2 = 'file://' + File.expand_path(File.dirname(__FILE__)) + '/../fixtures/example404.css'
|
|
27
|
+
@css = DryCss::CSS.new(file_name, file_name2)
|
|
28
|
+
@css.colors.should eq({:counts => {:"#fff;"=>1, :"#000;"=>2}, :total => 3})
|
|
29
|
+
end
|
|
30
|
+
|
|
24
31
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dry_css
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- gpxl
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-08-
|
|
11
|
+
date: 2013-08-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|