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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00be9b22cbd6a33c67e951d123c98dbaa153e84353616667e8ab634304255fbf
4
- data.tar.gz: 340a65c9678090675c7496e3872c98133e84675b93ad2c5c7b293794d9ba259d
3
+ metadata.gz: bdfa5c9dbc5a0592a4b42952093bf5f3e268e63b8e37cad1c7bfcefb0358cb33
4
+ data.tar.gz: 3bdebe8423a212a04b26e158476795b3cca238f2d146967839de71132152ef74
5
5
  SHA512:
6
- metadata.gz: 548f9329f714dd74709169655b1bb23f9f30d08fceae0db7b7d19b72789af66c582e2c4cb7210f5e255097a16fe745b5d23b461d747e723b3261b789cd5abdbd
7
- data.tar.gz: d0ac1f58901c9557c44ae308ea6d789cc573aeafc49931893ee631f6dfa454d4a379cafbad98c1ef765e288c8b4f33860ca77eeafe814beb7a92eba54f0c4606
6
+ metadata.gz: 396db96b068f08fb559c22bb8eb8c50218567a82f0c702fcc6a3af83babdfe0584b044831c66cdab0dd58aae10bbe4a7f15f5242fa18eb13e2952813b4a39adc
7
+ data.tar.gz: 8734d2170021290c9f8d23cde6b47d9dd012b0bb065901fc17a79e09641f75ad6505d7cce7e4bb9c337d0de3a18bdc9efe79d885e894010150ce1e40f06a81d1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 18.5.0
2
+
3
+ * Raise more specific error when wrapper not found. This will only be active when the host app has SLIMMER_WRAPPER_CHECK=true set in the host app's environment.
4
+
1
5
  # 18.4.0
2
6
 
3
7
  * Drop support for Ruby 3.0. Ruby 3.2 is now required.
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Slimmer
2
- VERSION = "18.4.0".freeze
2
+ VERSION = "18.5.0".freeze
3
3
  end
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.0
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-02-05 00:00:00.000000000 Z
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.14.0
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.14.0
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.5
254
+ rubygems_version: 3.5.11
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: Thinner than the skinner