7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/ebps/postprocess/copy.rb', line 7
def self.postprocess data={}
target = EBPS.config.target
report = ["the generated Ebook %s was copied to the following locations" % File.basename(target)]
data['targets'].each do |path|
uri = ::URI.parse path
case uri.scheme
when 'ftp'
Net::FTP.open uri.host do |ftp|
ftp.login uri.user, uri.password
ftp.chdir File.dirname(uri.path)
ftp.putbinaryfile target, File.basename(uri.path)
end
else
FileUtils.cp target, path
end
report.push sprintf(" - %s", path)
end
report.join "\n"
end
|