process_settings 0.15.0 → 0.15.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17af8e8b00a219e790b36fc20282e0c4c7d7c04cfd7f911ea636f056b675cf70
4
- data.tar.gz: 198665150f57b95634698ab3474dd587dbefbc48ecf41d10084a6f872a0a3949
3
+ metadata.gz: 37586770d262584d6b5f6b2b4a8a7824eb351d9da15d6577dc0591223c0074f0
4
+ data.tar.gz: 8c61aa64d76749381c1311f7c08f2778a0c99134778c09d45aebd32d1ca10ff5
5
5
  SHA512:
6
- metadata.gz: ea2bf7c35886a10807a3b8ab171133776c1381371b628ac08cbe413a2cbc8d4bc8c600142fc44c0734fb1e2dc6bb2143be40c68c5b99217404fa6a085ccf2326
7
- data.tar.gz: b92dbd32b2935e7d3ba4b8b95f33dc032e018a273505f7daaba4126d1ef7f132fe40e79535780c45a3283df9daa3c006ce1312c2cf2c2eb472b7b123f09fa10f
6
+ metadata.gz: 212169ce11e8ce4c15f056ffc14c15de1e46fadbc93878c922a577b44217bc8c84d3ecfa49773580bbbf06bdae4cb9a58caf55e570c334282e14ed26c9045ff6
7
+ data.tar.gz: 7afc6259634fba9c6a8e0ebe63ab4ffa361c79fdfb5dde63d4f39168222cb790cfa706989e43eaee5ea7b0f9625d393f4411b673bff68e11e0e609c694372adc
data/README.md CHANGED
@@ -181,7 +181,7 @@ require 'process_settings/testing/helpers'
181
181
  RSpec.configure do |config|
182
182
  # ...
183
183
 
184
- include ProcessSettings::Testing::RSpec::Helpers
184
+ config.include ProcessSettings::Testing::RSpec::Helpers
185
185
 
186
186
  # Note: the include above will automatically register a global after block that will reset process_settings to their initial values.
187
187
  # ...
@@ -92,6 +92,26 @@ def warn_if_old_libyaml_version
92
92
  end
93
93
  end
94
94
 
95
+ def settings_files_match?(filename_1, filename_2)
96
+ filename_1 && filename_2 &&
97
+ File.exist?(filename_1) && File.exist?(filename_2) &&
98
+ diff_process_settings(filename_1, filename_2)
99
+ end
100
+
101
+ def diff_process_settings(filename_1, filename_2)
102
+ system(<<~EOS)
103
+ bundle exec diff_process_settings --silent "#{filename_1}" "#{filename_2}"
104
+ EOS
105
+ status_code = $?.exitstatus
106
+ case status_code
107
+ when 0
108
+ true
109
+ when 1
110
+ false
111
+ else
112
+ raise "diff_process_settings failed with code #{status_code}"
113
+ end
114
+ end
95
115
 
96
116
  #
97
117
  # main
@@ -115,14 +135,17 @@ tmp_output_filename = "#{output_filename}.tmp"
115
135
  system("rm -f #{tmp_output_filename}")
116
136
  File.write(tmp_output_filename, yaml_with_warning_comment)
117
137
 
118
- system(<<~EOS)
119
- if bundle exec diff_process_settings --silent #{tmp_output_filename} #{output_filename} ; then
120
- #{"echo #{options.root_folder}: unchanged;" if options.verbose}
121
- rm -f #{tmp_output_filename};
138
+ if settings_files_match?(options.initial_filename, tmp_output_filename)
139
+ if settings_files_match?(output_filename, tmp_output_filename)
140
+ puts "#{options.root_folder}: unchanged" if options.verbose
141
+ FileUtils.rm_f(tmp_output_filename)
122
142
  else
123
- #{"echo #{options.root_folder}: UPDATING;" if options.verbose}
124
- mv #{tmp_output_filename} #{output_filename};
125
- fi
126
- EOS
143
+ puts "#{options.root_folder}: UPDATING (changed now)" if options.verbose
144
+ FileUtils.mv(tmp_output_filename, output_filename)
145
+ end
146
+ else
147
+ puts "#{options.root_folder}: UPDATING (unchanged now, but changed from initial)" if options.verbose
148
+ FileUtils.mv(tmp_output_filename, output_filename)
149
+ end
127
150
 
128
151
  exit(0)
@@ -34,10 +34,7 @@ input_files =
34
34
  if path == '-'
35
35
  ''
36
36
  else
37
- unless File.exists?(path)
38
- warn "#{path} not found--must be a path to combined_process_settings.yml"
39
- exit 1
40
- end
37
+ File.exist?(path) or path = '/dev/null'
41
38
  "< #{path}"
42
39
  end
43
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProcessSettings
4
- VERSION = '0.15.0'
4
+ VERSION = '0.15.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca