From 0fd5078cf9b57a18a9f6c126eb14181354529360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 5 May 2022 13:41:27 +0200 Subject: [PATCH] MOBILE-4061 behat: Group all moodleappbehat plugin files --- .../classes/output/mobile.php | 0 .../classes/privacy/provider.php | 0 .../db/mobile.php | 0 .../js/mobile/index.js | 0 .../lang/en/local_moodleappbehat.php | 0 .../tests}/behat/app_behat_runtime.js | 0 .../tests}/behat/behat_app.php | 0 .../tests}/behat/behat_performance.php | 0 .../behat/classes/performance_measure.php | 0 .../version.php | 0 scripts/build-behat-plugin.js | 23 ++++++++----------- 11 files changed, 10 insertions(+), 13 deletions(-) rename {scripts/templates/behat-plugin => local-moodleappbehat}/classes/output/mobile.php (100%) rename {scripts/templates/behat-plugin => local-moodleappbehat}/classes/privacy/provider.php (100%) rename {scripts/templates/behat-plugin => local-moodleappbehat}/db/mobile.php (100%) rename {scripts/templates/behat-plugin => local-moodleappbehat}/js/mobile/index.js (100%) rename {scripts/templates/behat-plugin => local-moodleappbehat}/lang/en/local_moodleappbehat.php (100%) rename {tests => local-moodleappbehat/tests}/behat/app_behat_runtime.js (100%) rename {tests => local-moodleappbehat/tests}/behat/behat_app.php (100%) rename {tests => local-moodleappbehat/tests}/behat/behat_performance.php (100%) rename {tests => local-moodleappbehat/tests}/behat/classes/performance_measure.php (100%) rename {scripts/templates/behat-plugin => local-moodleappbehat}/version.php (100%) diff --git a/scripts/templates/behat-plugin/classes/output/mobile.php b/local-moodleappbehat/classes/output/mobile.php similarity index 100% rename from scripts/templates/behat-plugin/classes/output/mobile.php rename to local-moodleappbehat/classes/output/mobile.php diff --git a/scripts/templates/behat-plugin/classes/privacy/provider.php b/local-moodleappbehat/classes/privacy/provider.php similarity index 100% rename from scripts/templates/behat-plugin/classes/privacy/provider.php rename to local-moodleappbehat/classes/privacy/provider.php diff --git a/scripts/templates/behat-plugin/db/mobile.php b/local-moodleappbehat/db/mobile.php similarity index 100% rename from scripts/templates/behat-plugin/db/mobile.php rename to local-moodleappbehat/db/mobile.php diff --git a/scripts/templates/behat-plugin/js/mobile/index.js b/local-moodleappbehat/js/mobile/index.js similarity index 100% rename from scripts/templates/behat-plugin/js/mobile/index.js rename to local-moodleappbehat/js/mobile/index.js diff --git a/scripts/templates/behat-plugin/lang/en/local_moodleappbehat.php b/local-moodleappbehat/lang/en/local_moodleappbehat.php similarity index 100% rename from scripts/templates/behat-plugin/lang/en/local_moodleappbehat.php rename to local-moodleappbehat/lang/en/local_moodleappbehat.php diff --git a/tests/behat/app_behat_runtime.js b/local-moodleappbehat/tests/behat/app_behat_runtime.js similarity index 100% rename from tests/behat/app_behat_runtime.js rename to local-moodleappbehat/tests/behat/app_behat_runtime.js diff --git a/tests/behat/behat_app.php b/local-moodleappbehat/tests/behat/behat_app.php similarity index 100% rename from tests/behat/behat_app.php rename to local-moodleappbehat/tests/behat/behat_app.php diff --git a/tests/behat/behat_performance.php b/local-moodleappbehat/tests/behat/behat_performance.php similarity index 100% rename from tests/behat/behat_performance.php rename to local-moodleappbehat/tests/behat/behat_performance.php diff --git a/tests/behat/classes/performance_measure.php b/local-moodleappbehat/tests/behat/classes/performance_measure.php similarity index 100% rename from tests/behat/classes/performance_measure.php rename to local-moodleappbehat/tests/behat/classes/performance_measure.php diff --git a/scripts/templates/behat-plugin/version.php b/local-moodleappbehat/version.php similarity index 100% rename from scripts/templates/behat-plugin/version.php rename to local-moodleappbehat/version.php diff --git a/scripts/build-behat-plugin.js b/scripts/build-behat-plugin.js index 810243ac6..1d0570d7b 100755 --- a/scripts/build-behat-plugin.js +++ b/scripts/build-behat-plugin.js @@ -46,23 +46,20 @@ async function main() { // Copy plugin template. const { version: appVersion } = require(projectPath('package.json')); - const templatePath = projectPath('scripts/templates/behat-plugin'); + const templatePath = projectPath('local-moodleappbehat'); + + + copySync(templatePath, pluginPath); + + // Update version.php + const pluginFilePath = pluginPath + '/version.php'; + const fileContents = readFileSync(pluginFilePath).toString(); + const replacements = { appVersion, pluginVersion: getMoodlePluginVersion(), }; - - copySync(templatePath, pluginPath); - - for await (const templateFilePath of getDirectoryFiles(templatePath)) { - const pluginFilePath = pluginPath + templateFilePath.substr(templatePath.length); - const fileContents = readFileSync(pluginFilePath).toString(); - - writeFileSync(pluginFilePath, replaceArguments(fileContents, replacements)); - } - - // Copy plugin files. - copySync(projectPath('tests/behat'), `${pluginPath}/tests/behat`); + writeFileSync(pluginFilePath, replaceArguments(fileContents, replacements)); // Copy feature files. const behatTempFeaturesPath = `${pluginPath}/behat-tmp`;