inline_svg 1.0.0 → 1.10.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 +5 -5
- data/.github/workflows/integration_test.yml +47 -0
- data/.github/workflows/rails_6_webpacker_integration_tests.yaml +62 -0
- data/.github/workflows/ruby.yml +20 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +421 -0
- data/CHANGELOG.md +143 -3
- data/README.md +149 -30
- data/Rakefile +7 -0
- data/inline_svg.gemspec +2 -1
- data/lib/inline_svg/action_view/helpers.rb +68 -7
- data/lib/inline_svg/cached_asset_file.rb +71 -0
- data/lib/inline_svg/finds_asset_paths.rb +1 -1
- data/lib/inline_svg/id_generator.rb +12 -3
- data/lib/inline_svg/io_resource.rb +4 -3
- data/lib/inline_svg/propshaft_asset_finder.rb +16 -0
- data/lib/inline_svg/railtie.rb +8 -3
- data/lib/inline_svg/static_asset_finder.rb +5 -2
- data/lib/inline_svg/transform_pipeline/transformations/aria_attributes.rb +16 -19
- data/lib/inline_svg/transform_pipeline/transformations/aria_hidden.rb +9 -0
- data/lib/inline_svg/transform_pipeline/transformations/aria_hidden_attribute.rb +9 -0
- data/lib/inline_svg/transform_pipeline/transformations/class_attribute.rb +5 -6
- data/lib/inline_svg/transform_pipeline/transformations/data_attributes.rb +4 -5
- data/lib/inline_svg/transform_pipeline/transformations/description.rb +7 -6
- data/lib/inline_svg/transform_pipeline/transformations/height.rb +3 -4
- data/lib/inline_svg/transform_pipeline/transformations/id_attribute.rb +3 -4
- data/lib/inline_svg/transform_pipeline/transformations/no_comment.rb +4 -4
- data/lib/inline_svg/transform_pipeline/transformations/preserve_aspect_ratio.rb +3 -4
- data/lib/inline_svg/transform_pipeline/transformations/size.rb +4 -5
- data/lib/inline_svg/transform_pipeline/transformations/style_attribute.rb +11 -0
- data/lib/inline_svg/transform_pipeline/transformations/title.rb +7 -6
- data/lib/inline_svg/transform_pipeline/transformations/transformation.rb +13 -0
- data/lib/inline_svg/transform_pipeline/transformations/view_box.rb +9 -0
- data/lib/inline_svg/transform_pipeline/transformations/width.rb +3 -4
- data/lib/inline_svg/transform_pipeline/transformations.rb +11 -2
- data/lib/inline_svg/transform_pipeline.rb +1 -1
- data/lib/inline_svg/version.rb +1 -1
- data/lib/inline_svg/webpack_asset_finder.rb +60 -0
- data/lib/inline_svg.rb +46 -9
- data/spec/cached_asset_file_spec.rb +73 -0
- data/spec/files/static_assets/assets0/known-document-two.svg +1 -0
- data/spec/files/static_assets/assets0/known-document.svg +1 -0
- data/spec/files/static_assets/assets0/some-document.svg +1 -0
- data/spec/files/static_assets/assets1/known-document.svg +1 -0
- data/spec/files/static_assets/assets1/other-document.svg +3 -0
- data/spec/files/static_assets/assets1/some-file.txt +1 -0
- data/spec/finds_asset_paths_spec.rb +45 -0
- data/spec/helpers/inline_svg_spec.rb +117 -51
- data/spec/id_generator_spec.rb +5 -3
- data/spec/inline_svg_spec.rb +48 -0
- data/spec/propshaft_asset_finder_spec.rb +23 -0
- data/spec/static_asset_finder_spec.rb +25 -0
- data/spec/transformation_pipeline/transformations/aria_attributes_spec.rb +6 -6
- data/spec/transformation_pipeline/transformations/aria_hidden_attribute_spec.rb +12 -0
- data/spec/transformation_pipeline/transformations/height_spec.rb +9 -0
- data/spec/transformation_pipeline/transformations/style_attribute_spec.rb +26 -0
- data/spec/transformation_pipeline/transformations/title_spec.rb +9 -0
- data/spec/transformation_pipeline/transformations/transformation_spec.rb +39 -0
- data/spec/transformation_pipeline/transformations/view_box_spec.rb +13 -0
- data/spec/transformation_pipeline/transformations_spec.rb +7 -1
- data/spec/webpack_asset_finder_spec.rb +23 -0
- metadata +62 -10
- data/circle.yml +0 -3
@@ -15,29 +15,35 @@ describe InlineSvg::TransformPipeline::Transformations do
|
|
15
15
|
transformations = InlineSvg::TransformPipeline::Transformations.lookup(
|
16
16
|
nocomment: 'irrelevant',
|
17
17
|
class: 'irrelevant',
|
18
|
+
style: 'irrelevant',
|
18
19
|
title: 'irrelevant',
|
19
20
|
desc: 'irrelevant',
|
20
21
|
size: 'irrelevant',
|
21
22
|
height: 'irrelevant',
|
22
23
|
width: 'irrelevant',
|
24
|
+
view_box: 'irrelevant',
|
23
25
|
id: 'irrelevant',
|
24
26
|
data: 'irrelevant',
|
25
27
|
preserve_aspect_ratio: 'irrelevant',
|
26
28
|
aria: 'irrelevant',
|
29
|
+
aria_hidden: "true"
|
27
30
|
)
|
28
31
|
|
29
32
|
expect(transformations.map(&:class)).to match_array([
|
30
33
|
InlineSvg::TransformPipeline::Transformations::NoComment,
|
31
34
|
InlineSvg::TransformPipeline::Transformations::ClassAttribute,
|
35
|
+
InlineSvg::TransformPipeline::Transformations::StyleAttribute,
|
32
36
|
InlineSvg::TransformPipeline::Transformations::Title,
|
33
37
|
InlineSvg::TransformPipeline::Transformations::Description,
|
34
38
|
InlineSvg::TransformPipeline::Transformations::Size,
|
35
39
|
InlineSvg::TransformPipeline::Transformations::Height,
|
36
40
|
InlineSvg::TransformPipeline::Transformations::Width,
|
41
|
+
InlineSvg::TransformPipeline::Transformations::ViewBox,
|
37
42
|
InlineSvg::TransformPipeline::Transformations::IdAttribute,
|
38
43
|
InlineSvg::TransformPipeline::Transformations::DataAttributes,
|
39
44
|
InlineSvg::TransformPipeline::Transformations::PreserveAspectRatio,
|
40
|
-
InlineSvg::TransformPipeline::Transformations::AriaAttributes
|
45
|
+
InlineSvg::TransformPipeline::Transformations::AriaAttributes,
|
46
|
+
InlineSvg::TransformPipeline::Transformations::AriaHiddenAttribute
|
41
47
|
])
|
42
48
|
end
|
43
49
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative '../lib/inline_svg'
|
2
|
+
|
3
|
+
describe InlineSvg::WebpackAssetFinder do
|
4
|
+
context "when the file is not found" do
|
5
|
+
it "returns nil" do
|
6
|
+
stub_const('Rails', double('Rails').as_null_object)
|
7
|
+
stub_const('Webpacker', double('Webpacker').as_null_object)
|
8
|
+
expect(::Webpacker.manifest).to receive(:lookup).with('some-file').and_return(nil)
|
9
|
+
|
10
|
+
expect(described_class.find_asset('some-file').pathname).to be_nil
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when Shakapacker is defined" do
|
15
|
+
it "uses the new spelling" do
|
16
|
+
stub_const('Rails', double('Rails').as_null_object)
|
17
|
+
stub_const('Shakapacker', double('Shakapacker').as_null_object)
|
18
|
+
expect(::Shakapacker.manifest).to receive(:lookup).with('some-file').and_return(nil)
|
19
|
+
|
20
|
+
expect(described_class.find_asset('some-file').pathname).to be_nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
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.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Martin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: activesupport
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,25 +129,33 @@ executables: []
|
|
115
129
|
extensions: []
|
116
130
|
extra_rdoc_files: []
|
117
131
|
files:
|
132
|
+
- ".github/workflows/integration_test.yml"
|
133
|
+
- ".github/workflows/rails_6_webpacker_integration_tests.yaml"
|
134
|
+
- ".github/workflows/ruby.yml"
|
118
135
|
- ".gitignore"
|
136
|
+
- ".rubocop.yml"
|
137
|
+
- ".rubocop_todo.yml"
|
119
138
|
- CHANGELOG.md
|
120
139
|
- Gemfile
|
121
140
|
- LICENSE.txt
|
122
141
|
- README.md
|
123
142
|
- Rakefile
|
124
|
-
- circle.yml
|
125
143
|
- inline_svg.gemspec
|
126
144
|
- lib/inline_svg.rb
|
127
145
|
- lib/inline_svg/action_view/helpers.rb
|
128
146
|
- lib/inline_svg/asset_file.rb
|
147
|
+
- lib/inline_svg/cached_asset_file.rb
|
129
148
|
- lib/inline_svg/finds_asset_paths.rb
|
130
149
|
- lib/inline_svg/id_generator.rb
|
131
150
|
- lib/inline_svg/io_resource.rb
|
151
|
+
- lib/inline_svg/propshaft_asset_finder.rb
|
132
152
|
- lib/inline_svg/railtie.rb
|
133
153
|
- lib/inline_svg/static_asset_finder.rb
|
134
154
|
- lib/inline_svg/transform_pipeline.rb
|
135
155
|
- lib/inline_svg/transform_pipeline/transformations.rb
|
136
156
|
- lib/inline_svg/transform_pipeline/transformations/aria_attributes.rb
|
157
|
+
- lib/inline_svg/transform_pipeline/transformations/aria_hidden.rb
|
158
|
+
- lib/inline_svg/transform_pipeline/transformations/aria_hidden_attribute.rb
|
137
159
|
- lib/inline_svg/transform_pipeline/transformations/class_attribute.rb
|
138
160
|
- lib/inline_svg/transform_pipeline/transformations/data_attributes.rb
|
139
161
|
- lib/inline_svg/transform_pipeline/transformations/description.rb
|
@@ -142,18 +164,31 @@ files:
|
|
142
164
|
- lib/inline_svg/transform_pipeline/transformations/no_comment.rb
|
143
165
|
- lib/inline_svg/transform_pipeline/transformations/preserve_aspect_ratio.rb
|
144
166
|
- lib/inline_svg/transform_pipeline/transformations/size.rb
|
167
|
+
- lib/inline_svg/transform_pipeline/transformations/style_attribute.rb
|
145
168
|
- lib/inline_svg/transform_pipeline/transformations/title.rb
|
146
169
|
- lib/inline_svg/transform_pipeline/transformations/transformation.rb
|
170
|
+
- lib/inline_svg/transform_pipeline/transformations/view_box.rb
|
147
171
|
- lib/inline_svg/transform_pipeline/transformations/width.rb
|
148
172
|
- lib/inline_svg/version.rb
|
173
|
+
- lib/inline_svg/webpack_asset_finder.rb
|
149
174
|
- spec/asset_file_spec.rb
|
175
|
+
- spec/cached_asset_file_spec.rb
|
150
176
|
- spec/files/example.svg
|
177
|
+
- spec/files/static_assets/assets0/known-document-two.svg
|
178
|
+
- spec/files/static_assets/assets0/known-document.svg
|
179
|
+
- spec/files/static_assets/assets0/some-document.svg
|
180
|
+
- spec/files/static_assets/assets1/known-document.svg
|
181
|
+
- spec/files/static_assets/assets1/other-document.svg
|
182
|
+
- spec/files/static_assets/assets1/some-file.txt
|
151
183
|
- spec/finds_asset_paths_spec.rb
|
152
184
|
- spec/helpers/inline_svg_spec.rb
|
153
185
|
- spec/id_generator_spec.rb
|
154
186
|
- spec/inline_svg_spec.rb
|
155
187
|
- spec/io_resource_spec.rb
|
188
|
+
- spec/propshaft_asset_finder_spec.rb
|
189
|
+
- spec/static_asset_finder_spec.rb
|
156
190
|
- spec/transformation_pipeline/transformations/aria_attributes_spec.rb
|
191
|
+
- spec/transformation_pipeline/transformations/aria_hidden_attribute_spec.rb
|
157
192
|
- spec/transformation_pipeline/transformations/class_attribute_spec.rb
|
158
193
|
- spec/transformation_pipeline/transformations/data_attributes_spec.rb
|
159
194
|
- spec/transformation_pipeline/transformations/description_spec.rb
|
@@ -161,14 +196,18 @@ files:
|
|
161
196
|
- spec/transformation_pipeline/transformations/id_attribute_spec.rb
|
162
197
|
- spec/transformation_pipeline/transformations/preserve_aspect_ratio_spec.rb
|
163
198
|
- spec/transformation_pipeline/transformations/size_spec.rb
|
199
|
+
- spec/transformation_pipeline/transformations/style_attribute_spec.rb
|
164
200
|
- spec/transformation_pipeline/transformations/title_spec.rb
|
201
|
+
- spec/transformation_pipeline/transformations/transformation_spec.rb
|
202
|
+
- spec/transformation_pipeline/transformations/view_box_spec.rb
|
165
203
|
- spec/transformation_pipeline/transformations/width_spec.rb
|
166
204
|
- spec/transformation_pipeline/transformations_spec.rb
|
205
|
+
- spec/webpack_asset_finder_spec.rb
|
167
206
|
homepage: https://github.com/jamesmartin/inline_svg
|
168
207
|
licenses:
|
169
208
|
- MIT
|
170
209
|
metadata: {}
|
171
|
-
post_install_message:
|
210
|
+
post_install_message:
|
172
211
|
rdoc_options: []
|
173
212
|
require_paths:
|
174
213
|
- lib
|
@@ -183,20 +222,29 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
222
|
- !ruby/object:Gem::Version
|
184
223
|
version: '0'
|
185
224
|
requirements: []
|
186
|
-
|
187
|
-
|
188
|
-
signing_key:
|
225
|
+
rubygems_version: 3.1.6
|
226
|
+
signing_key:
|
189
227
|
specification_version: 4
|
190
228
|
summary: Embeds an SVG document, inline.
|
191
229
|
test_files:
|
192
230
|
- spec/asset_file_spec.rb
|
231
|
+
- spec/cached_asset_file_spec.rb
|
193
232
|
- spec/files/example.svg
|
233
|
+
- spec/files/static_assets/assets0/known-document-two.svg
|
234
|
+
- spec/files/static_assets/assets0/known-document.svg
|
235
|
+
- spec/files/static_assets/assets0/some-document.svg
|
236
|
+
- spec/files/static_assets/assets1/known-document.svg
|
237
|
+
- spec/files/static_assets/assets1/other-document.svg
|
238
|
+
- spec/files/static_assets/assets1/some-file.txt
|
194
239
|
- spec/finds_asset_paths_spec.rb
|
195
240
|
- spec/helpers/inline_svg_spec.rb
|
196
241
|
- spec/id_generator_spec.rb
|
197
242
|
- spec/inline_svg_spec.rb
|
198
243
|
- spec/io_resource_spec.rb
|
244
|
+
- spec/propshaft_asset_finder_spec.rb
|
245
|
+
- spec/static_asset_finder_spec.rb
|
199
246
|
- spec/transformation_pipeline/transformations/aria_attributes_spec.rb
|
247
|
+
- spec/transformation_pipeline/transformations/aria_hidden_attribute_spec.rb
|
200
248
|
- spec/transformation_pipeline/transformations/class_attribute_spec.rb
|
201
249
|
- spec/transformation_pipeline/transformations/data_attributes_spec.rb
|
202
250
|
- spec/transformation_pipeline/transformations/description_spec.rb
|
@@ -204,6 +252,10 @@ test_files:
|
|
204
252
|
- spec/transformation_pipeline/transformations/id_attribute_spec.rb
|
205
253
|
- spec/transformation_pipeline/transformations/preserve_aspect_ratio_spec.rb
|
206
254
|
- spec/transformation_pipeline/transformations/size_spec.rb
|
255
|
+
- spec/transformation_pipeline/transformations/style_attribute_spec.rb
|
207
256
|
- spec/transformation_pipeline/transformations/title_spec.rb
|
257
|
+
- spec/transformation_pipeline/transformations/transformation_spec.rb
|
258
|
+
- spec/transformation_pipeline/transformations/view_box_spec.rb
|
208
259
|
- spec/transformation_pipeline/transformations/width_spec.rb
|
209
260
|
- spec/transformation_pipeline/transformations_spec.rb
|
261
|
+
- spec/webpack_asset_finder_spec.rb
|
data/circle.yml
DELETED