Touch an empty file if note doesn't exist.

This commit is contained in:
hassaku 2015-01-07 14:48:44 +09:00
parent acb1c17fc1
commit b8ca05a16c
2 changed files with 6 additions and 1 deletions

View File

@ -13,7 +13,7 @@ class Fluentd
def initialize(file_path, note = nil)
@file_path = file_path
@note = note || Note.new(file_path.sub(/#{FILE_EXTENSION}$/, Note::FILE_EXTENSION))
@note = note || Note.create(file_path.sub(/#{FILE_EXTENSION}$/, Note::FILE_EXTENSION))
end
end
end

View File

@ -9,6 +9,11 @@ class Fluentd
new(file_path_of(backup_dir, file_id))
end
def self.create(file_path)
FileUtils.touch(file_path)
new(file_path)
end
def initialize(file_path)
@file_path = file_path
end