scratch/lib/gitmtime.rb

15 lines
415 B
Ruby
Raw Normal View History

2010-09-02 08:20:45 +00:00
def gitmtime
2011-04-20 12:29:01 +00:00
filepath=@item.path.sub(@config[:webprefix]+'/','content/html/').sub(/\/$/,'')
ext=%{.#{@item[:extension]}}
filepath<<=ext
if not FileTest.exists?(filepath)
filepath.sub!(ext,%{#{@item.raw_filename}#{ext}})
end
str=`git log -1 --format='%ci' -- #{filepath}`
2010-09-02 14:42:39 +00:00
if str.nil? or str.empty?
2010-09-02 14:51:05 +00:00
return Time.now
2010-09-02 08:51:36 +00:00
else
return DateTime.parse( str )
end
2010-09-02 08:20:45 +00:00
end