fix(core): update

This commit is contained in:
Philipp Kunz 2019-09-03 22:09:30 +02:00
parent c9aa7fed48
commit 615cc6aa7c
3 changed files with 12 additions and 3 deletions

View File

@ -8,4 +8,13 @@ tap.test('should create an instance of smartdaemon', async () => {
expect(testSmartdaemon).to.be.instanceOf(smartdaemon.SmartDaemon); expect(testSmartdaemon).to.be.instanceOf(smartdaemon.SmartDaemon);
}); });
tap.test('should create a service', async () => {
testSmartdaemon.addService({
command: 'npm -v',
description: 'displays the npm version',
name: 'npmversion',
workingDir: __dirname
});
});
tap.start(); tap.start();

View File

@ -33,10 +33,10 @@ export class SmartDaemon {
} else { } else {
serviceToAdd = existingService; serviceToAdd = existingService;
Object.assign(serviceToAdd, optionsArg); Object.assign(serviceToAdd, optionsArg);
await serviceToAdd.save();
} }
await serviceToAdd.save();
return serviceToAdd; return serviceToAdd;
}; }
public async init() { public async init() {
await this.systemdManager.init(); await this.systemdManager.init();

View File

@ -35,7 +35,7 @@ export class SmartDaemonSystemdManager {
if (await this.smartsystem.env.isLinuxAsync()) { if (await this.smartsystem.env.isLinuxAsync()) {
this.shouldExecute = true; this.shouldExecute = true;
} else { } else {
console.log('Smartdaemon can only be used on Linuc systems! Refusing to set up a service.'); console.log('Smartdaemon can only be used on Linux systems! Refusing to set up a service.');
this.shouldExecute = false; this.shouldExecute = false;
} }
return this.shouldExecute; return this.shouldExecute;