dorian-yaml-compare 0.3.0 → 0.3.2

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: bfb6914c636ac9da87f840c4791845f6ac23d483e136f472d08b67e61a284dd7
4
+ data.tar.gz: 13f3ada06ad6990193eeddade67eb8573b508de4f07439ff9e0419546c9b7e56
5
5
  SHA512:
6
- metadata.gz: 30fd42942d0c6132fe10428b56195803afc0db6ab06baaccc07eeed6c0c30a61b8983e84a8be735c2a267a2b086f73dedada0e8726c1e7dc67fa50dafcbbc2f7
7
- data.tar.gz: f55a4e85349b6080d380bd6c9b71e6a1710d48c32a7c04ffcdddd016fdf64cea68599bfd6c97ac1e670ee33ab422f041b5168a14cb7c9a213d401dcba54adc13
6
+ metadata.gz: 4df6fa9e9cfae5482c12e02ce84438984c76da48af6ce6a66f6653528c3237d752943e8d09fdb0712723bffd0371851e7725f8edb2d6c2780f313aa49d2f6478
7
+ data.tar.gz: 1d8eb292169bfc5f9627c1ee7f0c3a7552dca3aa0ab6e381cde7a939d2d619e033f8a5f212cc0675ee4637221e8d746b6f1780be1c0a57d97561e2c2b0dea738
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,20 +1,20 @@
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.2
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-03-09 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
15
15
 
16
16
  e.g. `yaml-compare config/locales/en.yml config/locales/fr.yml en fr`
17
- email: dorian@dorianmarie.fr
17
+ email: dorian@dorianmarie.com
18
18
  executables:
19
19
  - yaml-compare
20
20
  extensions: []
@@ -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