1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00
capistrano/_plugins/gitactivity.rb

32 lines
744 B
Ruby
Raw Normal View History

2013-06-12 16:44:00 -04:00
require 'git'
module Jekyll
class GitActivityTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
end
def render(context)
result = ""
g = Git.open(File.join(Dir.getwd, ".."))
index = 0
g.log.each do |log|
if(index < 10)
result << "<li>"
result << log.date.strftime("%d %b")
result << " - <a href='https://github.com/capistrano/capistrano-documentation/commit/"
result << log.sha
result << "/'>"
result << log.message
result << "</a></li>"
index += 1
end
end
"<ul>#{result}</ul>"
end
end
end
Liquid::Template.register_tag('gitactivity', Jekyll::GitActivityTag)