metadata: set_timestamps_in_metadata for files without parse, too
This commit is contained in:
parent
92b4cc5dc2
commit
6200acce71
3
bin/ace
3
bin/ace
|
@ -46,7 +46,8 @@ rules.rules.each do |klass, files|
|
|||
item = klass.create(raw_item.metadata, raw_item.content, file)
|
||||
else
|
||||
puts "~ Read #{file} without parse"
|
||||
item = klass.create(Hash.new, File.read(file), file)
|
||||
raw_item = Ace::RawItem.new(file).tap(&:set_timestamps_in_metadata)
|
||||
item = klass.create(raw_item.metadata, File.read(file), file)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,6 +23,7 @@ module Ace
|
|||
def initialize(path)
|
||||
@path = path
|
||||
@data = File.read(path)
|
||||
self.metadata = Hash.new
|
||||
end
|
||||
|
||||
def parse
|
||||
|
@ -40,7 +41,6 @@ module Ace
|
|||
set_timestamps_in_metadata
|
||||
end
|
||||
|
||||
private
|
||||
def set_timestamps_in_metadata
|
||||
self.metadata[:created_at] ||= File.ctime(self.path)
|
||||
self.metadata[:updated_at] ||= File.mtime(self.path)
|
||||
|
|
Loading…
Reference in a new issue