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 +4 -4
- data/lib/regolith/cli.rb +27 -28
- data/lib/regolith/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: d447572c7f8e6230414cfb4b13ffeb32de77ec6f79612bfaccb620e9140466bc
|
4
|
+
data.tar.gz: 16c7e26aad9c1f8261d9a27a5acdaf86fb5a80321fcac227ee79ac7aeeade7af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
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
|
-
|
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
|
-
|
213
|
-
|
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
|
-
|
225
|
-
|
226
|
-
|
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 <
|
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
|
data/lib/regolith/version.rb
CHANGED