style_stats 0.2.0 → 0.3.0

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: b9e2bb1732c0e4cdc94c37b106056de61bb4ba31
4
- data.tar.gz: f48c01ac18fe8dd45dddce5484a196efd0908c9f
3
+ metadata.gz: 35d2ec88c3dac529a1a26dfcffb0650a93e26b80
4
+ data.tar.gz: 0574c5dbd675ed5dd8dd12adf2a8a6d216219f80
5
5
  SHA512:
6
- metadata.gz: 0d22610c40f6a56429988720e4799dac8b7dbff11bdb2003a4e8ff1c74b4d7c1a3ac9f20caaf9a42de392f2b6bd91c9f1a03f3bdf858ab0e1a484220905082c6
7
- data.tar.gz: 628ce17c2809742c77557c706ec86a8bd120de9aa14a0b6ee5eb02ea847e4700b7a0425a7853eb70461f13017b410cab2747c02c2c9f2f03f6cff970a9df8fd1
6
+ metadata.gz: caa51b0afebf1e05a97e45bfa63bd05c3d76af070bbfc57b0aec9847662a8c959dabbcafcb54f10469d577b4d7f910e2ea6e614dcd72c3b18c7542e96e75670e
7
+ data.tar.gz: d703a4facd0f23fde43d1585012fa15507f38077590c786c9a1acdc0d28080d1a29a3906c5676625ff05e62dbf0ec3fa4a43649a0960564c3e935793d6f49aa2
data/README.md CHANGED
@@ -142,6 +142,7 @@ Usage: style_stats [options] <file ...>
142
142
  -V, --version output the version number
143
143
  -c, --config <path> set configurations
144
144
  -f, --format <format> set the output format <json|html|md>
145
+ -t, --template <path> set the template path for output format
145
146
  -m, --mobile [name] set the mobile user agent
146
147
  --user-anget <string> set the user agent</string></format></path>
147
148
  ```
@@ -20,6 +20,7 @@ end
20
20
 
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
+ opt.on('-t', '--template <path>', 'set the template path for output format') { |v| options[:template] = v }
23
24
  opt.on('-m', '--mobile [name]', 'set the mobile user agent') { |v| options[:user_agent] = v || 'ios' }
24
25
  opt.on('--user-anget <string>', 'set the user agent') { |v| options[:user_agent] = v }
25
26
 
@@ -36,7 +36,8 @@ class StyleStats
36
36
  private
37
37
  def options
38
38
  {
39
- format: @options[:format]
39
+ format: @options[:format],
40
+ template: @options[:template]
40
41
  }
41
42
  end
42
43
  end
@@ -21,7 +21,8 @@ class StyleStats
21
21
  private
22
22
  def options
23
23
  {
24
- format: @options[:format]
24
+ format: @options[:format],
25
+ template: @options[:template]
25
26
  }
26
27
  end
27
28
 
@@ -7,6 +7,7 @@ class StyleStats
7
7
  def initialize(css, options = {})
8
8
  @css = css
9
9
  @options = {format: :default}
10
+ options[:format] = :template if options[:template]
10
11
  @options.merge!(options)
11
12
  end
12
13
 
@@ -17,6 +18,9 @@ class StyleStats
17
18
  ERB.new(text, nil, '-').run(binding)
18
19
  when :json
19
20
  puts @css.analyze.to_json
21
+ when :template
22
+ text = File.read(@options[:template])
23
+ ERB.new(text, nil, '-').run(binding)
20
24
  else
21
25
  Table.new(@css.analyze).run
22
26
  end
@@ -1,3 +1,3 @@
1
1
  class StyleStats
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.0
4
+ version: 0.3.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-10-02 00:00:00.000000000 Z
11
+ date: 2015-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oga