Class: Stable::Services::Database::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/stable/services/database/base.rb

Direct Known Subclasses

MySQL, Postgres

Instance Method Summary collapse

Constructor Details

#initialize(app_name:, app_path:) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
13
14
15
# File 'lib/stable/services/database/base.rb', line 7

def initialize(app_name:, app_path:)
  @app_name = app_name
  @app_path = app_path
  @database_name = @app_name
                   .downcase
                   .gsub(/[^a-z0-9_]/, '_')
                   .gsub(/_+/, '_')
                   .gsub(/^_+|_+$/, '')
end

Instance Method Details

#prepareObject



17
18
19
20
21
# File 'lib/stable/services/database/base.rb', line 17

def prepare
  System::Shell.run(
    "cd #{@app_path} && bundle exec rails db:prepare"
  )
end