Module: DeliveryCenter

Defined in:
lib/delivery_center.rb,
lib/delivery_center/errors.rb,
lib/delivery_center/version.rb

Defined Under Namespace

Classes: AlreadyDeployedError, ApiKey, App, Application, ApplicationRecord, Cli, Deploy, PreviousDeployNotExistError, Revision

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

._database_configObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/delivery_center.rb', line 18

def self._database_config
  if ENV['RACK_ENV'] == 'test'
    {
      adapter: 'mysql2',
      username: ENV['DELIVERY_CENTER_DATABASE_USERNAME'],
      password: ENV['DELIVERY_CENTER_DATABASE_PASSWORD'],
      database: ENV['DELIVERY_CENTER_DATABASE_DATABASE'] || 'delivery_center_test',
      host: ENV['DELIVERY_CENTER_DATABASE_HOST'],
      port: ENV['DELIVERY_CENTER_DATABASE_PORT'],
    }
  else
    {
      adapter: 'mysql2',
      username: ENV['DELIVERY_CENTER_DATABASE_USERNAME'],
      password: ENV['DELIVERY_CENTER_DATABASE_PASSWORD'],
      database: ENV['DELIVERY_CENTER_DATABASE_DATABASE'] || 'delivery_center',
      host: ENV['DELIVERY_CENTER_DATABASE_HOST'],
      port: ENV['DELIVERY_CENTER_DATABASE_PORT'],
    }
  end
end

.database_config(excludes: []) ⇒ Object



12
13
14
15
16
# File 'lib/delivery_center.rb', line 12

def self.database_config(excludes: [])
  config = _database_config
  excludes.each { |key| config.delete(key) }
  config
end

.loggerObject



4
5
6
# File 'lib/delivery_center.rb', line 4

def self.logger
  @logger ||= Logger.new(STDOUT)
end

.rootObject



8
9
10
# File 'lib/delivery_center.rb', line 8

def self.root
  Pathname.new(File.join(__dir__, 'delivery_center'))
end