Rails 3 app, How to get GIT version and update website? -
i deploying rails 3 app using capistrano, , want git version (and date information) , update website's footer this.
how can this?
based on david's direction, solved creating initializer "git_info.rb". place file in rails initializers directory
the contents of git_info.rb are:
git_branch = `git status | sed -n 1p`.split(" ").last git_commit = `git log | sed -n 1p`.split(" ").last
then in footer, can use output (haml syntax):
#rev_info = "branch: #{git_branch} | commit: #{git_commit}"
you may want set font color of #rev_info same background color, text visible when highlight cursor.
i tried this, , while works in development mode, seems branch gets over-written "deploy" post capistrano deploy. capistrano must creating it's own local branch called "deploy" on deploy?
Comments
Post a Comment