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 +4 -4
- data/bin/canvas +2 -1
- data/lib/canvas/lint.rb +35 -15
- data/lib/canvas/version.rb +1 -1
- data/lib/canvas.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02a735325d86666992a3673a94898fd3ad6800e11c4efbe74b34eb7126b349cf
|
4
|
+
data.tar.gz: e86117c8bcc022a091448f90f4107aa9b07bc51c8d895e15937643ce0fe9502f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2ed2183d3766d3aa7daccfb40f35685739940e9e48cb419efd511d81e232e01f4865f58a06a0b07edd33786ab841ac6a6586331d874381a2722cfaf7e4dc4cb
|
7
|
+
data.tar.gz: 2deb9d2f391b9e47f76c5ceac8691e1786769992f684ed6ff11d4f9f6ce9a5a51ad98d40c6c968f87407d9775f1cdf01147e853aad5632fd57ff90b784728403
|
data/bin/canvas
CHANGED
data/lib/canvas/lint.rb
CHANGED
@@ -6,17 +6,18 @@ module Canvas
|
|
6
6
|
#:documented:
|
7
7
|
class Lint
|
8
8
|
def run
|
9
|
-
|
9
|
+
spin_group = CLI::UI::SpinGroup.new(auto_debrief: false)
|
10
10
|
|
11
|
-
@
|
11
|
+
@failed_checks = {}
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
checks = Checks.registered.map(&:new)
|
14
|
+
checks.each do |check|
|
15
|
+
run_check(check, spin_group)
|
15
16
|
end
|
16
17
|
|
17
|
-
|
18
|
+
spin_group.wait
|
18
19
|
|
19
|
-
if @
|
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,
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
data/lib/canvas/version.rb
CHANGED
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 :
|
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.
|
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-
|
12
|
+
date: 2022-12-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|