I used to use a very similar approach to James back about 2 years ago used
in combination with capistrano ceploys. Basically, a cap recipe, it writes
to a revision file on deploy that greps the git log.
Note I used this for bug fixing with users as I had the tell me what the
hash (or deploy date) was at the bottom of pages. Similar approach might
work for you.
nb: This won't work on heroku since you can't write to file system.
# Takes a grep of the git log, grabs the latest date and write it to the
revision file so
# you can see on the application which version of the app you're running
desc "Write current revision to app/layouts/_revision.rhtml"
task :publish_revision do
put(`git log | grep ^Date -m 1`,
"#{release_path}/app/views/layouts/_revision.html.erb")
end
On Thu, Sep 1, 2011 at 9:49 AM, James Healy <[email protected]> wrote:
> On 1 September 2011 09:23, malclocke <[email protected]> wrote:
> > I guess ideally I'd like to include the git commit id in code somehow,
> > but svn style keyword substitution seems to be discouraged. I'd like
> > the solution to work if the deployed code is not actually a git
> > checkout. I'd like a solution that doesn't require me to manually
> > update a config version number somewhere.
>
> I create a git tag to mark each deploy and allow easy diffs between
> deploys, etc.
>
> During each deploy, I run "git describe --abbrev=0 > db/tag.txt" to
> output the current tag to a file. That's then used in the code when I
> want to check the release/build version.
>
> James
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "Ruby
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.