Module: Shnell::Actions::Ftp
Instance Method Summary
collapse
Methods included from Config
#config, #db_credentials, #db_password, #db_user, #ftp_host, #ftp_password, #ftp_user, #read_config, #write_config
Instance Method Details
#ftp_get(filename, destination) ⇒ Object
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/shnell/actions/ftp.rb', line 8
def ftp_get(filename, destination)
return if Filander.behavior == :pretend
inside destination do
Net::FTP.open(ftp_host) do |ftp|
ftp.login ftp_user, ftp_password
ftp.getbinaryfile filename
end
end
yield if block_given? && File.exists?(File.join(destination, filename))
end
|
#ftp_put(filename, destination = '/') ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/shnell/actions/ftp.rb', line 19
def ftp_put(filename, destination = '/')
return if Filander.behavior == :pretend
Net::FTP.open(ftp_host) do |ftp|
ftp.login ftp_user, ftp_password
ftp.putbinaryfile File.join(destination, filename)
end
end
|