Class: Backup::Storage::SCP

Inherits:
Base
  • Object
show all
Defined in:
lib/backup/storage/scp.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#keep, #time

Instance Method Summary collapse

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) ⇒ SCP

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



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/backup/storage/scp.rb', line 30

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 SCP port



20
21
22
# File 'lib/backup/storage/scp.rb', line 20

def ip
  @ip
end

#passwordObject

Server credentials



16
17
18
# File 'lib/backup/storage/scp.rb', line 16

def password
  @password
end

#pathObject

Path to store backups to



24
25
26
# File 'lib/backup/storage/scp.rb', line 24

def path
  @path
end

#portObject

Server IP Address and SCP port



20
21
22
# File 'lib/backup/storage/scp.rb', line 20

def port
  @port
end

#usernameObject

Server credentials



16
17
18
# File 'lib/backup/storage/scp.rb', line 16

def username
  @username
end

Instance Method Details

#perform!Object

Performs the backup transfer



50
51
52
53
# File 'lib/backup/storage/scp.rb', line 50

def perform!
  transfer!
  cycle!
end

#remote_pathObject

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



44
45
46
# File 'lib/backup/storage/scp.rb', line 44

def remote_path
  File.join(path, TRIGGER)
end