inline_svg 1.7.0 → 1.7.1
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.
Potentially problematic release.
This version of inline_svg might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/workflows/integration_test.yml +58 -0
- data/.github/workflows/ruby.yml +20 -0
- data/CHANGELOG.md +9 -5
- data/README.md +2 -1
- data/lib/inline_svg/static_asset_finder.rb +4 -2
- data/lib/inline_svg/version.rb +1 -1
- data/lib/inline_svg/webpack_asset_finder.rb +31 -18
- metadata +4 -4
- data/.travis.yml +0 -8
- data/circle.yml +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 923ca3f0952247f48b3346decfe83b44216566a52a2f2bf4a9ba117a2626712b
|
4
|
+
data.tar.gz: afef4e221a4e7becce12338289eafe79b60138bd2706ec76a51229a588fe8e5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72bc4f1be354aa23bda0bb62814d194568691b9833e21b8da89594eea213f5ce6fc523ea60c04f19a7e23e546826c98a35ba6cf812579162c70bc6a0905c5d09
|
7
|
+
data.tar.gz: c0db9494ac8b67ad61c2dfa38f8b6bb64dad204bbf1978cc86f58600d71ee10f977a38ae74b69b7212293f31eec7ebec183c3c90e14aa274605ebe3972626ec7
|
@@ -0,0 +1,58 @@
|
|
1
|
+
name: Integration Tests
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
test-branch: [rails3, rails4, master, rails6, rails6-webpacker]
|
12
|
+
steps:
|
13
|
+
- name: Checkout
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
- name: Checkout test app
|
16
|
+
uses: actions/checkout@v2
|
17
|
+
with:
|
18
|
+
repository: jamesmartin/inline_svg_test_app
|
19
|
+
ref: ${{ matrix.test-branch }}
|
20
|
+
path: test_app
|
21
|
+
- name: Set up Ruby 2.6
|
22
|
+
uses: actions/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: 2.6.x
|
25
|
+
- name: Build local gem
|
26
|
+
run: |
|
27
|
+
gem install bundler
|
28
|
+
bundle install --jobs 4 --retry 3
|
29
|
+
bundle exec rake build
|
30
|
+
- name: Use the local gem in the test App
|
31
|
+
id: uselocalgem
|
32
|
+
uses: jacobtomlinson/gha-find-replace@0.1.1
|
33
|
+
with:
|
34
|
+
find: "gem 'inline_svg'"
|
35
|
+
replace: "gem 'inline_svg', path: '${{github.workspace}}'"
|
36
|
+
- name: Check local gem in use
|
37
|
+
run: |
|
38
|
+
test "${{ steps.uselocalgem.outputs.modifiedFiles }}" != "0"
|
39
|
+
grep "inline_svg" $GITHUB_WORKSPACE/test_app/Gemfile
|
40
|
+
- name: Bundle
|
41
|
+
run: |
|
42
|
+
cd $GITHUB_WORKSPACE/test_app
|
43
|
+
bundle install --jobs 4 --retry 3
|
44
|
+
- name: Set up Node.js 12.x
|
45
|
+
uses: actions/setup-node@v1
|
46
|
+
with:
|
47
|
+
node-version: 12.x
|
48
|
+
if: matrix.test-branch == 'rails6-webpacker'
|
49
|
+
- name: Generate Webpacker config
|
50
|
+
run: |
|
51
|
+
cd $GITHUB_WORKSPACE/test_app
|
52
|
+
yarn install --check-files
|
53
|
+
bundle exec rake webpacker:compile
|
54
|
+
if: matrix.test-branch == 'rails6-webpacker'
|
55
|
+
- name: Test
|
56
|
+
run: |
|
57
|
+
cd $GITHUB_WORKSPACE/test_app
|
58
|
+
bundle exec rake test
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
- name: Set up Ruby 2.6
|
13
|
+
uses: actions/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: 2.6.x
|
16
|
+
- name: Build and test with Rake
|
17
|
+
run: |
|
18
|
+
gem install bundler
|
19
|
+
bundle install --jobs 4 --retry 3
|
20
|
+
bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -6,15 +6,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
7
7
|
- Nothing
|
8
8
|
|
9
|
+
## [1.7.1] - 2020-03-17
|
10
|
+
### Fixed
|
11
|
+
- Static Asset Finder uses pathname for compatibility with Sprockets 4+. [#106](https://github.com/jamesmartin/inline_svg/pull/106). Thanks [@subdigital](https://github.com/subdigital)
|
12
|
+
|
9
13
|
## [1.7.0] - 2020-02-13
|
10
14
|
### Added
|
11
15
|
- 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
16
|
|
13
17
|
### Fixed
|
14
|
-
- Using Webpacker and Asset Pipeline in a single App could result in SVGs not
|
15
|
-
|
16
|
-
|
17
|
-
[@kylefox](https://github.com/kylefox)
|
18
|
+
- Using Webpacker and Asset Pipeline in a single App could result in SVGs not being found because the wrong `AssetFinder` was used. [#114](https://github.com/jamesmartin/inline_svg/pull/114). Thanks, [@kylefox](https://github.com/kylefox)
|
19
|
+
- Prevent "EOFError error" when using webpack dev server over HTTPS [#113](https://github.com/jamesmartin/inline_svg/pull/113). Thanks, [@kylefox](https://github.com/kylefox)
|
20
|
+
|
18
21
|
|
19
22
|
## [1.6.0] - 2019-11-13
|
20
23
|
### Added
|
@@ -231,7 +234,8 @@ transformations](https://github.com/jamesmartin/inline_svg/blob/master/README.md
|
|
231
234
|
### Added
|
232
235
|
- Basic Railtie and view helper to inline SVG documents to Rails views.
|
233
236
|
|
234
|
-
[unreleased]: https://github.com/jamesmartin/inline_svg/compare/v1.7.
|
237
|
+
[unreleased]: https://github.com/jamesmartin/inline_svg/compare/v1.7.1...HEAD
|
238
|
+
[1.7.1]: https://github.com/jamesmartin/inline_svg/compare/v1.7.0...v1.7.1
|
235
239
|
[1.7.0]: https://github.com/jamesmartin/inline_svg/compare/v1.6.0...v1.7.0
|
236
240
|
[1.6.0]: https://github.com/jamesmartin/inline_svg/compare/v1.5.2...v1.6.0
|
237
241
|
[1.5.2]: https://github.com/jamesmartin/inline_svg/compare/v1.5.1...v1.5.2
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Inline SVG
|
2
2
|
|
3
|
-
|
3
|
+

|
4
|
+

|
4
5
|
|
5
6
|
Styling a SVG document with CSS for use on the web is most reliably achieved by
|
6
7
|
[adding classes to the document and
|
@@ -1,7 +1,9 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
1
3
|
# Naive fallback asset finder for when sprockets >= 3.0 &&
|
2
4
|
# config.assets.precompile = false
|
3
5
|
# Thanks to @ryanswood for the original code:
|
4
|
-
# https://github.com/
|
6
|
+
# https://github.com/jamesmartin/inline_svg/commit/661bbb3bef7d1b4bd6ccd63f5f018305797b9509
|
5
7
|
module InlineSvg
|
6
8
|
class StaticAssetFinder
|
7
9
|
def self.find_asset(filename)
|
@@ -14,7 +16,7 @@ module InlineSvg
|
|
14
16
|
|
15
17
|
def pathname
|
16
18
|
if ::Rails.application.config.assets.compile
|
17
|
-
::Rails.application.assets[@filename].
|
19
|
+
Pathname.new(::Rails.application.assets[@filename].filename)
|
18
20
|
else
|
19
21
|
manifest = ::Rails.application.assets_manifest
|
20
22
|
asset_path = manifest.assets[@filename]
|
data/lib/inline_svg/version.rb
CHANGED
@@ -6,32 +6,45 @@ module InlineSvg
|
|
6
6
|
|
7
7
|
def initialize(filename)
|
8
8
|
@filename = filename
|
9
|
+
@asset_path = Webpacker.manifest.lookup(@filename)
|
9
10
|
end
|
10
11
|
|
11
12
|
def pathname
|
12
|
-
|
13
|
-
return unless file_path
|
13
|
+
return if @asset_path.blank?
|
14
14
|
|
15
15
|
if Webpacker.dev_server.running?
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
rescue StandardError => e
|
25
|
-
Rails.logger.error "Error creating tempfile: #{e}"
|
26
|
-
raise
|
27
|
-
end
|
16
|
+
dev_server_asset(@asset_path)
|
17
|
+
elsif Webpacker.config.public_path.present?
|
18
|
+
File.join(Webpacker.config.public_path, @asset_path)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
28
23
|
|
29
|
-
|
30
|
-
|
31
|
-
return unless public_path
|
24
|
+
def dev_server_asset(file_path)
|
25
|
+
asset = fetch_from_dev_server(file_path)
|
32
26
|
|
33
|
-
|
27
|
+
begin
|
28
|
+
Tempfile.new(file_path).tap do |file|
|
29
|
+
file.binmode
|
30
|
+
file.write(asset)
|
31
|
+
file.rewind
|
32
|
+
end
|
33
|
+
rescue StandardError => e
|
34
|
+
Rails.logger.error "[inline_svg] Error creating tempfile for #{@filename}: #{e}"
|
35
|
+
raise
|
34
36
|
end
|
35
37
|
end
|
38
|
+
|
39
|
+
def fetch_from_dev_server(file_path)
|
40
|
+
http = Net::HTTP.new(Webpacker.dev_server.host, Webpacker.dev_server.port)
|
41
|
+
http.use_ssl = Webpacker.dev_server.https?
|
42
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
43
|
+
|
44
|
+
http.request(Net::HTTP::Get.new(file_path)).body
|
45
|
+
rescue StandardError => e
|
46
|
+
Rails.logger.error "[inline_svg] Error fetching #{@filename} from webpack-dev-server: #{e}"
|
47
|
+
raise
|
48
|
+
end
|
36
49
|
end
|
37
50
|
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.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -129,16 +129,16 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".github/workflows/integration_test.yml"
|
133
|
+
- ".github/workflows/ruby.yml"
|
132
134
|
- ".gitignore"
|
133
135
|
- ".rubocop.yml"
|
134
136
|
- ".rubocop_todo.yml"
|
135
|
-
- ".travis.yml"
|
136
137
|
- CHANGELOG.md
|
137
138
|
- Gemfile
|
138
139
|
- LICENSE.txt
|
139
140
|
- README.md
|
140
141
|
- Rakefile
|
141
|
-
- circle.yml
|
142
142
|
- inline_svg.gemspec
|
143
143
|
- lib/inline_svg.rb
|
144
144
|
- lib/inline_svg/action_view/helpers.rb
|
data/.travis.yml
DELETED
data/circle.yml
DELETED