I am deploying my rails 3 app using capistrano, and I want to get the git version (and date information) and update my website’s footer with this.
How can I do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Based on David’s direction, I solved this by creating an initializer “git_info.rb”. Place this file in your Rails initializers directory
The contents of the git_info.rb are:
Then in your footer, you can use this output (HAML syntax):
You may want to set the font color of #rev_info the same as the background color, so the text is visible only when you highlight it with your cursor.
I just tried this, and while it works in development mode, it seems like the branch gets over-written with “deploy” post capistrano deploy. Capistrano must be creating it’s own local branch called “deploy” on deploy?