sprockets-svg 0.0.1 → 0.0.2

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: 637ef504757d5585190afec174fce8a7000d9dd1
4
- data.tar.gz: 9b96ee0e1a7ce01abca2ca5c85c66e869a002ff0
3
+ metadata.gz: 34c19a6e6008f0f6c26f09c00c13a8bfa0660d40
4
+ data.tar.gz: 6851edc2b6d76c197f9b1aec20895b73819a9ec1
5
5
  SHA512:
6
- metadata.gz: 2b66f14048832b1da4a1478348aa10316b53952b8eaa12b127fec90a1f57d1e794ff081951d3e34ba633156078f7fe59354544310b0df65c7fb905a75e4c1670
7
- data.tar.gz: 30c4176c3f48a590bf85f890f863765e4b7d4537cef6278c1350d71f6abfe49e0da7f5922dcc1652a52448a42b0eba7ef93738b8dcc611815f97202b6544157b
6
+ metadata.gz: 8615176894845f70698d1ac5955d69b43214f7ddf14bc1afac69cdb364c2a0ec1e9280f0f97340deb172bd25fb23fae40a5a73f75baf84285733d9c297560ed0
7
+ data.tar.gz: c1b69899478297928607814259b7ed6d1768a63df687b15557cf5baa86078d87f7e7c1632cf63083280795f7c71f6d2664475d347d94ffb05fdda53099bb1d0d
data/lib/sprockets/svg.rb CHANGED
@@ -18,6 +18,7 @@ require_relative 'svg/png'
18
18
  require_relative 'svg/server'
19
19
 
20
20
  Sprockets::Asset.send(:include, Sprockets::Svg::Png)
21
+ Sprockets::StaticAsset.send(:include, Sprockets::Svg::Png)
21
22
  Sprockets::Environment.send(:include, Sprockets::Svg::Server)
22
23
 
23
24
  require_relative 'svg/railtie' if defined?(Rails)
@@ -4,12 +4,12 @@ module Sprockets
4
4
  module Svg
5
5
  module Png
6
6
  def self.included(base)
7
- base.send(:alias_method, :write_to_without_png_convertion, :write_to)
8
- base.send(:alias_method, :write_to, :write_to_with_png_convertion)
7
+ base.send(:alias_method, :write_to_without_png_conversion, :write_to)
8
+ base.send(:alias_method, :write_to, :write_to_with_png_conversion)
9
9
  end
10
10
 
11
- def write_to_with_png_convertion(path, options={})
12
- write_to_without_png_convertion(path, options)
11
+ def write_to_with_png_conversion(path, options={})
12
+ write_to_without_png_conversion(path, options)
13
13
  if path.ends_with?('.svg')
14
14
  Png.convert(path, path + '.png')
15
15
  end
@@ -6,17 +6,17 @@ module Sprockets
6
6
  module Server
7
7
 
8
8
  def self.included(base)
9
- base.send(:alias_method, :find_asset_without_convertion, :find_asset)
10
- base.send(:alias_method, :find_asset, :find_asset_with_convertion)
9
+ base.send(:alias_method, :find_asset_without_conversion, :find_asset)
10
+ base.send(:alias_method, :find_asset, :find_asset_with_conversion)
11
11
  end
12
12
 
13
- def find_asset_with_convertion(path, options = {})
13
+ def find_asset_with_conversion(path, options = {})
14
14
  convert = false
15
15
  if path.ends_with?('.svg.png')
16
16
  path = path.gsub(/\.png/, '')
17
17
  convert = true
18
18
  end
19
- asset = find_asset_without_convertion(path, options)
19
+ asset = find_asset_without_conversion(path, options)
20
20
 
21
21
  if convert
22
22
  asset = svg_asset_to_static_png(asset)
@@ -30,9 +30,9 @@ module Sprockets
30
30
  end
31
31
 
32
32
  def svg_asset_to_static_png(svg_asset)
33
- tmp = Tempfile.new(['svg2png', '.svg'])
34
- svg_asset.write_to(tmp.path)
35
- ::Sprockets::StaticAsset.new(self, svg_asset.logical_path + '.png', Pathname.new(tmp.path + '.png'))
33
+ tmp_path = Tempfile.new(['svg2png', '.svg']).path
34
+ svg_asset.write_to(tmp_path)
35
+ ::Sprockets::StaticAsset.new(self, svg_asset.logical_path + '.png', Pathname.new(tmp_path + '.png'))
36
36
  end
37
37
 
38
38
  end
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Svg
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ['jean.boussier@gmail.com']
11
11
  spec.summary = %q{SVG toolchain for sprockets}
12
12
  spec.description = %q{Minify SVG assets, and optionally convert them to PNG for browser compatibility.}
13
- spec.homepage = ''
13
+ spec.homepage = 'https://github.com/byroot/sprockets-svg'
14
14
  spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-12 00:00:00.000000000 Z
11
+ date: 2014-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,7 +100,7 @@ files:
100
100
  - lib/sprockets/svg/server.rb
101
101
  - lib/sprockets/svg/version.rb
102
102
  - sprockets-svg.gemspec
103
- homepage: ''
103
+ homepage: https://github.com/byroot/sprockets-svg
104
104
  licenses:
105
105
  - MIT
106
106
  metadata: {}