So, I have a 'development blog' in a rails app I'm working on right now. I'm using Git for version control and deployment (although right now I'm the only person working on it).
Now, when I make changes in Git I put a pretty decent log entry about what I've done. I'd love to have the Git commit log automatically posted to the development blog -- or otherwise available for others to read within the deployed site.
Is there an automated way to pull the Git Commit Log into a view in a rails app?
Some Git hosts will allow you to provide a post commit hook, and this can enable you to make an HTTP call to send the relevant log statements to your app.
If you're self-hosting, check out githooks.
If you're using Github, you can use their post-commit post (more details here: http://help.github.com/post-receive-hooks/)
You may want to look into grit which is a ruby library that gives access to stuff in a git repo.
I'm using grit in my personal blog. I write articles in text files and commit them to a git repo, then push the git repo to my server where my rails app reads files from git repo as blog posts using grit.
For example, here's how easy it is to get the last commit message:
require 'grit'
include Grit
repo = Repo.new('<path to your .git dir>')
puts repo.commits('master',1)[0].message # latest commit message
puts repo.commits('master',1)[0].date # last commit date
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With