Skip to content

Commit

Permalink
rename DeDop backend to DeDop core
Browse files Browse the repository at this point in the history
  • Loading branch information
hans-permana committed Aug 30, 2017
1 parent 27c85d8 commit 0875cc3
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ipcMain = electron.ipcMain;
const dialog = electron.dialog;

/**
* Identifies the required version of the Dedop WebAPI.
* Identifies the required version of the DeDop WebAPI.
* The value is a node-semver (https://github.com/npm/node-semver) compatible version range string.
* @type {string}
*/
Expand Down Expand Up @@ -256,9 +256,9 @@ export function init() {
webAPIProcess.on('error', (err: Error) => {
console.error(DEDOP_STUDIO_PREFIX, err);
if (!webAPIError) {
writeToLogFile(`Internal Error - Failed to start Dedop WebAPI service.`);
writeToLogFile(`Internal Error - Failed to start DeDop WebAPI service.`);
electron.dialog.showErrorBox(`${app.getName()} - Internal Error`,
'Failed to start Dedop WebAPI service.');
'Failed to start DeDop WebAPI service.');
}
webAPIError = err;
app.exit(WEBAPI_ERROR); // exit immediately
Expand All @@ -285,8 +285,8 @@ export function init() {
}
// Note we are async here, because sync can take a lot of time...
const webAPIStopArgs = getWebAPIStopArgs(webAPIConfig);
console.log(DEDOP_STUDIO_PREFIX, `Stopping Dedop WebAPI service using arguments: ${webAPIStopArgs}`);
writeToLogFile(`Stopping Dedop WebAPI service using arguments: ${webAPIStopArgs}`);
console.log(DEDOP_STUDIO_PREFIX, `Stopping DeDop WebAPI service using arguments: ${webAPIStopArgs}`);
writeToLogFile(`Stopping DeDop WebAPI service using arguments: ${webAPIStopArgs}`);
childProcess.spawn(webAPIConfig.command, webAPIStopArgs, webAPIConfig.processOptions);
}

Expand All @@ -298,24 +298,24 @@ export function init() {
let webAPIRestUrl = getWebAPIRestUrl(_config.data.webAPIConfig);
console.log(DEDOP_STUDIO_PREFIX, `Waiting for response from ${webAPIRestUrl}`);
writeToLogFile(`Waiting for response from ${webAPIRestUrl}`);
showSplashMessage('Waiting for Dedop backend...');
showSplashMessage('Waiting for DeDop backend service...');
request(webAPIRestUrl, msServiceAccessTimeout)
.then((response: string) => {
console.log(DEDOP_STUDIO_PREFIX, `Response: ${response}`);
writeToLogFile(`Response: ${response}`);
createMainWindow();
})
.catch((err) => {
console.log(DEDOP_STUDIO_PREFIX, `Waiting for Dedop WebAPI service to respond after ${msSpend} ms`);
writeToLogFile(`Waiting for Dedop WebAPI service to respond after ${msSpend} ms`);
console.log(DEDOP_STUDIO_PREFIX, `Waiting for DeDop WebAPI service to respond after ${msSpend} ms`);
writeToLogFile(`Waiting for DeDop WebAPI service to respond after ${msSpend} ms`);
if (!webAPIStarted) {
webAPIProcess = startWebapiService();
}
if (msSpend > msServiceStartTimeout) {
console.error(DEDOP_STUDIO_PREFIX, `Failed to start DeDop WebAPI service within ${msSpend} ms.`);
console.log(DEDOP_STUDIO_PREFIX, `Failed to start DeDop WebAPI service within ${msSpend} ms.`);
if (!webAPIError) {
electron.dialog.showErrorBox(`${app.getName()} - Internal Error`, `Failed to start Dedop backend within ${msSpend} ms.`);
electron.dialog.showErrorBox(`${app.getName()} - Internal Error`, `Failed to start DeDop backend service within ${msSpend} ms.`);
}
app.exit(WEBAPI_TIMEOUT);
} else {
Expand Down Expand Up @@ -542,7 +542,7 @@ function checkWebapiServiceExecutable(callback: (installerPath?: string) => void

const fileNames = fs.readdirSync(app.getAppPath());
const isWin = process.platform === 'win32';
const finder = n => n.startsWith('DeDop-backend') && (isWin ? (n.endsWith('.exe') || n.endsWith('.bat')) : n.endsWith('.sh'));
const finder = n => n.startsWith('DeDop-core') && (isWin ? (n.endsWith('.exe') || n.endsWith('.bat')) : n.endsWith('.sh'));
const installerExeName = fileNames.find(finder);
if (installerExeName) {
const installerPath = path.join(app.getAppPath(), installerExeName);
Expand All @@ -551,11 +551,11 @@ function checkWebapiServiceExecutable(callback: (installerPath?: string) => void
title: `${app.getName()} - Information`,
buttons: ['Cancel', 'OK'],
cancelId: 0,
message: 'About to install missing Dedop back-end.',
detail: 'It seems that Dedop is run for the first time from this installation.\n' +
'Dedop will now install a local (Python) back-end which may take\n' +
message: 'About to install missing DeDop backend.',
detail: 'It seems that DeDop is run for the first time from this installation.\n' +
'DeDop will now install a local (Python) backend which may take\n' +
'some minutes. This is a one-time job and only applies to this\n' +
'Dedop installation, no other computer settings will be changed.',
'DeDop installation, no other computer settings will be changed.',
});
if (response == 0) {
electron.app.exit(WEBAPI_INSTALLER_CANCELLED);
Expand All @@ -569,9 +569,9 @@ function checkWebapiServiceExecutable(callback: (installerPath?: string) => void
type: 'error',
title: `${app.getName()} - Fatal Error`,
buttons: ['Close'],
message: 'Can find neither the required Dedop backend service\n"' +
message: 'Can find neither the required DeDop backend service\n"' +
webAPIConfig.command + '"\n' +
'nor a bundled Dedop Python installer. Application will exit now.',
'nor a bundled DeDop Python installer. Application will exit now.',
});
electron.app.exit(WEBAPI_INSTALLER_MISSING);
return false;
Expand Down Expand Up @@ -603,27 +603,27 @@ function installBackend(installerCommand: string, callback: () => void) {
console.error(DEDOP_STUDIO_PREFIX, `${data}`);
});
installerProcess.on('error', (err: Error) => {
console.log(DEDOP_STUDIO_PREFIX, 'Dedop WebAPI service installation failed', err);
writeToLogFile('Dedop WebAPI service installation failed: ' + err);
console.log(DEDOP_STUDIO_PREFIX, 'DeDop WebAPI service installation failed', err);
writeToLogFile('DeDop WebAPI service installation failed: ' + err);
electron.dialog.showMessageBox({
type: 'error',
title: `${app.getName()} - Fatal Error`,
message: 'Dedop backend installation failed.',
message: 'DeDop WebAPI service installation failed.',
detail: `${err}`
});
app.exit(WEBAPI_INSTALLER_ERROR); // exit immediately
});
installerProcess.on('close', (code: number) => {
console.log(DEDOP_STUDIO_PREFIX, `Dedop WebAPI service installation closed with exit code ${code}`);
writeToLogFile(`Dedop WebAPI service installation closed with exit code ${code}`);
console.log(DEDOP_STUDIO_PREFIX, `DeDop WebAPI service installation closed with exit code ${code}`);
writeToLogFile(`DeDop WebAPI service installation closed with exit code ${code}`);
if (code == 0) {
callback();
return;
}
electron.dialog.showMessageBox({
type: 'error',
title: `${app.getName()} - Fatal Error`,
message: `Dedop backend installation failed with exit code ${code}.`,
message: `DeDop WebAPI service installation failed with exit code ${code}.`,
});
app.exit(WEBAPI_INSTALLER_BAD_EXIT); // exit immediately
});
Expand Down

0 comments on commit 0875cc3

Please sign in to comment.