Class: Backup::Storage::RSync

Inherits:
Base
  • Object
show all
Includes:
CLI
Defined in:
lib/backup/storage/rsync.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#keep, #time

Instance Method Summary collapse

Methods included from CLI

#mkdir, #rm, #run, #utility

Methods inherited from Base

#cycle!, #local_file, #local_path, #provider, #remote_file

Methods included from Configuration::Helpers

#clear_defaults!, #getter_methods, #load_defaults!, #setter_methods

Constructor Details

#initialize(&block) ⇒ RSync

Creates a new instance of the RSync storage object First it sets the defaults (if any exist) and then evaluates the configuration block which may overwrite these defaults



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/backup/storage/rsync.rb', line 28

def initialize(&block)
  load_defaults!

  @port ||= 22
  @path ||= 'backups'

  instance_eval(&block) if block_given?

  @time = TIME
  @path = path.sub(/^\~\//, '')
end

Instance Attribute Details

#ipObject

Server IP Address and SSH port



18
19
20
# File 'lib/backup/storage/rsync.rb', line 18

def ip
  @ip
end

#passwordObject

Server credentials



14
15
16
# File 'lib/backup/storage/rsync.rb', line 14

def password
  @password
end

#pathObject

Path to store backups to



22
23
24
# File 'lib/backup/storage/rsync.rb', line 22

def path
  @path
end

#portObject

Server IP Address and SSH port



18
19
20
# File 'lib/backup/storage/rsync.rb', line 18

def port
  @port
end

#usernameObject

Server credentials



14
15
16
# File 'lib/backup/storage/rsync.rb', line 14

def username
  @username
end

Instance Method Details

#perform!Object

Performs the backup transfer



48
49
50
# File 'lib/backup/storage/rsync.rb', line 48

def perform!
  transfer!
end

#remote_pathObject

This is the remote path to where the backup files will be stored



42
43
44
# File 'lib/backup/storage/rsync.rb', line 42

def remote_path
  File.join(path, TRIGGER)
end