sharieswebsite/lib/gitmtime.rb
Yann Esposito (Yogsototh) 739e68ea34 Added nanoc stuff
2011-05-02 12:09:43 +02:00

14 lines
400 B
Ruby

def gitmtime
filepath=@item.path.sub(@config[:webprefix]+'/','content/html/').sub(/\/$/,'')
ext=%{.#{@item[:extension]}}
filepath<<=ext
if not FileTest.exists?(filepath)
filepath.sub!(ext,%{/index#{ext}})
end
str=`git log -1 --format='%ci' -- #{filepath}`
if str.nil? or str.empty?
return Time.now
else
return DateTime.parse( str )
end
end