process_settings 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/combine_process_settings +2 -2
- data/bin/diff_process_settings +26 -6
- data/lib/process_settings/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7639f6a88f14fbfc52dabbac2b771712cb7fda441683eabc23bdabdd2c9d5492
|
4
|
+
data.tar.gz: 5f8f41ad06f23db45c31a6c91246252a2a18b9055f1317dcf7e32f84cb6be6eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df98267ef1e0c5da02c62a37ac953e12dd4f187aa822306fccce6c2654b6963641dc682d3fbd457455461d8237be7a4eb319f16f0393d399802773ce5ce16fc2
|
7
|
+
data.tar.gz: 67419019b84fca98837ef37f09d85554052f4ef1b9a2f59185017fb9f141834d28d86228dd7b1f461a00f079234541c02c12f955e760bc7686f55a4ce90b553e
|
@@ -68,7 +68,7 @@ end
|
|
68
68
|
def add_warning_comment(yaml, root_folder, program_name, settings_folder)
|
69
69
|
warning_comment = <<~EOS
|
70
70
|
#
|
71
|
-
# Don't edit this file directly! It was generated by #{program_name} from the files in #{root_folder.
|
71
|
+
# Don't edit this file directly! It was generated by #{program_name} from the files in #{root_folder.rpartition('/').last}/#{settings_folder}/.
|
72
72
|
#
|
73
73
|
EOS
|
74
74
|
|
@@ -96,7 +96,7 @@ system("rm -f #{tmp_output_filename}")
|
|
96
96
|
File.write(tmp_output_filename, yaml_with_warning_comment)
|
97
97
|
|
98
98
|
system(<<~EOS)
|
99
|
-
if
|
99
|
+
if bundle exec diff_process_settings --silent #{tmp_output_filename} #{output_filename} ; then
|
100
100
|
#{"echo #{options.root_folder}: unchanged;" if options.verbose}
|
101
101
|
rm -f #{tmp_output_filename};
|
102
102
|
else
|
data/bin/diff_process_settings
CHANGED
@@ -5,18 +5,31 @@
|
|
5
5
|
# A filename of - means STDIN.
|
6
6
|
|
7
7
|
require 'fileutils'
|
8
|
+
require 'optparse'
|
9
|
+
require 'ostruct'
|
8
10
|
|
9
11
|
PROGRAM_NAME = File.basename($PROGRAM_NAME)
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
def parse_options(argv)
|
14
|
+
options = OpenStruct.new
|
15
|
+
options.silent = false
|
16
|
+
option_parser = OptionParser.new(argv) do |opt|
|
17
|
+
opt.on('-s', '--silent', 'Silent mode.') { options.silent = true }
|
18
|
+
end
|
19
|
+
|
20
|
+
if option_parser.parse! && argv.size == 2
|
21
|
+
[options, argv]
|
22
|
+
else
|
23
|
+
warn "usage: #{PROGRAM_NAME} [--silent] <path-to-combined_process_settings-A.yml> <path-to-combined_process_settings-B.yml>"
|
24
|
+
option_parser.summarize(STDERR)
|
25
|
+
exit(1)
|
26
|
+
end
|
14
27
|
end
|
15
28
|
|
16
|
-
|
29
|
+
options, file_args = parse_options(ARGV)
|
17
30
|
|
18
31
|
input_files =
|
19
|
-
|
32
|
+
file_args.map do |path|
|
20
33
|
if path == '-'
|
21
34
|
''
|
22
35
|
else
|
@@ -34,6 +47,13 @@ system("rm -f tmp/combined_process_settings-A.yml tmp/combined_process_settings-
|
|
34
47
|
system("sed '/^- meta:$/,$d' #{input_files[0]} > tmp/combined_process_settings-A.yml")
|
35
48
|
system("sed '/^- meta:$/,$d' #{input_files[1]} > tmp/combined_process_settings-B.yml")
|
36
49
|
|
37
|
-
|
50
|
+
if options.silent
|
51
|
+
system("cmp --silent tmp/combined_process_settings-A.yml tmp/combined_process_settings-B.yml")
|
52
|
+
else
|
53
|
+
system("diff -c tmp/combined_process_settings-A.yml tmp/combined_process_settings-B.yml | sed '1,3d'")
|
54
|
+
end
|
55
|
+
exit_code = $?.exitstatus
|
38
56
|
|
39
57
|
system("rm -f tmp/combined_process_settings-A.yml tmp/combined_process_settings-B.yml")
|
58
|
+
|
59
|
+
exit(exit_code)
|