Skip to content

Instantly share code, notes, and snippets.

@yogsototh
Created September 2, 2010 08:39
Show Gist options
  • Save yogsototh/562059 to your computer and use it in GitHub Desktop.
Save yogsototh/562059 to your computer and use it in GitHub Desktop.
def gitmtime
# find file extension
[email protected]('/Scratch/','content/html/').sub(/\/$/,'')
['md','erb','haml'].each do |ext|
tmppath=%{#{filepath}.#{ext}}
if FileTest.exists?(tmppath)
filepath=tmppath
break
end
end
str=`git log --format='%ci' -- #{filepath} | head -n 1`
# puts '#############'
# puts "item #{filepath}"
# puts "str #{str}"
# puts '#############'
if str == ""
return @item.mtime
else
return DateTime.parse( str )
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment