belt 0.3.20 → 0.3.21
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/belt/cli/dns_command.rb +10 -6
- data/lib/belt/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: e913248aec69e4989d916f23eca445762abbdd0f3e1aa46b71bda1de8accbb68
|
|
4
|
+
data.tar.gz: 9865a153a7f77ffbdedccf3e0250d205fab538f57a853723d043f51d9eacd162
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8bab207b1d5c59d7ededcfe54a106b971cfe9d2ce8538b339bc68206aeeb241893369c62664d92f675c6717476e747740c4b69103e5f84ec32332efa717f139b
|
|
7
|
+
data.tar.gz: f6ec883e69585c5e5f2ac8bbea321b1e33f751a43f5d615c638066a9c330f98ba9a03ef29c624714eae619f3ac3e7472b33d6add7850e43a2c1dea6084035fd9
|
data/lib/belt/cli/dns_command.rb
CHANGED
|
@@ -252,19 +252,23 @@ module Belt
|
|
|
252
252
|
ns_list = ns_records.map { |ns| " \"#{ns}\"" }.join(",\n")
|
|
253
253
|
new_entry = " #{env_name} = [\n#{ns_list}\n ]"
|
|
254
254
|
|
|
255
|
-
#
|
|
256
|
-
|
|
255
|
+
# Match the actual HCL block, not commented examples.
|
|
256
|
+
# Look for environment_zones = { at the start of a line (not preceded by #)
|
|
257
|
+
hcl_block_pattern = /^environment_zones\s*=\s*\{([^}]*)\}/m
|
|
258
|
+
|
|
259
|
+
if content =~ hcl_block_pattern
|
|
257
260
|
existing = ::Regexp.last_match(1).strip
|
|
258
261
|
|
|
259
262
|
if existing.empty?
|
|
260
263
|
# Empty block - replace with our entry
|
|
261
|
-
content.sub!(
|
|
264
|
+
content.sub!(/^environment_zones\s*=\s*\{\s*\}/m, "environment_zones = {\n#{new_entry}\n}")
|
|
262
265
|
elsif existing.include?("#{env_name} =")
|
|
263
266
|
# Environment already exists - update it
|
|
264
|
-
|
|
267
|
+
# Match env name at start of line (with optional leading whitespace) to avoid comment matches
|
|
268
|
+
content.sub!(/^(\s*)#{env_name}\s*=\s*\[[^\]]*\]/m, "\\1#{env_name} = [\n#{ns_list}\n ]")
|
|
265
269
|
else
|
|
266
|
-
# Add to existing entries
|
|
267
|
-
content.sub!(
|
|
270
|
+
# Add to existing entries (insert after opening brace)
|
|
271
|
+
content.sub!(/^environment_zones\s*=\s*\{/m, "environment_zones = {\n#{new_entry}")
|
|
268
272
|
end
|
|
269
273
|
end
|
|
270
274
|
|
data/lib/belt/version.rb
CHANGED