hva9nw
Last Updated: February 25, 2016
·
1.691K
· thinkclay
Cb047b44e7b9492cb9053c697891bfed

Create rubymotion app version from git hash

the most recent git commit: git log -n 1 --pretty=format:'%h'
the last recorded git commit: File.read('version-git.txt') rescue ''
the current patch: File.read('version-patch.txt').to_i rescue 0

if the current git commit and last recorded commit don't match, bump the version-patch number. Then add this to your version (app.version = "X.Y.#{patch}").

or, a simpler way to do this, just tack the git commit hash onto the version number:

app.version = "1.2.3-#{git log -n 1 --pretty=format:'%h'}"

via @colinta

Say Thanks
Respond

1 Response
Add your response

13811
C5d2ca4998259d200a48e38847d19f06

I like this approach:

app.short_version = "1.0.0"
app.version = `git log -n 1 --pretty=format:'%h'`

Which gives short version: 1.0.0
And the hash as the long version

Testflight nicely displays this as 1.0.0(231asdf)

over 1 year ago ·