dorian-sort-yaml 0.4.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sort-yaml +9 -16
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ff09d214a4ef91af00cbe29f0060e184929d0445807689747cda209d0dc2b0c
|
4
|
+
data.tar.gz: 9c7e55f68a02bddf194eb7d23b4a095f2c0e636965063f0f5b22f32cc683ccbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afc71443f61d6b15e4ef260c03676c6c91a0dbee8aef9e152ef1d84ba25f0f63c11ef78c80be4d4f2da2444154d6d596c8142413ed0a079359091c0afd8ed898
|
7
|
+
data.tar.gz: 50ebae0ce7d628d5b0fa86aa9bf7d885eabef86b7a8c9bec054f0af9110c399579a24d007231af6c117ead47afa72a5eba4ff6669fa4a31ea3c1995f263f9c49
|
data/bin/sort-yaml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require "dorian/arguments"
|
4
5
|
require "yaml"
|
5
6
|
|
6
7
|
def sort_yaml(data)
|
@@ -16,23 +17,15 @@ def sort_yaml(data)
|
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
-
puts "USAGE: sort-yaml FILES..."
|
21
|
-
puts "USAGE: ... | sort-yaml"
|
22
|
-
exit
|
23
|
-
end
|
24
|
-
|
25
|
-
inputs = ARGV
|
20
|
+
parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
|
26
21
|
|
27
|
-
if
|
28
|
-
inputs = $stdin.each_line.to_a
|
22
|
+
abort parsed.help if parsed.options.help
|
29
23
|
|
30
|
-
|
31
|
-
|
24
|
+
if parsed.options.version
|
25
|
+
abort File.read(File.expand_path("../../VERSION", __FILE__))
|
32
26
|
end
|
33
27
|
|
34
|
-
inputs.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
28
|
+
inputs = parsed.arguments + parsed.files.map { |file| File.read(file) }
|
29
|
+
inputs = [$stdin.each_line.to_a.map(&:strip).join("\n")] if inputs.empty?
|
30
|
+
|
31
|
+
inputs.each { |input| puts sort_yaml(YAML.safe_load(input)).to_yaml }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-sort-yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.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: 2024-08-
|
11
|
+
date: 2024-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yaml
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dorian-arguments
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: sorts yaml
|
28
42
|
email: dorian@dorianmarie.com
|
29
43
|
executables:
|