How would I report the current revision, of the subversion/git repo
that is holding a ruby app?
This is actually going to be used in rails, but it seems generally
applicable to any ruby programming.....
I keep my ruby and rails projects in subversion (or git, or in one
case both...) and it would be nice to be able to show in my output, the
current working copy revision number.
I'd like to put this in my app/views/layouts/application.rb in rails
for example, so that the people using my dev server can always see the
revision when they are forming bug reports, and also include the
information in the "email me a bug report" link I have on the front
page.... I'd also like to include it in the about box of a wxRuby app .....
How would I report the current revision, of the subversion/git repo
that is holding a ruby app?
#
# Call +git+ and obtain the current commit SHA1 and commit date. Store these values
# in +APP_VERSION_COMMIT_ID+ and +APP_VERSION_COMMIT_DATE+. Then define
# +APP_VERSION+ to be a string of the two.
On 10/4/09, Anthony Metcalf <anthony.metcalf@anferny.me.uk> wrote:
Matt Haley wrote:
I use this in a Rails initializer, it works under Windows as well.
Thanks for this, it's taken me a while to look at it though.
If I include the code below in my wxRuby app, I get the errors
below. This is simply including the code in a method, in a class, and
including the source file. No calls to it or anything yet....
On Sun, Oct 4, 2009 at 9:53 AM, Anthony Metcalf <anthony.metcalf@anferny.me.uk> wrote:
IIRC, I was having trouble using the backticks under Windows and it worked well with IO.popen. I may be mistaken though, it's been a while
since I initially wrote that snippet.
···
On Tue, 6 Oct 2009, Jean-Michel wrote:
There is no need for IO.popen:
commit_id, commit_date = `git show --pretty=format:"%H|%ci" --
quiet`.split('|')