class Backup::FileItem::Local
Public Instance Methods
create_directory_once(*directories)
click to toggle source
# File lib/backup/file_item/local.rb, line 6 def create_directory_once(*directories) directories.each do |path| FileUtils.mkdir_p(path) unless Dir.exists?(path) end end
create_file_once(file, data)
click to toggle source
# File lib/backup/file_item/local.rb, line 12 def create_file_once(file, data) date = date.read if date.is_a? File File.open(file, "w").puts(data) unless File.exists?(file) end
dir(path, mask = "*")
click to toggle source
# File lib/backup/file_item/local.rb, line 21 def dir(path, mask = "*") Dir["#{path}/#{mask}"] end
read_file(file)
click to toggle source
# File lib/backup/file_item/local.rb, line 17 def read_file(file) open(file).read if File.exists? file end