esvg 2.4.3 → 2.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5759805f4218312b94e22a42bca5979fcbb71beb
4
- data.tar.gz: 03a197b995bbdf9c420cf3f36dcacec8687e97b3
3
+ metadata.gz: 286447567ec0661d4c3e9b4731cee656077ef12f
4
+ data.tar.gz: fe5bebe1a92c7fbc693e098d90de34cc3ecbd160
5
5
  SHA512:
6
- metadata.gz: 20adcf07e79c3d4a0e8bc5cb020642eec7e6d27aef4dcbe79d5d1e3e1e93eea2cccd58435bd8b9f1c822ab11a21b97399cfa7ab5c74da0179c49def4156dda3d
7
- data.tar.gz: 3821641bc24bae405219de5b391a6abc09a204a0397dad2739ca13055d13dc65c948ba8c53b72bfbf9ddfea03fd1536ec44c8bdec48d98692ff6e67fb891750c
6
+ metadata.gz: 696665b75357ee9df61d7cd5a6d9e608fb6599ff21f1c297c73787acd6494fffd9a47de9ac6180439313e1a1b2f29d4ddbcbe2dbef5443a7fda8912302f6e89d
7
+ data.tar.gz: a98ff82d5493befd179a41d838a8ec5ca1859917b10811fac1414f1d2c0def3f0fd0a2cceb03faf51c0ef4814c8f284fb5b914c3a25e5c3d700c6e7134eec8af
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ### 2.4.2 (2015-10-27)
3
+ ### 2.5.0 (2015-11-03)
4
+ - Improved logging
5
+ - Added `--version` flag for CLI
6
+
7
+ ### 2.4.3 (2015-10-27)
4
8
  - Fix: Use proper svgo command when svgo is available.
5
9
 
6
10
  ### 2.4.2 (2015-10-26)
data/exe/esvg CHANGED
@@ -27,8 +27,17 @@ OptionParser.new do |opts|
27
27
  opts.on("-n", "--npm", String, "Path to node_modules director") do |path|
28
28
  options[:npm_path] = path
29
29
  end
30
- end.parse!
31
30
 
32
- options[:path] = ARGV.shift
31
+ opts.on("-l", "--log", "Print version") do |version|
32
+ options[:version] = true
33
+ end
34
+
35
+ end.parse!
33
36
 
34
- esvg = Esvg::SVG.new(options).write
37
+ if options[:version]
38
+ puts "Esvg #{Esvg::VERSION}"
39
+ else
40
+ options[:path] = ARGV.shift
41
+ options[:cli] = true
42
+ esvg = Esvg::SVG.new(options).write
43
+ end
@@ -43,7 +43,7 @@ module Esvg
43
43
 
44
44
  config.merge!(options)
45
45
 
46
- if config[:verbose]
46
+ if config[:cli]
47
47
  config[:path] = File.expand_path(config[:path])
48
48
  config[:output_path] = File.expand_path(config[:output_path])
49
49
  end
@@ -78,9 +78,11 @@ module Esvg
78
78
  files[f] = File.mtime(f)
79
79
  end
80
80
 
81
+ puts "Read #{files.size} files from #{config[:path]}" if config[:cli]
82
+
81
83
  process_files
82
84
 
83
- if files.empty? && config[:verbose]
85
+ if files.empty? && config[:cli]
84
86
  puts "No svgs found at #{config[:path]}"
85
87
  end
86
88
  end
@@ -182,13 +184,20 @@ module Esvg
182
184
  case config[:format]
183
185
  when "html"
184
186
  write_html
187
+ puts "Written to #{log_path config[:html_path]}" if config[:cli]
185
188
  when "js"
186
189
  write_js
190
+ puts "Written to #{log_path config[:js_path]}" if config[:cli]
187
191
  when "css"
188
192
  write_css
193
+ puts "Written to #{log_path config[:css_path]}" if config[:cli]
189
194
  end
190
195
  end
191
196
 
197
+ def log_path(path)
198
+ File.expand_path(path).sub(File.expand_path(Dir.pwd), '').sub(/^\//,'')
199
+ end
200
+
192
201
  def write_svg(svg)
193
202
  path = File.join(config[:path], '.esvg-cache')
194
203
  write_file path, svg
@@ -300,7 +309,7 @@ module Esvg
300
309
  if (element) {
301
310
  return '<svg class="#{config[:base_class]} '+svgName+' '+(classnames || '')+'" '+this.dimensions(element)+'><use xlink:href="#'+svgName+'"/></svg>'
302
311
  } else {
303
- console.error('File not found: "'+name+'.svg" at #{File.join(config[:path],'')}')
312
+ console.error('File not found: "'+name+'.svg" at #{log_path(File.join(config[:path],''))}/')
304
313
  }
305
314
  },
306
315
  iconName: function(name) {
@@ -1,3 +1,3 @@
1
1
  module Esvg
2
- VERSION = "2.4.3"
2
+ VERSION = "2.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esvg
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.3
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-27 00:00:00.000000000 Z
11
+ date: 2015-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler