regolith 0.1.23 → 0.1.25

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: 41ea8405c6a144230c7f4be3a1e2605cc2f80f05524850bad3e680e37d4187b4
4
- data.tar.gz: c4ba815538da010c8f3b23b3b27b2c84b107d1d3ad64c267a7d0efe5c6ce4487
3
+ metadata.gz: d447572c7f8e6230414cfb4b13ffeb32de77ec6f79612bfaccb620e9140466bc
4
+ data.tar.gz: 16c7e26aad9c1f8261d9a27a5acdaf86fb5a80321fcac227ee79ac7aeeade7af
5
5
  SHA512:
6
- metadata.gz: d2b4ca0d0e63b168706b29a54cb5344b7fe1a83cbc184773f848eafd73155aba7ed0748177ae22fab09c9e0c9df6c55ab0bf685e27104d9713831290fa1fe7d8
7
- data.tar.gz: 757cf66d57106245541095029d9aea8f24b43aaae2a231afabc715dc3546308509c6f5077c631fe7722ed066150f9f586dc21a1bbba17a5a1bb7b0fd622bd1d6
6
+ metadata.gz: efb74771a03f353f38818391cdb8acf34d6ecc7081443a270e714b286a846917528da0adea6dd675924166790a2a81215b710ce2d817e0769a985ff1edb0f8cf
7
+ data.tar.gz: 22ec3dafdab950d8d25b2d7ab92c8db6e7c41361603756524f955c01782d8fdd26fe8ce1aad4f2ecfb68d49d55aa9b4e067b0bca2b15401a0c9339478e1fef54
data/lib/regolith/cli.rb CHANGED
@@ -176,26 +176,23 @@ module Regolith
176
176
  puts "→ Next: regolith generate service <another_service> or regolith server"
177
177
  end
178
178
 
179
- # --- Helper to make Bootsnap optional ---
179
+ # --- FIXED: Helper to make Bootsnap optional ---
180
180
  def make_bootsnap_optional(service_dir)
181
181
  boot_rb_path = File.join(service_dir, "config", "boot.rb")
182
182
  return unless File.exist?(boot_rb_path)
183
183
 
184
184
  boot = File.read(boot_rb_path)
185
- patched = boot.sub(
186
- /^\s*require\s+["']bootsnap\/setup["']\s*$/,
187
- <<~'RUBY'.strip
188
- begin
189
- require "bootsnap/setup"
190
- rescue LoadError
191
- warn "[regolith] bootsnap not found; continuing without it"
192
- end
193
- RUBY
194
- )
185
+
186
+ # Replace the entire bootsnap line (with or without comment)
187
+ patched = boot.gsub(/require\s+["']bootsnap\/setup["'].*$/, <<~'RUBY'.strip)
188
+ begin
189
+ require "bootsnap/setup"
190
+ rescue LoadError
191
+ warn "[regolith] bootsnap not found; continuing without it"
192
+ end
193
+ RUBY
195
194
 
196
- if patched != boot
197
- File.write(boot_rb_path, patched)
198
- end
195
+ File.write(boot_rb_path, patched)
199
196
  end
200
197
 
201
198
  def patch_rails_app(service_dir, service_name, port)
@@ -208,22 +205,24 @@ module Regolith
208
205
  app_rb_content = File.read(app_rb_path)
209
206
 
210
207
  cors_config = <<~RUBY
208
+ # Regolith configuration
209
+ config.middleware.insert_before 0, Rack::Cors do
210
+ allow do
211
+ origins '*'
212
+ resource '*', headers: :any, methods: [:get, :post, :put, :patch, :delete, :options, :head]
213
+ end
214
+ end
211
215
 
212
- # Regolith configuration
213
- config.middleware.insert_before 0, Rack::Cors do
214
- allow do
215
- origins '*'
216
- resource '*', headers: :any, methods: [:get, :post, :put, :patch, :delete, :options, :head]
217
- end
218
- end
219
-
220
- config.regolith_service_name = '#{service_name}'
221
- config.regolith_service_port = #{port}
216
+ config.regolith_service_name = '#{service_name}'
217
+ config.regolith_service_port = #{port}
222
218
  RUBY
223
219
 
224
- app_rb_content.gsub!(/class Application < Rails::Application.*?
225
- end/m) do |match|
226
- match.gsub(/(\n end)$/, "#{cors_config}\1")
220
+ # Find the end of the Application class and insert before it
221
+ if app_rb_content =~ /^(\s*)end\s*$/
222
+ app_rb_content.gsub!(/^(\s*)end\s*$/) do |match|
223
+ indent = $1
224
+ "#{cors_config}\n#{indent}end"
225
+ end
227
226
  end
228
227
 
229
228
  File.write(app_rb_path, app_rb_content)
@@ -394,7 +393,7 @@ module Regolith
394
393
 
395
394
  COMMANDS:
396
395
  new <app_name> Create a new Regolith application
397
- generate service <name> Generate a new microservice
396
+ generate service <n> Generate a new microservice
398
397
  server Start all services with Docker Compose
399
398
  console <service_name> Open Rails console for a service
400
399
  version Show version information
@@ -1,4 +1,4 @@
1
1
  # lib/regolith/version.rb
2
2
  module Regolith
3
- VERSION = "0.1.23"
3
+ VERSION = "0.1.25"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regolith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Regolith Team