Class: UffDbLoader::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/configuration.rb', line 21

def initialize
  @environments = nil
  @ssh_host = nil
  @ssh_user = nil
  @db_name = nil
  @db_system = nil
  @app_name = Dir.pwd.split("/").last
  @dumps_directory = File.join(Dir.pwd, "dumps")
  @database_config_file = File.join(Dir.pwd, "config", "database.yml")
  @container_name = nil
  @local_restore_command_path = nil
end

Instance Attribute Details

#app_nameObject

Returns the value of attribute app_name.



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

def app_name
  @app_name
end

#container_nameObject

Returns the value of attribute container_name.



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

def container_name
  @container_name
end

#database_config_fileObject

Returns the value of attribute database_config_file.



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

def database_config_file
  @database_config_file
end

#db_nameObject

Returns the value of attribute db_name.



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

def db_name
  @db_name
end

#db_systemObject

Returns the value of attribute db_system.



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

def db_system
  @db_system
end

#dumps_directoryObject

Returns the value of attribute dumps_directory.



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

def dumps_directory
  @dumps_directory
end

#environmentsObject

Returns the value of attribute environments.



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

def environments
  @environments
end

#local_restore_command_pathObject

Returns the value of attribute local_restore_command_path.



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

def local_restore_command_path
  @local_restore_command_path
end

#ssh_hostObject

Returns the value of attribute ssh_host.



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

def ssh_host
  @ssh_host
end

#ssh_userObject

Returns the value of attribute ssh_user.



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

def ssh_user
  @ssh_user
end

Instance Method Details

#databaseObject



34
35
36
# File 'lib/configuration.rb', line 34

def database
  db_name || ssh_user
end

#database_systemObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/configuration.rb', line 38

def database_system
  case db_system.to_sym
  when :postgresql
    UffDbLoader::Postgresql
  when :mysql
    UffDbLoader::Mysql
  else
    raise UnknownDatabaseSystem, "Could not identify database system. Use `config.db_system` to configure it."
  end
end