easol-canvas 3.1.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: e63c9433580fb2f338b5b9ebdb7f86697e9ff5f9a9c57314463779330d81d8a0
4
- data.tar.gz: 22b11a8f25bbf68a8c81431987008d34d1f6803eeef5737fb2dd014c742d4403
3
+ metadata.gz: 02a735325d86666992a3673a94898fd3ad6800e11c4efbe74b34eb7126b349cf
4
+ data.tar.gz: e86117c8bcc022a091448f90f4107aa9b07bc51c8d895e15937643ce0fe9502f
5
5
  SHA512:
6
- metadata.gz: 31e7aaad1f6562f238917a9101629d89bc4f5da3bb5be9e006933bbeabb0315a75a652cc03d943460f8de4077895fa4deada5aa504a2068226d5e7a18ab6ed7d
7
- data.tar.gz: bfc8b4002c79133a134f3a2ad073631f9d93595573e2b442d489f478e635c4519c267f0834c684eb7a6b05d4432d9337cb7c3ec3201f65694c29986f6d8a60c4
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)
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.1.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.1.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: 2022-11-25 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