yaml_normalizer 2.0.0.rc2 → 2.0.0.rc3
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: 64bf7d5fc2a4e87abf2804d165a46ea8001028bc73aced88f9b282a9179a8edf
|
4
|
+
data.tar.gz: 2410def89831cdba0d34d9354b4eec01277e758ec30e9b01132bb47717f16339
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b2b58516921ebbba165be4c9715268d80f0da05b5856adc0a760f8bb6edacb42e98abeb862561763799dadb8c2a13b5f93c5c3c53caf05b398c90806ca5cf93
|
7
|
+
data.tar.gz: 064fc27c2b078ac794108da080a84ddc596a95855900d4e188edf6a6602896379d55cbc595a5807c0fda6aa48b3c437090f217c20f7b1e286ff2f7b618bac13c
|
@@ -35,13 +35,14 @@ module YamlNormalizer
|
|
35
35
|
|
36
36
|
# process returns true on success and nil on error
|
37
37
|
def process(file)
|
38
|
-
$stdout.print "Processing #{file}\n"
|
39
38
|
return true if IsYaml.call(file) && normalized?(file)
|
40
39
|
|
41
40
|
nil
|
42
41
|
end
|
43
42
|
|
44
43
|
def normalized?(file)
|
44
|
+
$stdout.print "Processing #{file}\n"
|
45
|
+
|
45
46
|
file = relative_path_for(file)
|
46
47
|
input = read(file)
|
47
48
|
norm = normalize_yaml(input)
|
@@ -38,7 +38,7 @@ module YamlNormalizer
|
|
38
38
|
def parseable?
|
39
39
|
parse(read(file))
|
40
40
|
rescue Psych::SyntaxError => e
|
41
|
-
$stderr.print "\t[ERROR] file is not parseable as YAML - #{e.message}\n\n"
|
41
|
+
$stderr.print "\t[ERROR] #{file} is not parseable as YAML - #{e.message}\n\n"
|
42
42
|
false
|
43
43
|
end
|
44
44
|
|
@@ -33,12 +33,13 @@ module YamlNormalizer
|
|
33
33
|
private
|
34
34
|
|
35
35
|
def process(file)
|
36
|
-
$stdout.print "Processing #{file}\n"
|
37
36
|
normalize!(file) if IsYaml.call(file)
|
38
37
|
end
|
39
38
|
|
40
39
|
def normalize!(file)
|
40
|
+
$stdout.print "Processing #{file}\n"
|
41
41
|
file = relative_path_for(file)
|
42
|
+
|
42
43
|
if stable?(input = read(file), norm = normalize_yaml(input))
|
43
44
|
File.open(file, 'w') { |f| f.write(norm) }
|
44
45
|
$stdout.print "\t[PASSED] file has been normalized\n\n"
|