dorian-yaml-compare 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c3be55060a2c9e79957c8c75d0a5d84cf4e6b756c9954dfda2b86b24eb68bc2
4
- data.tar.gz: cf0e2586a37f2b0a717be236a6099b9d997ccb5e23edd7b2f406e482294a4429
3
+ metadata.gz: d04aae43888d5b7e10630c507246ed9e5808ed6445f38272ecb8ecc2e163e237
4
+ data.tar.gz: 626a3f19c97012e67af790fc6c48c33e1d1c2b8b3438ddd4f9d4e9e738010471
5
5
  SHA512:
6
- metadata.gz: ba95167bc658e486d59fbfc42d826514e634371e059501a5641adb4aaf050bf9ce6f2c49325403cf263f6c6c35ad6e26a4112e58b90d242d64c53f9f00b24000
7
- data.tar.gz: 4879af2e9fe9422b579cec8770466765d99a2cd73ffbb8a76d590fc83629cf28bd16fe378815b0cb26a1268d306adbe440fe086ffb84499096789a78a77cba79
6
+ metadata.gz: e40c1edf694258fffb0359adc010c101382e0b3b149e738a961baaa0cd73ab5e41299042f7b62d53ddf01755dbf6d997625e4ca3da0d71383efed01003bca05e
7
+ data.tar.gz: 79aa89ad7b386cd5d78eb0f8fc2b82296e659a426586e5dc88010809a67e7fec8687dc71588a99437fe7a3dc77547b086a58adc7e172ff047219e6b6c88fa2be
data/bin/yaml-compare CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require 'dorian/yaml/compare'
4
+ require "dorian/yaml/compare"
4
5
  Dorian::Yaml::Compare.run
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "yaml"
2
4
 
3
5
  module Dorian
@@ -9,12 +11,12 @@ module Dorian
9
11
  exit
10
12
  end
11
13
 
12
- file1 = YAML.safe_load(File.read(ARGV[0]))
13
- file2 = YAML.safe_load(File.read(ARGV[1]))
14
+ file1 = YAML.safe_load_file(ARGV[0])
15
+ file2 = YAML.safe_load_file(ARGV[1])
14
16
  root1 = ARGV[2]
15
17
  root2 = ARGV[3]
16
- file1 = file1[root1] if !root1.nil?
17
- file2 = file2[root2] if !root2.nil?
18
+ file1 = file1[root1] unless root1.nil?
19
+ file2 = file2[root2] unless root2.nil?
18
20
 
19
21
  output = with_captured_stdout { compare(file1, file2) }
20
22
 
@@ -22,14 +24,12 @@ module Dorian
22
24
  end
23
25
 
24
26
  def self.compare(hash1, hash2, current: "")
25
- if hash1.kind_of?(Array)
26
- hash1.each.with_index do |_, i|
27
- compare(hash1[i], hash2[i], current: current)
28
- end
29
- elsif hash1.kind_of?(String) || hash2.kind_of?(String)
30
- if !hash1.kind_of?(String)
27
+ if hash1.is_a?(Array)
28
+ hash1.each.with_index { |_, i| compare(hash1[i], hash2[i], current:) }
29
+ elsif hash1.is_a?(String) || hash2.is_a?(String)
30
+ if !hash1.is_a?(String)
31
31
  puts "key \"#{current}\" is a string in #{ARGV[1]}"
32
- elsif !hash2.kind_of?(String)
32
+ elsif !hash2.is_a?(String)
33
33
  puts "key \"#{current}\" is a string in #{ARGV[0]}"
34
34
  end
35
35
  else
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.2.1
4
+ version: 0.3.1
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-18 00:00:00.000000000 Z
11
+ date: 2024-02-08 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
@@ -22,7 +22,7 @@ extra_rdoc_files: []
22
22
  files:
23
23
  - bin/yaml-compare
24
24
  - lib/dorian/yaml/compare.rb
25
- homepage: https://github.com/dorianmariefr/yaml-compare
25
+ homepage: https://github.com/dorianmariecom/yaml-compare
26
26
  licenses:
27
27
  - MIT
28
28
  metadata:
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
44
  requirements: []
45
- rubygems_version: 3.2.22
45
+ rubygems_version: 3.5.3
46
46
  signing_key:
47
47
  specification_version: 4
48
48
  summary: Compares keys of two YAML files, typically locales files in a Ruby on Rails