From 3ce860dcd1e43b6a1ffe88aafa1eafd2df179116 Mon Sep 17 00:00:00 2001 From: exxbrain Date: Tue, 9 Nov 2021 15:56:11 +0300 Subject: [PATCH] feat!: ability to choose temporary directory (#231) --- README.md | 8 ++++++++ lib/ParamedicApp.js | 2 +- lib/ParamedicConfig.js | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b0f80fe..86c8d7d4 100644 --- a/README.md +++ b/README.md @@ -320,6 +320,14 @@ Directory location to store test results in junit format and the device logs cordova-paramedic --platform ios --plugin cordova-plugin-inappbrowser --outputDir /Users/sampleuser/testresults ``` +#### `--tmpDir` (optional) + +A path to a temporary directory where a project will be built. It points to a system temporary directory by default. + +```shell +cordova-paramedic --platform ios --plugin cordova-plugin-inappbrowser --tmpDir ../tmp +``` + #### `--cleanUpAfterRun` (optional) Flag to indicate the sample application folder must be deleted. diff --git a/lib/ParamedicApp.js b/lib/ParamedicApp.js index 45978858..9a39207a 100644 --- a/lib/ParamedicApp.js +++ b/lib/ParamedicApp.js @@ -48,7 +48,7 @@ class ParamedicApp { } createTempProject () { - this.tempFolder = tmp.dirSync(); + this.tempFolder = tmp.dirSync({ tmpdir: this.config.getTmpDir() }); tmp.setGracefulCleanup(); logger.info('cordova-paramedic: creating temp project at ' + this.tempFolder.name); exec(this.config.getCli() + ' create ' + this.tempFolder.name + utilities.PARAMEDIC_COMMON_CLI_ARGS); diff --git a/lib/ParamedicConfig.js b/lib/ParamedicConfig.js index 474bed8a..c46ca076 100644 --- a/lib/ParamedicConfig.js +++ b/lib/ParamedicConfig.js @@ -71,6 +71,14 @@ class ParamedicConfig { this._config.outputDir = outputDir; } + getTmpDir () { + return this._config.tmpDir; + } + + setTmpDir (tmpDir) { + this._config.tmpDir = tmpDir; + } + shouldCleanUpAfterRun () { return this._config.cleanUpAfterRun; } @@ -293,6 +301,7 @@ ParamedicConfig.parseFromArguments = function (argv) { endPort: argv.endport || argv.port, externalServerUrl: argv.externalServerUrl, outputDir: argv.outputDir ? argv.outputDir : null, + tmpDir: argv.tmpDir, logMins: argv.logMins ? argv.logMins : null, tccDb: argv.tccDbPath ? argv.tccDb : null, cleanUpAfterRun: !!argv.cleanUpAfterRun,