dorian-sort-json 0.4.0 → 0.4.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: 044bd64a6db1e47c642b1495bd3f03e0217555a37a9fc1a186a8e5001b252f4a
4
- data.tar.gz: ada1eadd785f91c4469f034c15b3143bb44677aa36dce794501ce1d2427f1678
3
+ metadata.gz: bf9b0042976b5aae24287008ac779c91e1f7cc07e552b0c88a84057277302923
4
+ data.tar.gz: 9b19afe31fdadbf4577002fb7520e22be5216950633df8ca7c97ec4672bbb220
5
5
  SHA512:
6
- metadata.gz: 9efa6990cc8b57177e8d40a965461131e101095612a3dfe41ff77363d04e432e4c587f96372850534841d0ee4349518fdac6118072692eab9a07df94007abe50
7
- data.tar.gz: 6ea7b8307b8997cd0251b82111979b2b8b47909d884e4ac2d68763e992a9e9564a239d61c3392fe1f79985491df1b550158a109ce70d73ab84f2449f5fbd447b
6
+ metadata.gz: 49443a56012530f9a6ecaaca2ca7b6774b6282581ab4a76f860ba70f1e614488f213205022d394fbe985fca29e403a63dd1712402d3909c5adfb8e8f5fb48a65
7
+ data.tar.gz: 147f9d9f546088085336faf909e3ad713c7040727d6e34e67b054e9deb7b20dbae30baa6f1c1ed436262ad08a05a14036d528e3c99b941c1e639603be2966fa1
data/bin/sort-json CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require 'dorian/sort-json'
4
+ require "dorian/sort-json"
4
5
  Dorian::SortJson.run
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "json"
2
4
 
3
5
  module Dorian
@@ -11,19 +13,20 @@ module Dorian
11
13
 
12
14
  inputs = ARGV
13
15
 
14
- if inputs.size.zero?
15
- inputs = STDIN.each_line.to_a
16
+ if inputs.empty?
17
+ inputs = $stdin.each_line.to_a
16
18
 
17
- if File.exist?(inputs.first.strip)
18
- inputs = inputs.map(&:strip)
19
- else
20
- inputs = [inputs.join]
21
- end
19
+ inputs =
20
+ if File.exist?(inputs.first.strip)
21
+ inputs.map(&:strip)
22
+ else
23
+ [inputs.join]
24
+ end
22
25
  end
23
26
 
24
27
  inputs.each do |input|
25
28
  content = File.exist?(input) ? File.read(input) : input
26
- json = JSON.pretty_generate(sort_json(JSON.parse(content))) + "\n"
29
+ json = "#{JSON.pretty_generate(sort_json(JSON.parse(content)))}\n"
27
30
  File.exist?(input) ? File.write(input, json) : puts(json)
28
31
  end
29
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-sort-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.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
  Sorts keys of hashes of JSON files
@@ -22,7 +22,7 @@ extra_rdoc_files: []
22
22
  files:
23
23
  - bin/sort-json
24
24
  - lib/dorian/sort-json.rb
25
- homepage: https://github.com/dorianmariefr/sort-json
25
+ homepage: https://github.com/dorianmariecom/sort-json
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: Sorts keys of hashes of JSON files