dorian-yaml-compare 0.3.0 → 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: f3c12cd00682a89b6b1128dbfe2bd9a2a6ae4c365e90f76260579a6d13e31d27
4
- data.tar.gz: aa5b88f75f1721d657e02835d6cde959326a804d14d49c0b39dc25b1093292e6
3
+ metadata.gz: d04aae43888d5b7e10630c507246ed9e5808ed6445f38272ecb8ecc2e163e237
4
+ data.tar.gz: 626a3f19c97012e67af790fc6c48c33e1d1c2b8b3438ddd4f9d4e9e738010471
5
5
  SHA512:
6
- metadata.gz: 30fd42942d0c6132fe10428b56195803afc0db6ab06baaccc07eeed6c0c30a61b8983e84a8be735c2a267a2b086f73dedada0e8726c1e7dc67fa50dafcbbc2f7
7
- data.tar.gz: f55a4e85349b6080d380bd6c9b71e6a1710d48c32a7c04ffcdddd016fdf64cea68599bfd6c97ac1e670ee33ab422f041b5168a14cb7c9a213d401dcba54adc13
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.3.0
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-19 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