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

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

Overview

Base class for database management services

Direct Known Subclasses

MySQL, Postgres

Instance Method Summary collapse

Constructor Details

#initialize(app_name:, app_path:, ruby:) ⇒ Base

Returns a new instance of Base.



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

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

Instance Method Details

#prepareObject



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

def prepare
  System::Shell.run(
    bash_rvm('bundle exec rails db:prepare')
  )
end