App Version Number auto increment - ParkinT/RubyMotion_Life GitHub Wiki

Colinta provides this very clever way to automatically increment you App's version number based on the git commit

  • 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}"). A simpler way to do this is to just tack the git commit hash onto the version number:

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