Last active
December 17, 2015 18:49
-
-
Save pstaender/5655733 to your computer and use it in GitHub Desktop.
This file contains 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
{exec} = require('child_process') | |
version_hash = null | |
exec 'git rev-parse HEAD', (err,output) -> | |
# get revision hash from git and strip whitespaces | |
version_hash = if output then output.replace(/\s/g, '') else null | |
# uesed as default for mongoose | |
versionHash = -> version_hash | |
# use in your mongoose schema | |
user = new Schema | |
name: String | |
email: | |
type: String | |
index: true | |
version: | |
type: String | |
default: versionHash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment