yaml-sort 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/Rakefile +1 -1
- data/lib/yaml/sort/cli.rb +19 -3
- data/lib/yaml/sort/tasks/puppet.rb +2 -2
- data/lib/yaml/sort/tasks/rails.rb +2 -2
- data/lib/yaml/sort/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbee3a96fd3ecb9c7610a0621d80d796bb656a338512655175f213727af356c6
|
4
|
+
data.tar.gz: 1b1609202ae8cd7cc002c6a868d836ddfb89681d75efc4c5b996264d85d3392d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adbbda3bc7d506f276266b8d3f8bdf88c2032f2b80f64061fb965b25368e735996e7c164737ebebeed0c73fc5757669c7b099b362126f4a05dd37c33b7606d95
|
7
|
+
data.tar.gz: affae50f2aeff9ec3e96709f162a06a8cc1b7d2cbeb8ab1f1c8e98a10be3efe36642c9b69d57a1fd07a6c2b17ed09e74d5695f89b488fffca905b4bddfaebaf1
|
data/CHANGELOG.md
CHANGED
@@ -3,9 +3,18 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
4
4
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
5
5
|
|
6
|
-
## [
|
6
|
+
## [v2.1.0](https://github.com/smortex/yaml-sort/tree/v2.1.0) (2022-07-03)
|
7
7
|
|
8
|
-
[Full Changelog](https://github.com/smortex/yaml-sort/compare/v2.0.
|
8
|
+
[Full Changelog](https://github.com/smortex/yaml-sort/compare/v2.0.2...v2.1.0)
|
9
|
+
|
10
|
+
**Implemented enhancements:**
|
11
|
+
|
12
|
+
- Make the Rake tasks silent [\#11](https://github.com/smortex/yaml-sort/pull/11) ([smortex](https://github.com/smortex))
|
13
|
+
- Improve --lint by showing a diff on error [\#10](https://github.com/smortex/yaml-sort/pull/10) ([smortex](https://github.com/smortex))
|
14
|
+
|
15
|
+
## [v2.0.2](https://github.com/smortex/yaml-sort/tree/v2.0.2) (2022-06-10)
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/smortex/yaml-sort/compare/v2.0.1...v2.0.2)
|
9
18
|
|
10
19
|
**Fixed bugs:**
|
11
20
|
|
data/Rakefile
CHANGED
@@ -24,7 +24,7 @@ task cucumber: ["lib/yaml/sort/parser.rb"]
|
|
24
24
|
|
25
25
|
require "github_changelog_generator/task"
|
26
26
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
27
|
-
config.future_release = Yaml::Sort::VERSION
|
27
|
+
config.future_release = "v#{Yaml::Sort::VERSION}"
|
28
28
|
config.header = <<~HEADER.chomp
|
29
29
|
# Changelog
|
30
30
|
All notable changes to this project will be documented in this file.
|
data/lib/yaml/sort/cli.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "optparse"
|
4
4
|
|
5
5
|
require "cri"
|
6
|
+
require "tempfile"
|
6
7
|
|
7
8
|
module Yaml
|
8
9
|
module Sort
|
@@ -25,7 +26,7 @@ module Yaml
|
|
25
26
|
opts.on("-l", "--lint", "Ensure files content is sorted as expected") do
|
26
27
|
options[:lint] = true
|
27
28
|
end
|
28
|
-
end.parse!
|
29
|
+
end.parse!(argv)
|
29
30
|
|
30
31
|
if !options[:in_place] && !options[:lint] && argv.count > 1
|
31
32
|
warn "Sorting multiple YAML document to stdout does not make sense"
|
@@ -47,7 +48,7 @@ module Yaml
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
50
|
-
@exit_code
|
51
|
+
$kernel.exit(@exit_code) # rubocop:disable Style/GlobalVars
|
51
52
|
end
|
52
53
|
|
53
54
|
def process_document(filename, options)
|
@@ -78,13 +79,28 @@ module Yaml
|
|
78
79
|
File.write(filename, sorted_yaml)
|
79
80
|
elsif options[:lint]
|
80
81
|
if yaml != sorted_yaml
|
81
|
-
|
82
|
+
show_diff(filename, yaml, sorted_yaml)
|
82
83
|
@exit_code = 1
|
83
84
|
end
|
84
85
|
else
|
85
86
|
puts sorted_yaml
|
86
87
|
end
|
87
88
|
end
|
89
|
+
|
90
|
+
def show_diff(filename, actual, expected)
|
91
|
+
filename ||= "<stdin>"
|
92
|
+
|
93
|
+
a = Tempfile.new
|
94
|
+
a.write(actual)
|
95
|
+
a.close
|
96
|
+
|
97
|
+
b = Tempfile.new
|
98
|
+
b.write(expected)
|
99
|
+
b.close
|
100
|
+
|
101
|
+
warn "diff #{File.join("a", filename)} #{File.join("b", filename)}"
|
102
|
+
warn `diff -u --label "#{File.join("a", filename)}" #{a.path} --label "#{File.join("b", filename)}" #{b.path}`
|
103
|
+
end
|
88
104
|
end
|
89
105
|
end
|
90
106
|
end
|
@@ -3,11 +3,11 @@
|
|
3
3
|
namespace :lint do
|
4
4
|
desc "Check Hiera data content ordering"
|
5
5
|
task :hiera_data_ordering do
|
6
|
-
sh "yaml-sort", "--lint", *Dir.glob("data/**/*.yaml")
|
6
|
+
sh "yaml-sort", "--lint", *Dir.glob("data/**/*.yaml"), verbose: false
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
desc "Reorder Hiera data in-place"
|
11
11
|
task :reorder_hiera_data do
|
12
|
-
sh "yaml-sort", "--in-place", *Dir.glob("data/**/*.yaml")
|
12
|
+
sh "yaml-sort", "--in-place", *Dir.glob("data/**/*.yaml"), verbose: false
|
13
13
|
end
|
@@ -3,11 +3,11 @@
|
|
3
3
|
namespace :test do
|
4
4
|
desc "Check translations content ordering"
|
5
5
|
task :translations_ordering do
|
6
|
-
sh "yaml-sort", "--lint", *Dir.glob("config/locales/**/*.yml")
|
6
|
+
sh "yaml-sort", "--lint", *Dir.glob("config/locales/**/*.yml"), verbose: false
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
desc "Reorder translations in-place"
|
11
11
|
task :reorder_translations do
|
12
|
-
sh "yaml-sort", "--in-place", *Dir.glob("config/locales/**/*.yml")
|
12
|
+
sh "yaml-sort", "--in-place", *Dir.glob("config/locales/**/*.yml"), verbose: false
|
13
13
|
end
|
data/lib/yaml/sort/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml-sort
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain Tartière
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email:
|
71
71
|
- romain@blogreen.org
|
72
72
|
executables:
|
@@ -104,7 +104,7 @@ metadata:
|
|
104
104
|
source_code_uri: https://github.com/smortex/yaml-sort
|
105
105
|
changelog_uri: https://github.com/smortex/yaml-sort/blob/master/CHANGELOG.md
|
106
106
|
rubygems_mfa_required: 'true'
|
107
|
-
post_install_message:
|
107
|
+
post_install_message:
|
108
108
|
rdoc_options: []
|
109
109
|
require_paths:
|
110
110
|
- lib
|
@@ -119,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
123
|
-
signing_key:
|
122
|
+
rubygems_version: 3.3.16
|
123
|
+
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Sort lines in YAML files in a predictable order
|
126
126
|
test_files: []
|