slimmer 18.4.0 → 18.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/slimmer/processors/body_inserter.rb +6 -0
- data/lib/slimmer/skin.rb +6 -0
- data/lib/slimmer/version.rb +1 -1
- data/lib/slimmer.rb +1 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdfa5c9dbc5a0592a4b42952093bf5f3e268e63b8e37cad1c7bfcefb0358cb33
|
4
|
+
data.tar.gz: 3bdebe8423a212a04b26e158476795b3cca238f2d146967839de71132152ef74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 396db96b068f08fb559c22bb8eb8c50218567a82f0c702fcc6a3af83babdfe0584b044831c66cdab0dd58aae10bbe4a7f15f5242fa18eb13e2952813b4a39adc
|
7
|
+
data.tar.gz: 8734d2170021290c9f8d23cde6b47d9dd012b0bb065901fc17a79e09641f75ad6505d7cce7e4bb9c337d0de3a18bdc9efe79d885e894010150ce1e40f06a81d1
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,8 @@ module Slimmer::Processors
|
|
10
10
|
source_markup = src.at_css(@source_selector)
|
11
11
|
destination_markup = dest.at_css(@destination_selector)
|
12
12
|
|
13
|
+
raise(Slimmer::SourceWrapperNotFoundError, "Source wrapper div not found", caller) if source_markup.nil? && wrapper_check?
|
14
|
+
|
13
15
|
css_classes = []
|
14
16
|
css_classes << source_markup.attributes["class"].to_s.split(/ +/) if source_markup.has_attribute?("class")
|
15
17
|
css_classes << destination_markup.attributes["class"].to_s.split(/ +/) if destination_markup.has_attribute?("class")
|
@@ -24,5 +26,9 @@ module Slimmer::Processors
|
|
24
26
|
def is_gem_layout?
|
25
27
|
@headers[Slimmer::Headers::TEMPLATE_HEADER]&.start_with?("gem_layout")
|
26
28
|
end
|
29
|
+
|
30
|
+
def wrapper_check?
|
31
|
+
ENV["SLIMMER_WRAPPER_CHECK"] == "true"
|
32
|
+
end
|
27
33
|
end
|
28
34
|
end
|
data/lib/slimmer/skin.rb
CHANGED
@@ -122,6 +122,12 @@ module Slimmer
|
|
122
122
|
|
123
123
|
template_name = response.headers[Headers::TEMPLATE_HEADER] || "gem_layout"
|
124
124
|
process(processors, body, template(template_name), source_request.env)
|
125
|
+
rescue SourceWrapperNotFoundError => e
|
126
|
+
message = "#{e.message} "\
|
127
|
+
"at: #{source_request.base_url}#{source_request.path} "\
|
128
|
+
"length: #{body.to_s.length} "\
|
129
|
+
"html: #{body.to_s[0, 300].match?(/<html>/i)}"
|
130
|
+
raise SourceWrapperNotFoundError, message, caller
|
125
131
|
end
|
126
132
|
end
|
127
133
|
end
|
data/lib/slimmer/version.rb
CHANGED
data/lib/slimmer.rb
CHANGED
@@ -51,4 +51,5 @@ module Slimmer
|
|
51
51
|
class CouldNotRetrieveTemplate < StandardError; end
|
52
52
|
class TemplateNotFoundException < CouldNotRetrieveTemplate; end
|
53
53
|
class IntermittentRetrievalError < CouldNotRetrieveTemplate; end
|
54
|
+
class SourceWrapperNotFoundError < StandardError; end
|
54
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 18.
|
4
|
+
version: 18.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - '='
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 4.
|
173
|
+
version: 4.18.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - '='
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 4.
|
180
|
+
version: 4.18.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: webmock
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
251
|
- !ruby/object:Gem::Version
|
252
252
|
version: '0'
|
253
253
|
requirements: []
|
254
|
-
rubygems_version: 3.5.
|
254
|
+
rubygems_version: 3.5.11
|
255
255
|
signing_key:
|
256
256
|
specification_version: 4
|
257
257
|
summary: Thinner than the skinner
|