dorian-yaml-compare 0.1.0 → 0.2.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/dorian/yaml/compare.rb +18 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dac547da5922e8c9f27d5c659acfa6b0e5fbb478b302209cdce31042797827f0
|
4
|
+
data.tar.gz: 9c012120b1bc9008171d94dabbca387a8684979267831cfa6f4782070753aa46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 043b5831a42e8a996398488a0336dc14d47596148b00cc14b178f8c5762961afde71708bcea6bd9cc0ac576f3161f791fe6d080ffdba3642bc2f1a545b476f63
|
7
|
+
data.tar.gz: c4e39944b73c7c1533cc6aeee00275f535b27d22b6f7cd4ddc4b7f0b38ede95f919b473be8c1c5f16becd9adc8e0cad873c274f374c1f415b72af1c1d53fe21a
|
data/lib/dorian/yaml/compare.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require "yaml"
|
2
2
|
|
3
3
|
module Dorian
|
4
4
|
module Yaml
|
5
5
|
class Compare
|
6
6
|
def self.run
|
7
7
|
if ARGV.size < 2 || ARGV.size > 4
|
8
|
-
puts
|
8
|
+
puts "USAGE: yaml-compare FILE1 FILE2 [ROOT1] [ROOT2]"
|
9
9
|
exit
|
10
10
|
end
|
11
11
|
|
@@ -16,10 +16,15 @@ module Dorian
|
|
16
16
|
file1 = file1[root1] if !root1.nil?
|
17
17
|
file2 = file2[root2] if !root2.nil?
|
18
18
|
|
19
|
-
compare(file1, file2)
|
19
|
+
output = with_captured_stdout { compare(file1, file2) }
|
20
|
+
|
21
|
+
if output != ""
|
22
|
+
$stderr.puts output
|
23
|
+
exit 1
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
|
-
def self.compare(hash1, hash2, current:
|
27
|
+
def self.compare(hash1, hash2, current: "")
|
23
28
|
if hash1.kind_of?(Array)
|
24
29
|
hash1.each.with_index do |_, i|
|
25
30
|
compare(hash1[i], hash2[i], current: current)
|
@@ -43,6 +48,15 @@ module Dorian
|
|
43
48
|
end
|
44
49
|
end
|
45
50
|
end
|
51
|
+
|
52
|
+
def self.with_captured_stdout(&block)
|
53
|
+
original_stdout = $stdout
|
54
|
+
$stdout = StringIO.new
|
55
|
+
block.call
|
56
|
+
$stdout.string
|
57
|
+
ensure
|
58
|
+
$stdout = original_stdout
|
59
|
+
end
|
46
60
|
end
|
47
61
|
end
|
48
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-yaml-compare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Compares keys of two YAML files, typically locales files in a Ruby on Rails application
|
@@ -25,7 +25,8 @@ files:
|
|
25
25
|
homepage: https://github.com/dorianmariefr/yaml-compare
|
26
26
|
licenses:
|
27
27
|
- MIT
|
28
|
-
metadata:
|
28
|
+
metadata:
|
29
|
+
rubygems_mfa_required: 'true'
|
29
30
|
post_install_message:
|
30
31
|
rdoc_options: []
|
31
32
|
require_paths:
|