Created
October 3, 2014 22:11
-
-
Save briandk/2787f3ee4047e1279fa4 to your computer and use it in GitHub Desktop.
a precommit hook for naive build versioning in R package development
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| D=`date +%Y%m%d%H%M%S` | |
| branch=`git status|grep -ie 'on branch master'` | |
| if [ -z "$branch" ]; then | |
| cat DESCRIPTION | sed -e 's/^\(Version: [0-9]*\.[0-9]*\).*/\1.'$D'/' > DESCRIPTION.temp | |
| rm DESCRIPTION | |
| mv DESCRIPTION.temp DESCRIPTION | |
| git add DESCRIPTION | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So basically, we're appending the datetime stamp (down to the second) to the version number in the
DESCRIPTIONfile.Why check whether the branch is
masteror not? Because in our original workflow all development was done on thedevbranch, and we only merged tomasterfor releases. We didn't want releases to have burdensome version numbers, so we exclude the extended version number when on the master branch.