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 +4 -4
- data/lib/wisco/commands/fixtures.rb +16 -0
- data/lib/wisco/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: 922149837870023d570403cf2ef875643e7201eee6eb425eab6cb98b360448d5
|
|
4
|
+
data.tar.gz: a55d53569027d2628c5dffc31cc078582b1ec1feca64bee7c0087f459e4d8172
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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