easol-canvas 3.0.0 → 3.1.1

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: e3e459457eae0524f0281bb9ecf65bd3070bb1673d43f5db5c310312a2117df4
4
- data.tar.gz: 1f50ab28d983d59c985295fa5899ea7b19e5d8d202a5595f0828aca562ad0830
3
+ metadata.gz: 02a735325d86666992a3673a94898fd3ad6800e11c4efbe74b34eb7126b349cf
4
+ data.tar.gz: e86117c8bcc022a091448f90f4107aa9b07bc51c8d895e15937643ce0fe9502f
5
5
  SHA512:
6
- metadata.gz: 8f9d688d4ac0f97731d8ec38e548dc5f69a6c29546a029ee9825e9e5e30f58c4dba0d1a8331846e2f8f5166f735ab3a88cb5063d8ae59a95fb1904886e27a85a
7
- data.tar.gz: c0c3977a8d4ad41df4ed9b43e53e4699e555db5d4c0596605d990e722de927108a9ecfbccfce02d8aae0da58b0f9c10a7ed604a099b24db6f831be6116750814
6
+ metadata.gz: c2ed2183d3766d3aa7daccfb40f35685739940e9e48cb419efd511d81e232e01f4865f58a06a0b07edd33786ab841ac6a6586331d874381a2722cfaf7e4dc4cb
7
+ data.tar.gz: 2deb9d2f391b9e47f76c5ceac8691e1786769992f684ed6ff11d4f9f6ce9a5a51ad98d40c6c968f87407d9775f1cdf01147e853aad5632fd57ff90b784728403
data/bin/canvas CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative '../lib/canvas'
3
+ $LOAD_PATH.push File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
4
+ require_relative "../lib/canvas"
4
5
 
5
6
  Canvas::Cli.start(ARGV)
@@ -38,6 +38,7 @@ module Canvas
38
38
  register_tag("easol_badge", ::Liquid::Tag)
39
39
  register_tag("accommodation_availability", ::Liquid::Block)
40
40
  register_tag("cache", ::Liquid::Block)
41
+ register_tag("currency_switcher", ::Liquid::Tag)
41
42
  end
42
43
  end
43
44
  end
data/lib/canvas/lint.rb CHANGED
@@ -6,17 +6,18 @@ module Canvas
6
6
  #:documented:
7
7
  class Lint
8
8
  def run
9
- output_context = CLI::UI::SpinGroup.new(auto_debrief: false)
9
+ spin_group = CLI::UI::SpinGroup.new(auto_debrief: false)
10
10
 
11
- @checks = Checks.registered.map(&:new)
11
+ @failed_checks = {}
12
12
 
13
- @checks.each do |check|
14
- run_check(check, output_context)
13
+ checks = Checks.registered.map(&:new)
14
+ checks.each do |check|
15
+ run_check(check, spin_group)
15
16
  end
16
17
 
17
- output_context.wait
18
+ spin_group.wait
18
19
 
19
- if @checks.any?(&:failed?)
20
+ if @failed_checks.any?
20
21
  puts debrief_message
21
22
  exit 1
22
23
  end
@@ -24,20 +25,39 @@ module Canvas
24
25
 
25
26
  private
26
27
 
27
- def run_check(check, output_context)
28
- output_context.add(check.class.name) do
29
- check.run
30
- raise if check.offenses.any?
28
+ def run_check(check, spin_group)
29
+ offenses = run_check_and_return_offenses(check)
30
+
31
+ output_check(
32
+ spin_group,
33
+ name: check.class.name,
34
+ success: offenses.empty?
35
+ )
36
+
37
+ if offenses.any?
38
+ @failed_checks[check.class.name] = offenses
31
39
  end
32
40
  end
33
41
 
42
+ def output_check(spin_group, name:, success:)
43
+ spin_group.add(name) do
44
+ raise if !success
45
+ end
46
+ end
47
+
48
+ def run_check_and_return_offenses(check)
49
+ check.run
50
+ check.offenses.map(&:message)
51
+ rescue => ex
52
+ [ex.message + "\n" + ex.backtrace.join("\n")]
53
+ end
54
+
34
55
  def debrief_message
35
56
  CLI::UI::Frame.open("Failures", color: :red) do
36
- failed_checks = @checks.filter(&:failed?)
37
- failed_checks.map do |check|
38
- CLI::UI::Frame.open(check.class.name, color: :red) do
39
- output = check.offenses.map { |offense|
40
- CLI::UI.fmt "{{x}} #{offense.message}"
57
+ @failed_checks.map do |check_name, messages|
58
+ CLI::UI::Frame.open(check_name, color: :red) do
59
+ output = messages.map { |message|
60
+ CLI::UI.fmt "{{x}} #{message}"
41
61
  }
42
62
  puts output.join("\n")
43
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Canvas
4
- VERSION = "3.0.0"
4
+ VERSION = "3.1.1"
5
5
  end
data/lib/canvas.rb CHANGED
@@ -7,7 +7,7 @@ module Canvas
7
7
  autoload :Constants, "canvas/constants"
8
8
  autoload :Lint, "canvas/lint"
9
9
  autoload :Offense, "canvas/offense"
10
- autoload :Version, "canvas/version"
10
+ autoload :VERSION, "canvas/version"
11
11
  end
12
12
 
13
13
  # We need to ensure Canvas::Validator::SchemaAttribute::Base is required first
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easol-canvas
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Byrne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 1980-01-01 00:00:00.000000000 Z
12
+ date: 2022-12-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  requirements: []
174
- rubygems_version: 3.2.26
174
+ rubygems_version: 3.3.7
175
175
  signing_key:
176
176
  specification_version: 4
177
177
  summary: CLI to help with building themes for Easol