Class: Rays::Service::Backup

Inherits:
Object
  • Object
show all
Defined in:
lib/rays/services/backup_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(environment = $rays_config.environment) ⇒ Backup

Returns a new instance of Backup.



28
29
30
31
32
33
# File 'lib/rays/services/backup_service.rb', line 28

def initialize(environment = $rays_config.environment)
  @environment = environment
  @backup_directory = create_backup_directory
  @dump_file_name = 'db.dump'
  @package_file = "archive-#{Time.now.to_i.to_s}.tar"
end

Instance Method Details

#backupObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rays/services/backup_service.rb', line 35

def backup
  package = ''

  service_safe(@environment.backup.stop_server) do
    database
    data
    package = pack
  end

  package
end