pull/281/head
antelle 2016-07-16 21:35:16 +03:00
parent 32a826c8e8
commit 0ec98dde6c
3 changed files with 60 additions and 1 deletions

View File

@ -381,6 +381,26 @@ module.exports = function(grunt) {
dest: 'dist/desktop/KeeWeb.mac.dmg'
}
},
nsis: {
options: {
installScript: 'package/nsis/main.nsi',
vars: {
version: pkg.version,
rev: function() { return grunt.config.get('gitinfo.local.branch.current.shortSHA'); },
homepage: pkg.homepage
}
},
'win32-x64': {
options: {
arch: 'x64'
}
},
'win32-ia32': {
options: {
arch: 'ia32'
}
}
},
deb: {
'linux-x64': {
options: {
@ -513,7 +533,8 @@ module.exports = function(grunt) {
]);
grunt.registerTask('build-desktop-dist-win32', [
// TODO: windows installer
'nsis:win32-x64',
'nsis:win32-ia32'
]);
grunt.registerTask('build-desktop-dist-linux', [

31
grunt/tasks/grunt-nsis.js Normal file
View File

@ -0,0 +1,31 @@
'use strict';
module.exports = function (grunt) {
grunt.registerMultiTask('nsis', 'Launches NSIS installer', function (done) {
let opt = this.options();
let args = [];
Object.keys(opt.vars).forEach(key => {
let value = opt.vars[key];
if (typeof value === 'function') {
value = value();
}
args.push(`-D${key}=${value}`);
});
args.push('-Darch=' + opt.arch);
args.push('-NOCD');
args.push(opt.installScript);
grunt.util.spawn({
cmd: 'makensis',
args: args,
opts: {stdio: 'inherit'}
}, function (error, result, code) {
if (error) {
return grunt.warn('NSIS error: ' + error);
}
if (code) {
return grunt.warn('NSIS exit code ' + code);
}
done();
});
});
};

7
package/nsis/main.nsi Normal file
View File

@ -0,0 +1,7 @@
OutFile dist/desktop/KeeWeb.win32.${arch}.exe
Section
# TODO
SectionEnd