Class: DbDumper::Configuration
- Inherits:
-
Object
- Object
- DbDumper::Configuration
show all
- Defined in:
- lib/db_dumper/configuration.rb,
lib/db_dumper/configuration/base.rb,
lib/db_dumper/configuration/postgres.rb
Overview
Configuration class, by default loads from config/application.yml file see config/dumper.sample.yml for format details
Defined Under Namespace
Classes: Base, Postgres, RemoteDB, RemoteMachine, SshUser
Constant Summary
collapse
- DB_UTILS =
{
'postgres' => Postgres
}
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(config_file_path) ⇒ Configuration
Returns a new instance of Configuration.
27
28
29
|
# File 'lib/db_dumper/configuration.rb', line 27
def initialize(config_file_path)
@config_file_path = config_file_path
end
|
Instance Attribute Details
#config_file_path ⇒ Object
Returns the value of attribute config_file_path.
25
26
27
|
# File 'lib/db_dumper/configuration.rb', line 25
def config_file_path
@config_file_path
end
|
Instance Method Details
#db_utils ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/db_dumper/configuration.rb', line 35
def db_utils
@db_utils ||= begin
utils = DB_UTILS[remote_db.adapter]
raise 'Unknown adapter for remote_db:adapter check application.yml' unless utils
utils.new(remote_db)
end
end
|
#log(message) ⇒ Object
31
32
33
|
# File 'lib/db_dumper/configuration.rb', line 31
def log(message)
logger.info(message)
end
|
#logger ⇒ Object
55
56
57
|
# File 'lib/db_dumper/configuration.rb', line 55
def logger
@logger ||= Logger.new(STDOUT)
end
|
#remote_db ⇒ Object
51
52
53
|
# File 'lib/db_dumper/configuration.rb', line 51
def remote_db
@remote_db ||= RemoteDB.new(loaded_file['remote_db'])
end
|
#remote_machine ⇒ Object
47
48
49
|
# File 'lib/db_dumper/configuration.rb', line 47
def remote_machine
@remote_machine ||= RemoteMachine.new(loaded_file['remote_machine'])
end
|
#ssh_user ⇒ Object
43
44
45
|
# File 'lib/db_dumper/configuration.rb', line 43
def ssh_user
@ssh_user ||= SshUser.new(loaded_file['ssh_user'])
end
|