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:
parent
ea25d27f24
commit
bb7c50e24b
1 changed files with 10 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue