From 8b3e1e4f3cdb7c17ee203b6162acf1f7b0956d21 Mon Sep 17 00:00:00 2001 From: antelle Date: Sat, 2 Apr 2016 14:21:07 +0300 Subject: [PATCH] grunt deb build --- Gruntfile.js | 95 +++++++++++++------------------ grunt/tasks/grunt-get-dir-size.js | 35 ------------ package.json | 16 ++++-- package/deb/DEBIAN/control | 11 ---- 4 files changed, 53 insertions(+), 104 deletions(-) delete mode 100644 grunt/tasks/grunt-get-dir-size.js delete mode 100644 package/deb/DEBIAN/control diff --git a/Gruntfile.js b/Gruntfile.js index 88eb5fec..32172358 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -118,28 +118,9 @@ module.exports = function(grunt) { nonull: true }, 'desktop_linux_deb_x64': { - src: 'tmp/desktop/KeeWeb-linux-deb-x64.deb', + src: 'tmp/desktop/keeweb-desktop_1.0.4-1_amd64.deb', dest: 'dist/desktop/KeeWeb.linux.x64.deb', nonull: true - }, - 'desktop_linux_deb_x64_src': { - cwd: 'package/deb/', - src: '**', - dest: 'tmp/desktop/KeeWeb-linux-deb-x64', - expand: true, - nonull: true - }, - 'desktop_linux_deb_x64_src_files': { - cwd: 'tmp/desktop/KeeWeb-linux-x64/', - src: '**', - dest: 'tmp/desktop/KeeWeb-linux-deb-x64/opt/keeweb-desktop', - expand: true, - nonull: true - }, - 'desktop_linux_deb_x64_src_icon': { - src: 'electron/icon.png', - dest: 'tmp/desktop/KeeWeb-linux-deb-x64/usr/share/icons/hicolor/128x128/apps/keeweb.png', - nonull: true } }, jshint: { @@ -205,15 +186,6 @@ module.exports = function(grunt) { 'desktop_html': { options: { replacements: [{ pattern: ' manifest="manifest.appcache"', replacement: '' }] }, files: { 'tmp/desktop/app/index.html': 'dist/index.html' } - }, - 'desktop_linux_deb_x64': { - options: { - replacements: [ - { pattern: '{ver}', replacement: pkg.version }, - { pattern: '{size}', replacement: '<%= dir_size_linux_x64 %>' } - ] - }, - files: { 'tmp/desktop/KeeWeb-linux-deb-x64/DEBIAN/control': 'package/deb/DEBIAN/control' } } }, webpack: { @@ -400,25 +372,6 @@ module.exports = function(grunt) { } } }, - 'get-dir-size': { - 'desktop_linux_x64': { - files: { 'dir_size_linux_x64': 'tmp/desktop/KeeWeb-linux-x64' } - } - }, - run: { - 'deb_x64': { - options: { - cwd: 'tmp/desktop/', - failOnError: true - }, - cmd: 'fakeroot', - args: [ - 'dpkg-deb', - '--build', - 'KeeWeb-linux-deb-x64' - ] - } - }, compress: { linux64: { options: { archive: 'tmp/desktop/KeeWeb.linux.x64.zip' }, @@ -433,6 +386,45 @@ module.exports = function(grunt) { files: [{ cwd: 'tmp/desktop/app', src: '**', expand: true }] } }, + deb: { + linux64: { + options: { + tmpPath: 'tmp/desktop/', + package: { + name: 'keeweb-desktop', + version: pkg.version, + description: pkg.description, + author: pkg.author, + homepage: pkg.homepage, + rev: function() { return grunt.config.get('gitinfo.local.branch.current.shortSHA'); } + }, + info: { + arch: 'amd64', + targetDir: 'tmp/desktop' + } + }, + files: [ + { + cwd: 'package/deb/usr', + src: '**', + dest: '/usr', + expand: true, + nonull: true + }, + { + cwd: 'tmp/desktop/KeeWeb-linux-x64/', + src: '**', + dest: '/opt/keeweb-desktop', + expand: true, + nonull: true + }, + { + src: 'electron/icon.png', + dest: '/usr/share/icons/hicolor/128x128/apps/keeweb.png', + nonull: true + }] + } + }, 'sign-archive': { 'desktop_update': { options: { @@ -484,14 +476,9 @@ module.exports = function(grunt) { 'validate-desktop-update', 'electron', 'electron_builder', - 'get-dir-size:desktop_linux_x64', - 'copy:desktop_linux_deb_x64_src', - 'copy:desktop_linux_deb_x64_src_files', - 'copy:desktop_linux_deb_x64_src_icon', - 'string-replace:desktop_linux_deb_x64', 'compress:linux64', 'compress:linux32', - 'run:deb_x64', + 'deb:linux64', 'copy:desktop_osx', 'copy:desktop_win', 'copy:desktop_linux_x64', diff --git a/grunt/tasks/grunt-get-dir-size.js b/grunt/tasks/grunt-get-dir-size.js deleted file mode 100644 index cadc323c..00000000 --- a/grunt/tasks/grunt-get-dir-size.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -var getFolderSize = require('get-folder-size'); - -module.exports = function (grunt) { - grunt.registerMultiTask('get-dir-size', 'Signs archive with a private key', function () { - var done = this.async(); - var allPromises = []; - this.files.forEach(function(file) { - var totalSize = 0; - var promises = []; - file.src.forEach(function(src) { - promises.push(new Promise(function(resolve, reject) { - getFolderSize(src, function(err, size) { - if (err) { - grunt.fail.fatal('Error getting folder size', src, err); - reject(err); - } else { - totalSize += size; - resolve(size); - } - }); - })); - }); - allPromises.push(Promise.all(promises).then(function() { - totalSize = Math.round(totalSize / 1024); - grunt.config.set(file.dest, totalSize); - grunt.log.writeln(file.dest + ': ' + totalSize + 'kB'); - })); - }); - Promise.all(allPromises).then(function() { - done(); - }); - }); -}; diff --git a/package.json b/package.json index 31a7f24a..434af4e9 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,13 @@ { "name": "keeweb", "version": "1.0.4", - "description": "KeePass web app", + "description": "Free cross-platform password manager compatible with KeePass", "main": "Gruntfile.js", - "repository": "https://github.com/antelle/keeweb", + "homepage": "https://keeweb.info", + "repository": { + "type": "git", + "url": "https://github.com/antelle/keeweb" + }, "dependencies": {}, "devDependencies": { "base64-loader": "^1.0.0", @@ -16,6 +20,7 @@ "grunt-contrib-clean": "^0.7.0", "grunt-contrib-compress": "^0.14.0", "grunt-contrib-copy": "^0.8.2", + "grunt-contrib-deb": "github:antelle/grunt-contrib-deb#e00e14a", "grunt-contrib-htmlmin": "^0.6.0", "grunt-contrib-jshint": "^0.11.2", "grunt-contrib-uglify": "^0.10.1", @@ -24,7 +29,6 @@ "grunt-gitinfo": "^0.1.7", "grunt-inline-alt": "^0.3.10", "grunt-postcss": "^0.7.1", - "grunt-run": "^0.5.2", "grunt-sass": "^1.1.0", "grunt-string-replace": "^1.2.0", "grunt-webpack": "^1.0.11", @@ -46,7 +50,11 @@ "postinstall": "npm install --prefix electron", "copy-beta": "grunt && sed 's///' dist/index.html > ../keeweb-beta/diy/index.html && cd ../keeweb-beta && git add diy/index.html && git commit -a -m 'beta' && git push origin master" }, - "author": "Antelle", + "author": { + "name": "Antelle", + "email": "antelle.net@gmail.com", + "url": "http://antelle.net" + }, "license": "MIT", "readme": "README.md" } diff --git a/package/deb/DEBIAN/control b/package/deb/DEBIAN/control deleted file mode 100644 index f51b5641..00000000 --- a/package/deb/DEBIAN/control +++ /dev/null @@ -1,11 +0,0 @@ -Package: keeweb-desktop -Version: {ver} -Section: base -Priority: optional -Architecture: amd64 -Maintainer: antelle -Installed-Size: {size} -Homepage: https://keeweb.info/ -Description: KeeWeb - Free cross-platform password manager - compatible with KeePass