Last Updated: February 25, 2016
·
1.953K
· thinkclay

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

1 Response
Add your response

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 ·