Class: Frank::Publish::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/frank/publish/base.rb

Direct Known Subclasses

FTPTLS, SFTP

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Base

Returns a new instance of Base.



11
12
13
14
15
16
17
18
# File 'lib/frank/publish/base.rb', line 11

def initialize(options)
  @username = options.user || options.username
  @password = options.password
  @hostname = options.host
  @remote_path = options.path
  @port = options.port
  @local_path = "/tmp/frank-publish-#{Frank.proj_name}-#{Time.now.to_i}"
end

Instance Attribute Details

#hostnameObject

Returns the value of attribute hostname.



6
7
8
# File 'lib/frank/publish/base.rb', line 6

def hostname
  @hostname
end

#local_pathObject

Returns the value of attribute local_path.



8
9
10
# File 'lib/frank/publish/base.rb', line 8

def local_path
  @local_path
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/frank/publish/base.rb', line 5

def password
  @password
end

#portObject

Returns the value of attribute port.



6
7
8
# File 'lib/frank/publish/base.rb', line 6

def port
  @port
end

#remote_pathObject

Returns the value of attribute remote_path.



7
8
9
# File 'lib/frank/publish/base.rb', line 7

def remote_path
  @remote_path
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/frank/publish/base.rb', line 5

def username
  @username
end

Instance Method Details

#perform!Object

Performs the backup transfer



22
23
24
25
26
27
28
29
30
# File 'lib/frank/publish/base.rb', line 22

def perform!
  export!
  begin
    transfer!
  rescue SocketError
    err_message "Transfer failed. SocketError. Do you have internet?"
  end
  cleanup!
end