belt 0.3.20 → 0.3.22

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: 82023cea9ac6649d621b0830d5eb6f0be9185b479f4887abec7146780155953a
4
- data.tar.gz: 3fbbe4cc88b68874f751d89f51c7f1e381171fa486c3cbdfa4a18331911584f2
3
+ metadata.gz: 1a3951e549645f3fca57660c1e883dee7ae4077e20b77b9b404b1dfa6e9539ab
4
+ data.tar.gz: cf18d81cdd06c595ac152d7a85b76f8818dedfb6791b902aef09a7bfe8c1cbbb
5
5
  SHA512:
6
- metadata.gz: 23ffe36bb364bff9e846eafc096bd0fd41a581442cbceade34bae462851ea461a2ac39ba99e73a3e875eb3d9b900a76527deac0413a1907f57f2647e4e8e13ad
7
- data.tar.gz: fbb2663798c280a8aa0d369a2d7f25fdbc849c17ea293f541fca69bcd90e8c7ca441c5dfd4b1c0636c046a1ebc95ea8207abacf801a3a7b014efc3c6b676917c
6
+ metadata.gz: 8d42fe40574244f042988650b83f6ec28e7bd37013674b4f5ca8fd95d33c90bdb6ed6fc8ad6828caa5c5531bb35f3c0064764222bef0ebbf6ddcd009597bef24
7
+ data.tar.gz: 1a8a6b73f9f72f80dbbba96c09d9345a85c2246367c76caa97693be5710388929f3b4468d92822d8d9e6b185798a9a1faf4f48f4f38165cbabd2433e318701b3
@@ -192,19 +192,19 @@ module Belt
192
192
  end
193
193
 
194
194
  def load_dns_config
195
- belt_rb = File.join(DNS_DIR, 'belt.rb')
196
- return {} unless File.exist?(belt_rb)
197
-
198
- EnvironmentConfig.load(belt_rb)
195
+ # Load config from infrastructure/dns/belt.rb
196
+ # EnvironmentConfig.load expects (env_name, infra_dir:) where the path
197
+ # is infra_dir/env_name/belt.rb. We pass 'dns' as env_name.
198
+ EnvironmentConfig.load('dns')
199
199
  end
200
200
 
201
201
  def run_terraform(action, env_config, *extra_args)
202
202
  cmd = ['terraform', action] + extra_args
203
203
  env = {}
204
204
 
205
- if env_config[:aws_profile]
206
- env['AWS_PROFILE'] = env_config[:aws_profile]
207
- puts "Using AWS profile: #{env_config[:aws_profile]}" if action == 'init'
205
+ if env_config.aws_profile?
206
+ env['AWS_PROFILE'] = env_config.aws_profile
207
+ puts "Using AWS profile: #{env_config.aws_profile}" if action == 'init'
208
208
  end
209
209
 
210
210
  system(env, *cmd) || begin
@@ -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
- # Check if environment_zones already has entries
256
- if content =~ /environment_zones\s*=\s*\{([^}]*)\}/m
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!(/environment_zones\s*=\s*\{\s*\}/, "environment_zones = {\n#{new_entry}\n}")
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
- content.sub!(/#{env_name}\s*=\s*\[[^\]]*\]/m, "#{env_name} = [\n#{ns_list}\n ]")
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!(/environment_zones\s*=\s*\{/m, "environment_zones = {\n#{new_entry}")
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Belt
4
- VERSION = '0.3.20'
4
+ VERSION = '0.3.22'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: belt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.20
4
+ version: 0.3.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stowzilla