yaml_normalizer 2.0.0.rc3 → 2.0.0.rc4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b36981bd950d7a4bd1425819e6f8ba858796b62f90716ffe2557bd653a6d251e
|
4
|
+
data.tar.gz: 223e5be12bb6eaeaf9872ec9ad3bd0bb3c68c59ea5e73225fa6a2a7e588c2e53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5013c1015d52ff14b0c6a21143e3ac6777d2cd29830a64c599504f0b4d17821410aa848b759862c56b07540ab10c0283c64e801555bbe02522c4c37a484b9804
|
7
|
+
data.tar.gz: ef78547ae70ca04379f9df3b205b6498d26d2cea10e01d8cb08061ddc7b4d11639e202c4f2eafbe121b1b61387b01e6b21bbb7029557da7ef2428466ab3bde75
|
@@ -37,21 +37,20 @@ module YamlNormalizer
|
|
37
37
|
def process(file)
|
38
38
|
return true if IsYaml.call(file) && normalized?(file)
|
39
39
|
|
40
|
+
$stderr.print "#{file} not a YAML file\n"
|
40
41
|
nil
|
41
42
|
end
|
42
43
|
|
43
44
|
def normalized?(file)
|
44
|
-
$stdout.print "Processing #{file}\n"
|
45
|
-
|
46
45
|
file = relative_path_for(file)
|
47
46
|
input = read(file)
|
48
47
|
norm = normalize_yaml(input)
|
49
48
|
check = input.eql?(norm)
|
50
49
|
|
51
50
|
if check
|
52
|
-
$stdout.print "
|
51
|
+
$stdout.print "[PASSED] already normalized #{file}\n"
|
53
52
|
else
|
54
|
-
$stdout.print "
|
53
|
+
$stdout.print "[FAILED] normalization suggested for #{file}\n"
|
55
54
|
end
|
56
55
|
|
57
56
|
check
|
@@ -33,18 +33,20 @@ module YamlNormalizer
|
|
33
33
|
private
|
34
34
|
|
35
35
|
def process(file)
|
36
|
-
|
36
|
+
if IsYaml.call(file)
|
37
|
+
normalize!(file)
|
38
|
+
else
|
39
|
+
$stderr.print "#{file} not a YAML file\n"
|
40
|
+
end
|
37
41
|
end
|
38
42
|
|
39
43
|
def normalize!(file)
|
40
|
-
$stdout.print "Processing #{file}\n"
|
41
44
|
file = relative_path_for(file)
|
42
|
-
|
43
45
|
if stable?(input = read(file), norm = normalize_yaml(input))
|
44
46
|
File.open(file, 'w') { |f| f.write(norm) }
|
45
|
-
$
|
47
|
+
$stderr.print "[NORMALIZED] #{file}\n"
|
46
48
|
else
|
47
|
-
$
|
49
|
+
$stderr.print "[ERROR] Could not normalize #{file}\n"
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|