Class: Parity::Backup

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

Constant Summary collapse

BLANK_ARGUMENTS =
"".freeze
DATABASE_YML_RELATIVE_PATH =
"config/database.yml".freeze
DEVELOPMENT_ENVIRONMENT_KEY_NAME =
"development".freeze
DATABASE_KEY_NAME =
"database".freeze

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Backup

Returns a new instance of Backup.



10
11
12
13
14
# File 'lib/parity/backup.rb', line 10

def initialize(args)
  @from, @to = args.values_at(:from, :to)
  @additional_args = args[:additional_args] || BLANK_ARGUMENTS
  @parallelize = args[:parallelize] || false
end

Instance Method Details

#restoreObject



16
17
18
19
20
21
22
23
24
# File 'lib/parity/backup.rb', line 16

def restore
  if to == DEVELOPMENT_ENVIRONMENT_KEY_NAME
    restore_to_development
  elsif from == DEVELOPMENT_ENVIRONMENT_KEY_NAME
    restore_from_development
  else
    restore_to_remote_environment
  end
end