Skip to content

Commit

Permalink
Merge pull request #93 from vrockai/HAWKULAR-53
Browse files Browse the repository at this point in the history
HAWKULAR-53: Adding git-sha to js files
  • Loading branch information
mtho11 committed Apr 16, 2015
2 parents 70a45e2 + eb2714e commit eff91d6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions build/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,15 @@ module.exports = function(gulp, config, pluginName){
.pipe(gulp.dest(config.dist));
});

gulp.task('git-sha-' + pluginName, ['template-' + pluginName],function(){
return plugins.git.exec({args : 'log -n 1 --oneline'}, function (err, stdout) {
if (err) throw err;

gulp.task('git-sha-' + pluginName, ['template-' + pluginName], function(cb) {
plugins.git.exec({args : 'log -n 1 --oneline'}, function (err, stdout) {
if (err) throw err;
var versionFile = '.tmp/' + pluginName + 'version.js';
var gitSha = stdout.slice(0,-1);
var jsString = 'if (typeof HawkularComponentsVersions !== \'undefined\') { HawkularComponentsVersions.push({name:\''+pluginName+'\', version:\'' + gitSha + '\'})} else {HawkularComponentsVersions = [{name:\''+pluginName+'\', version:\'' + gitSha + '\'}]};';
var gitSha = stdout.slice(0, -1);
var jsString = 'if (typeof HawkularComponentsVersions !== \'undefined\') { HawkularComponentsVersions.push({name:\'' + pluginName + '\', version:\'' + gitSha + '\'})} else {HawkularComponentsVersions = [{name:\'' + pluginName + '\', version:\'' + gitSha + '\'}]};';
fs.writeFileSync(versionFile, jsString);
cb();
});
});

Expand Down

0 comments on commit eff91d6

Please sign in to comment.