style_stats 0.3.0 → 0.4.0
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/README.md +2 -1
- data/exe/style_stats +1 -0
- data/lib/style_stats/cli.rb +14 -1
- data/lib/style_stats/css/analyze.rb +7 -6
- data/lib/style_stats/version.rb +1 -1
- 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: 0b568233edd849c4e997513c318c77424041320a
|
|
4
|
+
data.tar.gz: 8107eda3e1613d7cda524877090160bbd596b714
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6af12e4c8de4fcb590610aee1684aaefea996a624a9ef5fafdb419db71f377ad37fbe63ae2eafd8bb2536005938e7550926339cf5c618df6de7880f2b373f3d6
|
|
7
|
+
data.tar.gz: 5b108d88d3d11d382e728da55b00281fce1f75485b1bc6974f18d709e9b424c79c52a0b5138c00347329f17f0264f1be7f42d120d3cf314acf0733ae562ecb82
|
data/README.md
CHANGED
|
@@ -131,7 +131,7 @@ $ style_stats http://example.com/
|
|
|
131
131
|
$ style_stats foo.css -f <json|html|md>
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
## CLI Reference
|
|
135
135
|
|
|
136
136
|
Help:
|
|
137
137
|
|
|
@@ -143,6 +143,7 @@ Usage: style_stats [options] <file ...>
|
|
|
143
143
|
-c, --config <path> set configurations
|
|
144
144
|
-f, --format <format> set the output format <json|html|md>
|
|
145
145
|
-t, --template <path> set the template path for output format
|
|
146
|
+
-n, --number show only numeral metrics
|
|
146
147
|
-m, --mobile [name] set the mobile user agent
|
|
147
148
|
--user-anget <string> set the user agent</string></format></path>
|
|
148
149
|
```
|
data/exe/style_stats
CHANGED
|
@@ -21,6 +21,7 @@ end
|
|
|
21
21
|
opt.on('-c', '--config <path>', 'set configurations') { |v| options[:config] = v }
|
|
22
22
|
opt.on('-f', '--format <format>', 'set the output format <json|html|md>') { |v| options[:format] = v }
|
|
23
23
|
opt.on('-t', '--template <path>', 'set the template path for output format') { |v| options[:template] = v }
|
|
24
|
+
opt.on('-n', '--number', 'show only numeral metrics') { |v| options[:number] = v }
|
|
24
25
|
opt.on('-m', '--mobile [name]', 'set the mobile user agent') { |v| options[:user_agent] = v || 'ios' }
|
|
25
26
|
opt.on('--user-anget <string>', 'set the user agent') { |v| options[:user_agent] = v }
|
|
26
27
|
|
data/lib/style_stats/cli.rb
CHANGED
|
@@ -45,9 +45,22 @@ class StyleStats
|
|
|
45
45
|
json = File.read(@options[:config])
|
|
46
46
|
JSON.parse(json)
|
|
47
47
|
else
|
|
48
|
-
{}
|
|
48
|
+
@options[:number] ? number_config : {}
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
|
+
|
|
52
|
+
def number_config
|
|
53
|
+
{
|
|
54
|
+
published: false,
|
|
55
|
+
paths: false,
|
|
56
|
+
mostIdentifierSelector: false,
|
|
57
|
+
lowestCohesionSelector: false,
|
|
58
|
+
uniqueFontFamilies: false,
|
|
59
|
+
uniqueFontSizes: false,
|
|
60
|
+
uniqueColors: false,
|
|
61
|
+
propertiesCount: false
|
|
62
|
+
}
|
|
63
|
+
end
|
|
51
64
|
end
|
|
52
65
|
end
|
|
53
66
|
end
|
|
@@ -4,6 +4,7 @@ class StyleStats
|
|
|
4
4
|
@result = {}
|
|
5
5
|
@selector = sort_selector_by_declarations_count.first
|
|
6
6
|
@most_indentifier_selector = selectors.first || StyleStats::Css::Selector.new("")
|
|
7
|
+
|
|
7
8
|
analyze_published
|
|
8
9
|
analyze_paths
|
|
9
10
|
analyze_stylesheets
|
|
@@ -114,27 +115,27 @@ class StyleStats
|
|
|
114
115
|
end
|
|
115
116
|
|
|
116
117
|
def analyze_total_unique_font_sizes
|
|
117
|
-
@result["Total Unique Font Sizes"] = self["font-size"][:values].count if StyleStats.configuration.options[:totalUniqueFontSizes]
|
|
118
|
+
@result["Total Unique Font Sizes"] = (self["font-size"][:values] || []).count if StyleStats.configuration.options[:totalUniqueFontSizes]
|
|
118
119
|
end
|
|
119
120
|
|
|
120
121
|
def analyze_unique_font_sizes
|
|
121
|
-
@result["Unique Font Sizes"] = self["font-size"][:values] if StyleStats.configuration.options[:uniqueFontSizes]
|
|
122
|
+
@result["Unique Font Sizes"] = (self["font-size"][:values] || []) if StyleStats.configuration.options[:uniqueFontSizes]
|
|
122
123
|
end
|
|
123
124
|
|
|
124
125
|
def analyze_total_unique_font_families
|
|
125
|
-
@result["Total Unique Font Families"] = self["font-family"][:values].count if StyleStats.configuration.options[:totalUniqueFontFamilies]
|
|
126
|
+
@result["Total Unique Font Families"] = (self["font-family"][:values] || []).count if StyleStats.configuration.options[:totalUniqueFontFamilies]
|
|
126
127
|
end
|
|
127
128
|
|
|
128
129
|
def analyze_unique_font_families
|
|
129
|
-
@result["Unique Font Families"] = self["font-family"][:values] if StyleStats.configuration.options[:uniqueFontFamilies]
|
|
130
|
+
@result["Unique Font Families"] = (self["font-family"][:values] || []) if StyleStats.configuration.options[:uniqueFontFamilies]
|
|
130
131
|
end
|
|
131
132
|
|
|
132
133
|
def analyze_total_unique_colors
|
|
133
|
-
@result["Total Unique Colors"] = self["color"][:values].count if StyleStats.configuration.options[:totalUniqueColors]
|
|
134
|
+
@result["Total Unique Colors"] = (self["color"][:values] || []).count if StyleStats.configuration.options[:totalUniqueColors]
|
|
134
135
|
end
|
|
135
136
|
|
|
136
137
|
def analyze_unique_colors
|
|
137
|
-
@result["Unique Colors"] = self["color"][:values] if StyleStats.configuration.options[:uniqueColors]
|
|
138
|
+
@result["Unique Colors"] = (self["color"][:values] || []) if StyleStats.configuration.options[:uniqueColors]
|
|
138
139
|
end
|
|
139
140
|
|
|
140
141
|
def analyze_id_selectors
|
data/lib/style_stats/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: style_stats
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- shiro16
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: oga
|