dugway 1.0.12 → 1.0.13

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: ca53a46e63f06064d7d5ff72d37a4056f99cd0210bd2ee12a3680bfe693bd84c
4
- data.tar.gz: 4b05f6b48ba91601c4a78c45d2f64a614f6792411fd60f980a732d5e22ea3bf3
3
+ metadata.gz: c3efe750c07138767b6b491f5fd375df42560fa0dd77fd18e3f0bd10578667f5
4
+ data.tar.gz: 90ab41b88afa8995d7890612ecdd262f0cb2146dfea7c7b1eced3d99bd78744d
5
5
  SHA512:
6
- metadata.gz: 589bd59aa78d9ffb203fd0d323f051d764b7e74a9182cbe9b70cbc6361a3d055ca4bf4258c83d4804a127a9c16c7d6f191bef9dfe532658f0e056f7188efb588
7
- data.tar.gz: 1fdf871fdb967fc908937524d48e5b7a431704b6b977b84037424006d9b3848d2c1db98026f8f89b13f720b4ba109e50af6b118bc540d7a178b809d197607a67
6
+ metadata.gz: 922ee155123b7f98a421bdf5039b707b48defa71a55296ecad5ac96185c587775885b78e4d3534462a52a35f86af23d69094e65df2bbbf58e217f06cbcfd00d6
7
+ data.tar.gz: 419a042a3b9fffb5d8951b27c06b300d996a95407bf634d988fced33eb3bb8af380eee29e2f157d87d19c045a60e13d3037f196980fb9b0a5c2be535cf14f230
@@ -34,7 +34,7 @@ body#cart
34
34
 
35
35
  a.remove
36
36
  display: inline-block
37
- background: #ddd + 20
37
+ background: lighten(#ddd, 20%)
38
38
  border-radius: 20px
39
39
  height: 20px
40
40
  line-height: 18px
data/lib/dugway/theme.rb CHANGED
@@ -143,7 +143,7 @@ module Dugway
143
143
  def validate_required_layout_attributes
144
144
  layout_content = read_source_file('layout.html')
145
145
 
146
- unless layout_content =~ /<body[^>]*data-bc-page-type[^>]*>/
146
+ unless layout_content =~ /<body.*?\bdata-bc-page-type\b/
147
147
  @errors << "layout.html missing `data-bc-page-type` attribute on body tag"
148
148
  end
149
149
 
@@ -168,30 +168,32 @@ module Dugway
168
168
  end
169
169
 
170
170
  def validate_preset_styles(preset)
171
- @errors << 'Preset is missing group_name' unless preset['group_name'].is_a?(String)
171
+ @errors << 'Preset is missing group_name' if preset['group_name'].to_s.strip.empty?
172
172
  @errors << 'Preset is missing styles' unless preset['styles'].is_a?(Array)
173
173
 
174
174
  preset['styles'].each do |style|
175
- @errors << 'Style is missing style_name' unless style['style_name'].is_a?(String)
175
+ @errors << "Style in group '#{preset['group_name']}' - Missing style_name" if style['style_name'].to_s.strip.empty?
176
176
 
177
177
  if style['fonts'].is_a?(Hash) && !style['fonts'].empty?
178
178
  style['fonts'].each_value do |font|
179
- @errors << 'Font value should be a string' unless font.is_a?(String)
179
+ @errors << "Style '#{style['style_name']} - Contains an invalid font name" if font.to_s.strip.empty?
180
180
  end
181
181
  else
182
- @errors << 'Style is missing fonts'
182
+ @errors << "Style '#{style['style_name']}' - Missing fonts"
183
183
  end
184
184
 
185
185
  if style['colors'].is_a?(Hash) && !style['colors'].empty?
186
186
  style['colors'].each do |key, color|
187
- @errors << 'Invalid color format' unless color =~ /^#[0-9A-Fa-f]{6}$/
187
+ unless color =~ /^#[0-9A-Fa-f]{6}$/
188
+ @errors << "Style '#{style['style_name']}' - Invalid color value '#{color}' for color '#{key}''"
189
+ end
188
190
  end
189
191
  else
190
- @errors << 'Style is missing colors'
192
+ @errors << "Style '#{style['style_name']}' - Missing required color settings"
191
193
  end
192
194
  end
193
195
 
194
- @errors << 'Style names should be unique' unless preset['styles'].map { |style| style['style_name'] }.uniq.length == preset['styles'].length
196
+ validate_style_name_uniqueness(preset['styles'])
195
197
  end
196
198
 
197
199
  def validate_style_references(preset)
@@ -209,11 +211,20 @@ module Dugway
209
211
  extra_keys = style_keys - variables
210
212
  missing_keys = variables - style_keys
211
213
 
212
- @errors << "Extra #{key_type} keys: #{extra_keys.join(', ')}" unless extra_keys.empty?
213
- @errors << "Missing #{key_type} keys: #{missing_keys.join(', ')}" unless missing_keys.empty?
214
+ @errors << "Style '#{style['style_name']}' - Extra #{key_type} keys: #{extra_keys.join(', ')}" unless extra_keys.empty?
215
+ @errors << "Style '#{style['style_name']}' - Missing #{key_type} keys: #{missing_keys.join(', ')}" unless missing_keys.empty?
214
216
  end
215
217
  end
216
218
 
219
+ def validate_style_name_uniqueness(styles)
220
+ duplicates = styles
221
+ .group_by { |s| s['style_name'] }
222
+ .select { |_, group| group.size > 1 }
223
+ .keys
224
+
225
+ @errors << "Duplicate style names found: #{duplicates.join(', ')}" if duplicates.any?
226
+ end
227
+
217
228
  def source_dir
218
229
  Dugway.source_dir
219
230
  end
@@ -1,3 +1,3 @@
1
1
  module Dugway
2
- VERSION = "1.0.12"
2
+ VERSION = "1.0.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dugway
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Big Cartel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-10 00:00:00.000000000 Z
11
+ date: 2024-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler