sneakers-queue-migrator 0.1.6 → 0.1.7

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: 5828ad577fd278f6a7aea2c664dc830f16d223718123ff1c777277a1ae3aa1fa
4
- data.tar.gz: 33679288215dca825e5f16af92ddf95877e9f0655a2a8e1a73b702ec5f3a3d55
3
+ metadata.gz: 3f6310a0f4c1fd3d40da61e88ac1ff46b49be61a4aeede428ca17e51e4ac8478
4
+ data.tar.gz: de28bac5ed191aa132fb76571ce7cb1467830fbb633d86147e7ab3847c20fda2
5
5
  SHA512:
6
- metadata.gz: bfa2182dd468ce08ee611300fb92c1d7f1541bcf2db0e5214b1b1fd47e0a9d36ccec11998800dd9b8a6abdcacb3e247d49a664f173156669747ae8fdf735d203
7
- data.tar.gz: cccfd10de6106480a89fbe6ca70351e0ead63e0ca2ec593ad8e3aeecb51ff64a25b0b6896c331a433fb6efeeb0ae73325cd933a23c665281f184ef61439d8246
6
+ metadata.gz: e3e08dc7579b5340f53b5b15746d0b2eacde7bb6cba5a75e2700666fdfae67cdeeb14de16a724dfdb7d4683b8736149ad5b5b4139308797fa4613bf355a21e3d
7
+ data.tar.gz: a754909ef4389c038a081884a24ca9dde93d2804c8be7a0862bf297ffb8da7e0abf16bf111187afc77ab2c7295f3c7570d3077ea75f19440309b5b180ae7f071
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sneakers-queue-migrator (0.1.6)
4
+ sneakers-queue-migrator (0.1.7)
5
5
  bunny (~> 2.0)
6
6
  json (~> 2.0)
7
7
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sneakers
4
4
  module Migrator
5
- VERSION = "0.1.6"
5
+ VERSION = "0.1.7"
6
6
  end
7
7
  end
@@ -174,14 +174,16 @@ module Sneakers
174
174
  def parse_options_hash_for_file(str)
175
175
  return {} unless str
176
176
 
177
- # Remove comments and excessive whitespace
178
- code = str.gsub(/#.*$/, "").gsub(/\n/, " ").gsub(/\s+/, " ")
179
- # Convert Ruby %w[ ... ] and %w( ... ) to array syntax for YAML
180
- # Also handle %i[ ... ] for symbol arrays
181
- code = code.gsub(/%[wi][\[(](.*?)[\])]/) do
182
- words = ::Regexp.last_match(1).strip.split(/\s+/)
183
- "[" + words.map { |w| "\"#{w}\"" }.join(", ") + "]" # rubocop:disable Style/StringConcatenation
177
+ # First, convert all %w[...] and %i[...] (even multi-line) to YAML arrays
178
+ code = str.gsub(/%[wi][\[(]((?:.|\n)*?)[\])]/m) do
179
+ words = ::Regexp.last_match(1).gsub(/#.*$/, '').split(/\s+/).reject(&:empty?)
180
+ '[' + words.map { |w| '"' + w + '"' }.join(', ') + ']'
184
181
  end
182
+ # Remove comments and blank lines
183
+ code = code.lines.reject { |l| l.strip.start_with?("#") || l.strip.empty? }.join(" ")
184
+ # Remove handler: ... and backoff_function: ... (ignore these keys and their values)
185
+ code = code.gsub(/\bhandler:\s*[^,}]+,?/, "")
186
+ code = code.gsub(/\bbackoff_function:\s*->\s*\([^)]*\)\s*\{[^}]*\},?/, "")
185
187
  # Convert Ruby hashrockets and symbol keys to YAML style, and handle symbol values and numbers with underscores
186
188
  yaml_str = code
187
189
  .gsub(/:(\w+)\s*=>/, '"\\1":') # :foo =>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sneakers-queue-migrator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Gane