esvg 4.3.5 → 4.3.6

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: 8106c249cd9020c020a26e4ad41524946b1918d7
4
- data.tar.gz: 78ad6edd6beac2930cbb2316ef9746ea079a80c9
3
+ metadata.gz: 0bdc810b198a87a377e9460a3216b5e627606d11
4
+ data.tar.gz: 26177994d576344b015093fe90bcc269a7458cbf
5
5
  SHA512:
6
- metadata.gz: f9fe3f77e80cb73477f0a93a300fc428251730958b414d14f2660d604a90223aaa2361bb980a4046ac8f19a81c8324ce5655e77b6f572c829ce03eaaa07a056d
7
- data.tar.gz: 7278b841d68181cf8c56c8a6e767266916922c52cdcdbee5f64f65d8a0b2f30a707b8d5632b03b1170d7a50d4cf12d156b13c59851d760d5e8644ee2e0cd5376
6
+ metadata.gz: cd18ccb361f8e4916d9a349f1b443cfbeaf3ce60ecf2eb6b36a762e291f4ff8d05c1abe12154baabc106e12552652cb38338f5625ed46848c2c7cc54f8f13092
7
+ data.tar.gz: fe017ac769eddedf743dfe7a459fbcf1d42e7c58fa6c49b43947297fd8602f4cd642dc2ba05e392a83a0be73f0f00df1afc0a119b12effd28b7f4a4d2062cc7d
data/exe/esvg CHANGED
@@ -43,10 +43,18 @@ OptionParser.new do |opts|
43
43
  options[:gzip] = true
44
44
  end
45
45
 
46
+ opts.on("--seed", "Seed cache file with optimized svgs") do
47
+ options[:seed] = true
48
+ end
49
+
46
50
  opts.on("-v", "--version", "Print version") do
47
51
  options[:version] = true
48
52
  end
49
53
 
54
+ opts.on("--test", "test func") do
55
+ options[:test] = true
56
+ end
57
+
50
58
  end.parse!
51
59
 
52
60
  if options[:version]
@@ -58,5 +66,10 @@ else
58
66
  end
59
67
 
60
68
  options[:print] = true
61
- esvg = Esvg::Svgs.new(options).build
69
+
70
+ if options[:seed]
71
+ Esvg.seed_cache(options)
72
+ else
73
+ esvg = Esvg.new(options).build
74
+ end
62
75
  end
@@ -43,6 +43,13 @@ module Esvg
43
43
  find_svgs(names).map{|s| s.build_paths(names) }.flatten
44
44
  end
45
45
 
46
+ def seed_cache(options)
47
+ svgs = Svgs.new(options)
48
+ puts "Optimizing SVGs" if options[:print]
49
+ svgs.symbols.map(&:optimize)
50
+ svgs.write_cache
51
+ end
52
+
46
53
  def find_svgs(names=nil)
47
54
  @svgs.select {|s| s.buildable_svgs(names) }
48
55
  end
@@ -54,7 +61,7 @@ module Esvg
54
61
  end
55
62
 
56
63
  def rails?
57
- defined?(Rails)
64
+ defined?(Rails) || File.exist?("./bin/rails")
58
65
  end
59
66
 
60
67
  def html_safe(input)
@@ -63,7 +70,7 @@ module Esvg
63
70
  end
64
71
 
65
72
  def precompile_assets
66
- if rails? && defined?(Rake)
73
+ if defined?(Rails) && Rails.env.production? && defined?(Rake)
67
74
  ::Rake::Task['assets:precompile'].enhance do
68
75
  Svgs.new(gzip: true, print: true).build
69
76
  end
@@ -58,6 +58,8 @@ module Esvg
58
58
 
59
59
  config.merge!(options)
60
60
 
61
+ p config
62
+
61
63
  config[:filename] = File.basename(config[:filename], '.*')
62
64
 
63
65
  config[:pwd] = File.expand_path Dir.pwd
@@ -1,3 +1,3 @@
1
1
  module Esvg
2
- VERSION = "4.3.5"
2
+ VERSION = "4.3.6"
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: 4.3.5
4
+ version: 4.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler