yalphabetize 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/yalphabetize/file_yalphabetizer.rb +4 -6
- data/lib/yalphabetize/logger.rb +8 -8
- data/lib/yalphabetize/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8adda25f8bd79c06f784d72b46e8391e236f858133a3251369203aef16a661b2
|
4
|
+
data.tar.gz: a25104aa54b0d51451c1964b6cccb9600d5619514830dd19c49a48a18d4fee38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02a9cba0a46e97afbf79b5e6b8f9876c9380c526466d39b55d0032d239ec4214c08580df492cf076e7f8a72c23bf358571877328014befd6ffb13bad14ae14eb
|
7
|
+
data.tar.gz: d7e4741b3edd5934352750560041f9c03ea3ecc4b7ff8e4867474dc7e66539c51533f8d2efd295e64eea27467e233b2ab7f507a0dd212c52db55f1a2a385d505
|
@@ -14,12 +14,10 @@ module Yalphabetize
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def call
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
logger.log_no_offence
|
22
|
-
end
|
17
|
+
return logger.log_no_offence unless offences?
|
18
|
+
|
19
|
+
logger.log_offence(file_path)
|
20
|
+
autocorrect_file if autocorrect
|
23
21
|
end
|
24
22
|
|
25
23
|
private
|
data/lib/yalphabetize/logger.rb
CHANGED
@@ -15,13 +15,13 @@ module Yalphabetize
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def log_offence(file_path)
|
18
|
-
|
18
|
+
self.inspected_count += 1
|
19
19
|
offences[file_path] = :detected
|
20
20
|
output.print red 'O'
|
21
21
|
end
|
22
22
|
|
23
23
|
def log_no_offence
|
24
|
-
|
24
|
+
self.inspected_count += 1
|
25
25
|
output.print green '.'
|
26
26
|
end
|
27
27
|
|
@@ -30,6 +30,9 @@ module Yalphabetize
|
|
30
30
|
output.puts send(list_offences_color, "Offences: #{offences.size}")
|
31
31
|
|
32
32
|
offences.each { |file_path, status| puts_offence(file_path, status) }
|
33
|
+
return unless offences?
|
34
|
+
|
35
|
+
output.puts 'Offences can be automatically fixed with `-a` or `--autocorrect`'
|
33
36
|
end
|
34
37
|
|
35
38
|
def offences?
|
@@ -42,7 +45,8 @@ module Yalphabetize
|
|
42
45
|
|
43
46
|
private
|
44
47
|
|
45
|
-
attr_reader :offences, :
|
48
|
+
attr_reader :offences, :output
|
49
|
+
attr_accessor :inspected_count
|
46
50
|
|
47
51
|
def puts_offence(file_path, status)
|
48
52
|
case status
|
@@ -54,11 +58,7 @@ module Yalphabetize
|
|
54
58
|
end
|
55
59
|
|
56
60
|
def list_offences_color
|
57
|
-
|
58
|
-
:red
|
59
|
-
else
|
60
|
-
:green
|
61
|
-
end
|
61
|
+
offences? ? :red : :green
|
62
62
|
end
|
63
63
|
|
64
64
|
def red(string)
|
data/lib/yalphabetize/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yalphabetize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Jenkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factory_bot
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
|
-
rubygems_version: 3.
|
160
|
+
rubygems_version: 3.1.6
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Alphabetize your YAML files
|