2019-07-29 17:51:08 +00:00
|
|
|
var exec = require('child_process').exec
|
|
|
|
module.exports = function(s,config,lang,app,io){
|
|
|
|
var getRepositoryCommitId = function(callback){
|
|
|
|
exec(`git rev-parse HEAD`,function(err,response){
|
2019-07-29 20:10:08 +00:00
|
|
|
if(response){
|
|
|
|
var data = response.toString()
|
|
|
|
var isGitRespository = false
|
|
|
|
if(data.indexOf('not a git repository') === -1){
|
|
|
|
s.currentVersion = data
|
|
|
|
isGitRespository = true
|
|
|
|
s.systemLog(`Current Version : ${s.currentVersion}`)
|
|
|
|
}
|
|
|
|
}else if(err){
|
|
|
|
s.debugLog('Git is not installed.')
|
2019-07-29 17:51:08 +00:00
|
|
|
}
|
|
|
|
if(callback)callback(!isGitRespository,data)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
getRepositoryCommitId()
|
|
|
|
}
|