Redux changes and refactoring

This commit is contained in:
Scott E. Graves
2019-06-06 15:52:56 -05:00
parent 6502657e3c
commit 0bbfddc17c
9 changed files with 233 additions and 211 deletions

View File

@@ -30,7 +30,7 @@ const tryParse = (j, def) => {
}
};
module.exports.checkDaemonVersion = (version, storageType) => {
module.exports.checkDaemonVersion = (version, provider) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: true,
@@ -41,8 +41,8 @@ module.exports.checkDaemonVersion = (version, storageType) => {
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = [];
args.push('-cv');
if (Constants.PROVIDER_ARG[storageType.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[storageType.toLowerCase()]);
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
const process = new spawn(command, args, processOptions);
@@ -254,7 +254,7 @@ module.exports.executeScript = script => {
});
};
module.exports.executeMount = (version, storageType, location, noConsoleSupported, exitCallback) => {
module.exports.executeMount = (version, provider, location, noConsoleSupported, exitCallback) => {
return new Promise((resolve) => {
const processOptions = {
detached: false,
@@ -264,8 +264,8 @@ module.exports.executeMount = (version, storageType, location, noConsoleSupporte
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = [];
if (Constants.PROVIDER_ARG[storageType.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[storageType.toLowerCase()]);
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
if ((os.platform() === 'linux') || (os.platform() === 'darwin')) {
@@ -299,7 +299,7 @@ module.exports.executeMount = (version, storageType, location, noConsoleSupporte
});
};
module.exports.getConfig = (version, storageType) => {
module.exports.getConfig = (version, provider) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: true,
@@ -310,8 +310,8 @@ module.exports.getConfig = (version, storageType) => {
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = [];
args.push('-dc');
if (Constants.PROVIDER_ARG[storageType.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[storageType.toLowerCase()]);
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
const process = new spawn(command, args, processOptions);
@@ -345,7 +345,7 @@ module.exports.getConfig = (version, storageType) => {
});
};
module.exports.getConfigTemplate = (version, storageType) => {
module.exports.getConfigTemplate = (version, provider) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: true,
@@ -356,8 +356,8 @@ module.exports.getConfigTemplate = (version, storageType) => {
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = [];
args.push('-gt');
if (Constants.PROVIDER_ARG[storageType.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[storageType.toLowerCase()]);
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
const process = new spawn(command, args, processOptions);
@@ -500,7 +500,7 @@ module.exports.removeDirectoryRecursively = (p) => {
module.exports.resolvePath = _resolvePath;
module.exports.setConfigValue = (name, value, storageType, version) => {
module.exports.setConfigValue = (name, value, provider, version) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: true,
@@ -513,8 +513,8 @@ module.exports.setConfigValue = (name, value, storageType, version) => {
args.push('-set');
args.push(name);
args.push(value);
if (Constants.PROVIDER_ARG[storageType.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[storageType.toLowerCase()]);
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
const process = new spawn(command, args, processOptions);
@@ -531,7 +531,7 @@ module.exports.setConfigValue = (name, value, storageType, version) => {
});
};
module.exports.stopMountProcess = (version, storageType) => {
module.exports.stopMountProcess = (version, provider) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: os.platform() === 'darwin',
@@ -541,8 +541,8 @@ module.exports.stopMountProcess = (version, storageType) => {
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = ['-unmount'];
if (Constants.PROVIDER_ARG[storageType.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[storageType.toLowerCase()]);
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
const process = new spawn(command, args, processOptions);
@@ -563,7 +563,7 @@ module.exports.stopMountProcess = (version, storageType) => {
});
};
module.exports.stopMountProcessSync = (version, storageType) => {
module.exports.stopMountProcessSync = (version, provider) => {
const processOptions = {
detached: true,
shell: os.platform() !== 'darwin',
@@ -572,8 +572,8 @@ module.exports.stopMountProcessSync = (version, storageType) => {
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = ['-unmount'];
if (Constants.PROVIDER_ARG[storageType.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[storageType.toLowerCase()]);
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
const process = new spawn(command, args, processOptions);