regolith 0.1.22 → 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 +31 -31
- 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
@@ -116,6 +116,10 @@ module Regolith
|
|
116
116
|
exit 1
|
117
117
|
end
|
118
118
|
|
119
|
+
# Fix bootsnap issue IMMEDIATELY after rails new
|
120
|
+
puts "🔧 Making bootsnap optional..."
|
121
|
+
make_bootsnap_optional(service_dir)
|
122
|
+
|
119
123
|
# Overwrite Gemfile before bundle install
|
120
124
|
puts "🔧 Overwriting Gemfile to remove sqlite3 and other defaults..."
|
121
125
|
|
@@ -172,26 +176,23 @@ module Regolith
|
|
172
176
|
puts "→ Next: regolith generate service <another_service> or regolith server"
|
173
177
|
end
|
174
178
|
|
175
|
-
# ---
|
179
|
+
# --- FIXED: Helper to make Bootsnap optional ---
|
176
180
|
def make_bootsnap_optional(service_dir)
|
177
181
|
boot_rb_path = File.join(service_dir, "config", "boot.rb")
|
178
182
|
return unless File.exist?(boot_rb_path)
|
179
183
|
|
180
184
|
boot = File.read(boot_rb_path)
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
)
|
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
|
191
194
|
|
192
|
-
|
193
|
-
File.write(boot_rb_path, patched)
|
194
|
-
end
|
195
|
+
File.write(boot_rb_path, patched)
|
195
196
|
end
|
196
197
|
|
197
198
|
def patch_rails_app(service_dir, service_name, port)
|
@@ -200,29 +201,28 @@ module Regolith
|
|
200
201
|
File.write("#{initializer_dir}/regolith.rb", generate_regolith_initializer(service_name))
|
201
202
|
File.write("#{service_dir}/Dockerfile", generate_dockerfile)
|
202
203
|
|
203
|
-
# Call the Bootsnap patcher here
|
204
|
-
make_bootsnap_optional(service_dir)
|
205
|
-
|
206
204
|
app_rb_path = "#{service_dir}/config/application.rb"
|
207
205
|
app_rb_content = File.read(app_rb_path)
|
208
206
|
|
209
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
|
210
215
|
|
211
|
-
|
212
|
-
|
213
|
-
allow do
|
214
|
-
origins '*'
|
215
|
-
resource '*', headers: :any, methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
config.regolith_service_name = '#{service_name}'
|
220
|
-
config.regolith_service_port = #{port}
|
216
|
+
config.regolith_service_name = '#{service_name}'
|
217
|
+
config.regolith_service_port = #{port}
|
221
218
|
RUBY
|
222
219
|
|
223
|
-
|
224
|
-
|
225
|
-
|
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
|
226
226
|
end
|
227
227
|
|
228
228
|
File.write(app_rb_path, app_rb_content)
|
@@ -393,7 +393,7 @@ module Regolith
|
|
393
393
|
|
394
394
|
COMMANDS:
|
395
395
|
new <app_name> Create a new Regolith application
|
396
|
-
generate service <
|
396
|
+
generate service <n> Generate a new microservice
|
397
397
|
server Start all services with Docker Compose
|
398
398
|
console <service_name> Open Rails console for a service
|
399
399
|
version Show version information
|
data/lib/regolith/version.rb
CHANGED