Skip to content

Instantly share code, notes, and snippets.

@StevenBlack
Forked from alx/git.rb
Created June 2, 2013 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StevenBlack/5695168 to your computer and use it in GitHub Desktop.
Save StevenBlack/5695168 to your computer and use it in GitHub Desktop.
Jekyll plugin to add Git activity inside a list
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='http://git.tetalab.org/index.php/p/jekyll/source/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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment