regolith 0.1.32 → 0.2.0
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 +44 -0
- 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: 8cf31d7589b33d2b6797a7759b0f560cf5c8d6f3a728961728afe8b3f7304f8a
|
4
|
+
data.tar.gz: f9d6637dd5a7e9d90ccc250bf42187ccf4bc0a383bbc6b2306950ea819bef940
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15b100673243b41dee98edcdf6fdfba12b4231e5b634f218a256e9fdc191b2f813771b9ac9dbd8cf941550da8c80890edcbee351a6190a2bc1844d7f7330230a
|
7
|
+
data.tar.gz: 8430846023c4ae38edfbc18953342c2e99300a2f60b88bfad40849a3c4977630d0fdfd7ee4178557cf649b4b80cdf99b282364fc28b8de0e060f4dc064a6cd5f
|
data/lib/regolith/cli.rb
CHANGED
@@ -176,6 +176,10 @@ module Regolith
|
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
+
# Fix database configuration BEFORE patching Rails app
|
180
|
+
puts "🔧 Updating database configuration for PostgreSQL..."
|
181
|
+
patch_database_yml(service_dir, service_name)
|
182
|
+
|
179
183
|
patch_rails_app(service_dir, service_name, port)
|
180
184
|
|
181
185
|
config['services'][service_name] = {
|
@@ -311,6 +315,46 @@ module Regolith
|
|
311
315
|
File.write(app_rb_path, app_rb_content)
|
312
316
|
end
|
313
317
|
|
318
|
+
def patch_database_yml(service_dir, service_name)
|
319
|
+
database_yml_path = "#{service_dir}/config/database.yml"
|
320
|
+
|
321
|
+
database_config = <<~YAML
|
322
|
+
default: &default
|
323
|
+
adapter: postgresql
|
324
|
+
encoding: unicode
|
325
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
326
|
+
host: <%= ENV.fetch('POSTGRES_HOST', 'localhost') %>
|
327
|
+
port: <%= ENV.fetch('POSTGRES_PORT', 5432) %>
|
328
|
+
database: <%= ENV.fetch('POSTGRES_DB', '#{service_name}_development') %>
|
329
|
+
username: <%= ENV.fetch('POSTGRES_USER', 'postgres') %>
|
330
|
+
password: <%= ENV.fetch('POSTGRES_PASSWORD', 'password') %>
|
331
|
+
|
332
|
+
development:
|
333
|
+
<<: *default
|
334
|
+
|
335
|
+
test:
|
336
|
+
<<: *default
|
337
|
+
database: <%= ENV.fetch('POSTGRES_DB', '#{service_name}_development') %>_test
|
338
|
+
|
339
|
+
production:
|
340
|
+
<<: *default
|
341
|
+
url: <%= ENV['DATABASE_URL'] %>
|
342
|
+
YAML
|
343
|
+
|
344
|
+
File.write(database_yml_path, database_config)
|
345
|
+
puts "🔧 Updated database.yml for PostgreSQL"
|
346
|
+
|
347
|
+
# Also check if there are any environment-specific configs that might override this
|
348
|
+
dev_config_path = "#{service_dir}/config/environments/development.rb"
|
349
|
+
if File.exist?(dev_config_path)
|
350
|
+
dev_config = File.read(dev_config_path)
|
351
|
+
# Remove any SQLite references
|
352
|
+
dev_config.gsub!(/config\.active_record\.database_selector.*?\n/, '')
|
353
|
+
dev_config.gsub!(/config\.active_record\.database_resolver.*?\n/, '')
|
354
|
+
File.write(dev_config_path, dev_config)
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
314
358
|
def start_server
|
315
359
|
unless File.exist?('docker-compose.yml')
|
316
360
|
puts "❌ Error: Not in a Regolith app directory"
|
data/lib/regolith/version.rb
CHANGED