5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 19:21:45 +00:00

calcular el espacio una sola vez

This commit is contained in:
f 2022-04-06 20:54:35 -03:00
parent ea25d27f24
commit bb7c50e24b

View file

@ -28,15 +28,17 @@ class DeployLocal < Deploy
# Obtener el tamaño de todos los archivos y directorios (los
# directorios son archivos :)
def size
paths = [destination, File.join(destination, '**', '**')]
@size ||= begin
paths = [destination, File.join(destination, '**', '**')]
Dir.glob(paths).map do |file|
if File.symlink? file
0
else
File.size(file)
end
end.inject(:+)
Dir.glob(paths).map do |file|
if File.symlink? file
0
else
File.size(file)
end
end.inject(:+)
end
end
def destination