dorian-sort-yaml 0.4.3 → 1.1.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 +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecd620fda18c13f5259de5b888fd7e8bd915075a9fa6ffd9db735ce194ebabf7
|
4
|
+
data.tar.gz: 7bfaa23e7988fe684afd5377b6b43086e0513623e270dd86526454a3ae7a0433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aefd685a76575de475d3ef2184a3dd556aada6630f7370e1aeb849d2fae449b4e3e5aa77c9f776622c4d3be5ff3018312eb0997545713a7bbb11c9f9227f59a3
|
7
|
+
data.tar.gz: 0baaa88381aef2c2b9f8a7d218a0dde24190dd8ea3e5a52a2b395262da27d34af74470eccc9bade54699459c9972f5658437fbd711d4c3688e0c459024622874
|
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", __dir__))
|
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,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-sort-yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: dorian-arguments
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: yaml
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -57,9 +57,9 @@ require_paths:
|
|
57
57
|
- lib
|
58
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - '='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: 3.3.4
|
63
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - ">="
|