speculate
Advanced tools
Comparing version 4.0.1 to 5.0.0
@@ -6,7 +6,7 @@ 'use strict'; | ||
module.exports = { | ||
serviceFileName: function (pkg) { | ||
return `${pkg.name}.service`; | ||
serviceFileName: function (name) { | ||
return `${name}.service`; | ||
}, | ||
serviceFile: function (root, pkg) { | ||
return path.resolve(root, this.serviceFileName(pkg)); | ||
return path.resolve(root, this.serviceFileName(pkg.name)); | ||
}, | ||
@@ -13,0 +13,0 @@ specsDirectory: function (root) { |
@@ -43,5 +43,5 @@ 'use strict'; | ||
function getArchiveWhitelist(pkg) { | ||
function getArchiveWhitelist(pkg, customName) { | ||
return { | ||
service: files.serviceFileName(pkg), | ||
service: files.serviceFileName(customName || pkg.name), | ||
main: pkg.main, | ||
@@ -63,3 +63,3 @@ files: pkg.files | ||
const specFile = generateSpecFile(specsDirectory, customPackage, release); | ||
const archiveWhitelist = getArchiveWhitelist(pkg); | ||
const archiveWhitelist = getArchiveWhitelist(pkg, customName); | ||
@@ -66,0 +66,0 @@ await archiver.compress(root, sourcesArchive, archiveWhitelist); |
{ | ||
"name": "speculate", | ||
"version": "4.0.1", | ||
"version": "5.0.0", | ||
"description": "Automatically generates an RPM Spec file for your Node.js project", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -115,3 +115,3 @@ 'use strict'; | ||
main: 'index.js', | ||
service: 'my-cool-api.service' | ||
service: 'penguin.service' | ||
} | ||
@@ -139,2 +139,20 @@ ); | ||
it('creates the service file with a custom name if specified and "files" defined', async () => { | ||
await generate('/path/to/project', pkgWithWhitelist, null, 'penguin'); | ||
sandbox.assert.calledWith( | ||
archiver.compress, | ||
'/path/to/project', | ||
'/path/to/project/SOURCES/penguin.tar.gz', | ||
{ | ||
main: 'server.js', | ||
files: [ | ||
'lib', | ||
'routes', | ||
'index.js' | ||
], | ||
service: 'penguin.service' | ||
} | ||
); | ||
}); | ||
it('creates the service file with a custom name if specified', async () => { | ||
@@ -141,0 +159,0 @@ await generate('/path/to/project', pkg, 1, 'penguin'); |
66342
1060