inline_svg 1.6.0 → 1.7.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
  SHA256:
3
- metadata.gz: 5141ac43ede6f67761b367d5697e8b007719bb445831bea6b689e712bf50414c
4
- data.tar.gz: 6694ac5aa490995a47138013b550a28e738ae5d9f5fb0df72bdef476d802e0b0
3
+ metadata.gz: 1ebc9f8de24984925fe3457d98efeb29198bbda5551f83b5c2afad97bf61fa8c
4
+ data.tar.gz: 0ab9a31d27a0a97e4aafb1691af4e9e8c0f03074637237819ba611c73d24b82f
5
5
  SHA512:
6
- metadata.gz: 0310736a1123e9e5d42da01cc1dc4b966f369cd9c6931610623eb57921ce2b82119334224b6e953a130e374e3bd6cc47014fefbd4c1fb30ff1d87a09bf91b903
7
- data.tar.gz: 95cbe5a123f9fa66bf2ea7510efccd017abf7e6269543dd8e22fd6b3bb0d7d165d7b37cd1a4ac891dc1412c811982b30037751c65be84ab3bfddf15d9c4f67d8
6
+ metadata.gz: e909570434548e33cfc76627819b636b0f28e24b485165b44a467dd7e49c191ccccb082240bd5fec0ae7bd2cfc2686011b56dc3b96ed938530353c6196e8dce8
7
+ data.tar.gz: d509b78518354a7b1e40cf481cc4cc4b7ea350d006b5268d2106b9700e2ad2eea7e4431ee674b9e7276a1c11ae61f4903cc9e101ffe40e9a902f870d9429c36b
@@ -3,8 +3,19 @@ All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
5
  ## [Unreleased][unreleased]
6
+
6
7
  - Nothing
7
8
 
9
+ ## [1.7.0] - 2020-02-13
10
+ ### Added
11
+ - WebpackAssetFinder serves files from dev server if one is running. [#111](https://github.com/jamesmartin/inline_svg/pull/111). Thanks, [@connorshea](https://github.com/connorshea)
12
+
13
+ ### Fixed
14
+ - Using Webpacker and Asset Pipeline in a single App could result in SVGs not
15
+ being found because the wrong `AssetFinder` was used.
16
+ [#114](https://github.com/jamesmartin/inline_svg/pull/114). Thanks,
17
+ [@kylefox](https://github.com/kylefox)
18
+
8
19
  ## [1.6.0] - 2019-11-13
9
20
  ### Added
10
21
  - Support Webpack via the new `inline_svg_pack_tag` helper and deprecate `inline_svg` helper in preparation for v2.0.
@@ -220,7 +231,9 @@ transformations](https://github.com/jamesmartin/inline_svg/blob/master/README.md
220
231
  ### Added
221
232
  - Basic Railtie and view helper to inline SVG documents to Rails views.
222
233
 
223
- [unreleased]: https://github.com/jamesmartin/inline_svg/compare/v1.5.2...HEAD
234
+ [unreleased]: https://github.com/jamesmartin/inline_svg/compare/v1.7.0...HEAD
235
+ [1.7.0]: https://github.com/jamesmartin/inline_svg/compare/v1.6.0...v1.7.0
236
+ [1.6.0]: https://github.com/jamesmartin/inline_svg/compare/v1.5.2...v1.6.0
224
237
  [1.5.2]: https://github.com/jamesmartin/inline_svg/compare/v1.5.1...v1.5.2
225
238
  [1.5.1]: https://github.com/jamesmartin/inline_svg/compare/v1.5.0...v1.5.1
226
239
  [1.5.0]: https://github.com/jamesmartin/inline_svg/compare/v1.4.0...v1.5.0
@@ -69,11 +69,9 @@ module InlineSvg
69
69
  end
70
70
 
71
71
  def with_asset_finder(asset_finder)
72
- initial_asset_finder = InlineSvg.configuration.asset_finder
73
-
74
- InlineSvg.configuration.asset_finder = asset_finder
72
+ Thread.current[:inline_svg_asset_finder] = asset_finder
75
73
  output = yield
76
- InlineSvg.configuration.asset_finder = initial_asset_finder
74
+ Thread.current[:inline_svg_asset_finder] = nil
77
75
 
78
76
  output
79
77
  end
@@ -6,7 +6,7 @@ module InlineSvg
6
6
  end
7
7
 
8
8
  def self.configured_asset_finder
9
- InlineSvg.configuration.asset_finder
9
+ Thread.current[:inline_svg_asset_finder] || InlineSvg.configuration.asset_finder
10
10
  end
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module InlineSvg
2
- VERSION = "1.6.0"
2
+ VERSION = "1.7.0"
3
3
  end
@@ -9,11 +9,29 @@ module InlineSvg
9
9
  end
10
10
 
11
11
  def pathname
12
- public_path = Webpacker.config.public_path
13
12
  file_path = Webpacker.instance.manifest.lookup(@filename)
14
- return unless public_path && file_path
13
+ return unless file_path
15
14
 
16
- File.join(public_path, file_path)
15
+ if Webpacker.dev_server.running?
16
+ asset = Net::HTTP.get(Webpacker.dev_server.host, file_path, Webpacker.dev_server.port)
17
+
18
+ begin
19
+ Tempfile.new(file_path).tap do |file|
20
+ file.binmode
21
+ file.write(asset)
22
+ file.rewind
23
+ end
24
+ rescue StandardError => e
25
+ Rails.logger.error "Error creating tempfile: #{e}"
26
+ raise
27
+ end
28
+
29
+ else
30
+ public_path = Webpacker.config.public_path
31
+ return unless public_path
32
+
33
+ File.join(public_path, file_path)
34
+ end
17
35
  end
18
36
  end
19
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-13 00:00:00.000000000 Z
11
+ date: 2020-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler