From 6edca5d4a4edd9d46544bc5ac3e341195e477bfd Mon Sep 17 00:00:00 2001 From: Felipe Castillo <1280530+fcastilloec@users.noreply.github.com> Date: Wed, 5 Jun 2019 22:04:13 -0700 Subject: [PATCH] fix: add revision, when present, to output filename (#199) --- README.md | 4 ++-- src/installer.js | 2 +- test/cli.js | 4 ++-- test/fixtures/config.json | 11 +---------- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2d832ef..dd31d4b 100644 --- a/README.md +++ b/README.md @@ -273,9 +273,9 @@ Version number of the package, used in the [`Version` field of the `control` spe #### options.revision Type: `String` -Default: `package.revision || "1"` +Default: `undefined` -Revision number of the package, used in the [`Version` field of the `control` specification](https://www.debian.org/doc/debian-policy/#version). +Revision number of the package, used in the [`Version` field of the `control` specification](https://www.debian.org/doc/debian-policy/#version) and, by default, the filename of the generated `.deb` file. #### options.section Type: `String` diff --git a/src/installer.js b/src/installer.js index f3793ab..160911a 100644 --- a/src/installer.js +++ b/src/installer.js @@ -17,7 +17,7 @@ const spawn = require('./spawn') const defaultLogger = debug('electron-installer-debian') const defaultRename = (dest, src) => { - return path.join(dest, '<%= name %>_<%= version %>_<%= arch %>.deb') + return path.join(dest, '<%= name %>_<%= version %><% if (revision) { %>-<%= revision %><% } %>_<%= arch %>.deb') } /** diff --git a/test/cli.js b/test/cli.js index d8ccb4d..17f720c 100644 --- a/test/cli.js +++ b/test/cli.js @@ -22,9 +22,9 @@ describe('cli', function () { describe('with an app with asar', test => { const outputDir = tempOutputDir() - runCLI({ src: 'test/fixtures/app-with-asar/', dest: outputDir, arch: 'i386' }) + runCLI({ src: 'test/fixtures/app-with-asar/', dest: outputDir, arch: 'i386', config: 'test/fixtures/config.json' }) - it('generates a `.deb` package', () => access(path.join(outputDir, 'footest_0.0.1_i386.deb'))) + it('generates a `.deb` package', () => access(path.join(outputDir, 'footest_0.0.1-2_i386.deb'))) cleanupOutputDir(outputDir) }) diff --git a/test/fixtures/config.json b/test/fixtures/config.json index 342b4ef..60e2a80 100644 --- a/test/fixtures/config.json +++ b/test/fixtures/config.json @@ -1,12 +1,3 @@ { - "productDescription": "Just a test.", - "section": "devel", - "priority": "optional", - "arch": "i386", - "depends" : ["libnss3", "libxtst6", "dbus", "dbus"], - "recommends" : ["pulseaudio | libasound2", "bzip2", "bzip2"], - "suggests" : ["lsb-release", "gvfs", "gvfs"], - "enhances" : ["libc6", "libc6"], - "preDepends" : ["footest", "footest"], - "categories": [] + "revision": "2" }