Sha256: ee454ed1e4c7cefca8b09262ad2b9112579520d278d4237dc99076ff2151ec20
Contents?: true
Size: 837 Bytes
Versions: 12
Compression:
Stored size: 837 Bytes
Contents
module Picky module Backends module Helpers # Common file helpers. # module File # The backup directory of this file. # Equal to the file's dirname plus /backup # def backup_directory path ::File.join ::File.dirname(path), 'backup' end # Prepares the backup directory for the file. # def prepare_backup target FileUtils.mkdir target unless Dir.exists?(target) end # The backup filename. # def backup_file_path_of path dir, name = ::File.split path ::File.join dir, 'backup', name end # Extracts the size of the file in Bytes. # def size_of path `ls -l #{path} | awk '{print $5}'`.to_i end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems