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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8160ffb867123dc4c885ac58612c18757c97947ec40dbcb3872f79fadc2678a
4
- data.tar.gz: d50c20a4548c0cda47eac9411939fe97ad7caaa045d56ecb4ada2fca642a8e33
3
+ metadata.gz: 8cf31d7589b33d2b6797a7759b0f560cf5c8d6f3a728961728afe8b3f7304f8a
4
+ data.tar.gz: f9d6637dd5a7e9d90ccc250bf42187ccf4bc0a383bbc6b2306950ea819bef940
5
5
  SHA512:
6
- metadata.gz: ff04550e0d104035bd7e778b600268489443729997486a7a31c7d3e2e93110d15d94210700a44b9d97703d905e34c3848ec2a3e74211cf662cfb2e0661804eb0
7
- data.tar.gz: 712196a11f54d54a382f6a9192a73b41294e373dff17c413e9fa3e89e80109b4697a7ace9b3261c990f5a5fa1ad6732f706336d402969e264a8ed3a897220a19
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"
@@ -1,4 +1,4 @@
1
1
  # lib/regolith/version.rb
2
2
  module Regolith
3
- VERSION = "0.1.32"
3
+ VERSION = "0.2.0"
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.32
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Regolith Team