wisco 0.2.4 → 0.2.6

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: 3a60475b816732d204bb52da3c9b4a17c90ebd3471eb05254cc153c68ac5ad5b
4
- data.tar.gz: 482f28c284946b0b915aa25a2abaefecd983a7b1e26b824f0576ab609e42d276
3
+ metadata.gz: 922149837870023d570403cf2ef875643e7201eee6eb425eab6cb98b360448d5
4
+ data.tar.gz: a55d53569027d2628c5dffc31cc078582b1ec1feca64bee7c0087f459e4d8172
5
5
  SHA512:
6
- metadata.gz: 5b3340475edcafba79c184332e869d33fa230c61ba9f769f89a2ec1da1081449b3e14f29b3bf6afc02a701bb9d4195a00909fb11642a4bbc5c8ce033c7d064c6
7
- data.tar.gz: 5e526ccb7fdba3d62c2c35af71c2b81f904820eba2fa626bba2d1679167c2c4d0f642b34ee062ccdd232a6467106341d87694d9219ac2e7b5c0362c50db0eb60
6
+ metadata.gz: f46fcfb9b5869a7f7bfd1e797752731bb7850bcd81f62209a878703504b578f9f4333bda6ed67db235c29c638e8af095d23f8588c1cd402c490b406a0ef19047
7
+ data.tar.gz: b7a6f96e3899a947d6423bdf6877dc539bbf16c7de569ec39e4c5761092c995fcaebc88f9f4e110aaee200df91eacf681e24fc4470cb56302eb3e0f7a4691f9c
@@ -120,6 +120,14 @@ module Wisco
120
120
  end
121
121
 
122
122
  template = schema_to_template(fields)
123
+
124
+ # Merge config_fields.json if present — its keys are prepended to the template
125
+ cf_file = File.join(fixtures_dir, 'config_fields.json')
126
+ if File.exist?(cf_file)
127
+ cf_template = read_json_without_sentinel(cf_file)
128
+ template = cf_template.merge(template)
129
+ end
130
+
123
131
  content = "#{SENTINEL}\n#{JSON.pretty_generate(template)}\n"
124
132
  File.write(output_file, content)
125
133
  puts " Written: #{output_file}"
@@ -221,6 +229,14 @@ module Wisco
221
229
  puts " Written: #{output_file}"
222
230
  end
223
231
 
232
+ def read_json_without_sentinel(path)
233
+ lines = File.readlines(path)
234
+ lines.shift if lines.first&.chomp == SENTINEL
235
+ JSON.parse(lines.join)
236
+ rescue StandardError
237
+ {}
238
+ end
239
+
224
240
  def config_fields_ready?(path)
225
241
  return false unless File.exist?(path)
226
242
 
data/lib/wisco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wisco
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wisco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - mbillington