delete hg commands

add GIT_COMMIT to build result
This commit is contained in:
Alexander.Trofimov 2016-04-07 19:09:44 +03:00
parent d71ef65eb4
commit 386a14c201
2 changed files with 5 additions and 45 deletions

View file

@ -1,9 +1,7 @@
module.exports = function(grunt) {
var _ = require('lodash'),
defaultConfig,
packageFile,
revisionHash = '@@REVISION',
revisionTimeStamp = '@@REVISIONDATE';
packageFile;
grunt.loadNpmTasks('grunt-contrib-clean');
@ -55,43 +53,6 @@ module.exports = function(grunt) {
});
}
grunt.registerTask('init-config', 'Initialize build script', function() {
var exec = require('child_process').exec,
done = this.async(),
commandsRef = 0;
function doneTask() {
if (--commandsRef <= 0) {
done(true);
}
}
function doCommand(command, callback) {
commandsRef++;
exec(command, callback);
}
doCommand('hg log -r -1 --template "{node|short}"', function(error, stdout, stderr) {
if (error) {
grunt.log.writeln('Error: ' + error);
} else {
revisionHash = stdout;
}
doneTask();
});
doCommand('hg log -r -1 --template "{date|isodate}"', function(error, stdout, stderr) {
if (error) {
grunt.log.writeln('Error: ' + error);
} else {
revisionTimeStamp = stdout;
}
doneTask();
});
});
grunt.initConfig({
mocha: {
test: {
@ -212,7 +173,7 @@ module.exports = function(grunt) {
' *\n' +
' * <%= pkg.homepage %> \n' +
' *\n' +
' * Version: <%= pkg.version %> (build:<%= pkg.build %>, rev:' + revisionHash + ', date:' + revisionTimeStamp + ')\n' +
' * Version: <%= pkg.version %> (build:<%= pkg.build %>, rev:' + (process.env['GIT_COMMIT'] || 'local') + ')\n' +
' */\n'
},
dist: {
@ -444,9 +405,9 @@ module.exports = function(grunt) {
}
});
grunt.registerTask('deploy-documenteditor', ['init-build-documenteditor', 'init-config', 'deploy-app']);
grunt.registerTask('deploy-spreadsheeteditor', ['init-build-spreadsheeteditor', 'init-config', 'deploy-app']);
grunt.registerTask('deploy-presentationeditor', ['init-build-presentationeditor', 'init-config', 'deploy-app']);
grunt.registerTask('deploy-documenteditor', ['init-build-documenteditor', 'deploy-app']);
grunt.registerTask('deploy-spreadsheeteditor', ['init-build-spreadsheeteditor', 'deploy-app']);
grunt.registerTask('deploy-presentationeditor', ['init-build-presentationeditor', 'deploy-app']);
grunt.registerTask('default', ['deploy-documenteditor', 'deploy-spreadsheeteditor', 'deploy-presentationeditor']);
};

View file

@ -6,7 +6,6 @@
"dependencies": {
"lodash": "^4.0.0",
"grunt": "0.4.5",
"grunt-exec": "0.4.5",
"grunt-replace": "0.7.3",
"grunt-html-minify": "0.3.1",
"grunt-text-replace": "0.3.11",