From 2bc766d242f75f4702f2fda168fbbb9cfe3f2f89 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Fri, 25 Oct 2024 09:47:07 +0200 Subject: [PATCH] add shop version task, group shop dependent tasks into shop group --- README.md | 6 +++--- deploy.php | 32 ++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 51a1092..b32107e 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,10 @@ This command set `current` directory to previous deployment: ## Available tasks -- dep `migrate`[stage] - run all database migrations +- dep `shop:version` [stage] - show version of current OXID installation +- dep `shop:migrate` [stage] - run all database migrations - dep `setup:createDbConfig` [stage] - generate database configuration file - dep `list`- list all available commands ### work in progress -- dep `duplicateDatabase` [stage] - dump contents from source database (live) to destination database (stage) and replace live to stage URLs -- dep `getVersion` [stage] - show version of current WordPress installation +- dep `duplicateDatabase` [stage] - dump contents from source database (live) to destination database (stage) and replace live to stage URLs \ No newline at end of file diff --git a/deploy.php b/deploy.php index 85f0cfa..028f57f 100644 --- a/deploy.php +++ b/deploy.php @@ -20,14 +20,14 @@ task('deploy:d3OxidTasks', [ ]); desc('run all database migrations'); -task('migrate', [ - 'migrate:setShopsOffline', - 'migrate:executeMigrations', - 'migrate:setShopsOnline' +task('shop:migrate', [ + 'shop:setShopsOffline', + 'shop:executeMigrations', + 'shop:setShopsOnline' ]); desc('set shops offline'); -task('migrate:setShopsOffline', function() { +task('shop:setShopsOffline', function() { if (has('bin/mysql') && strlen(get('bin/mysql')) && has('db_name') && strlen(get('db_name')) && has('db_conf_path') && strlen(get('db_conf_path')) && test("[ -f {{db_conf_path}} ]") @@ -39,21 +39,21 @@ task('migrate:setShopsOffline', function() { } }); -task('migrate:failed', function() { - invoke('migrate:setShopsOnline'); +task('shop:migrate:failed', function() { + invoke('shop:setShopsOnline'); })->hidden(); -fail('migrate', 'migrate:failed'); +fail('shop:migrate', 'shop:migrate:failed'); desc('execute OXID Doctrine migrations'); -task('migrate:executeMigrations', function () { +task('shop:executeMigrations', function () { if (test("[ -f {{current_path}}/vendor/bin/oe-eshop-doctrine_migration ]")) { run('{{bin/php}} {{current_path}}/vendor/bin/oe-eshop-doctrine_migration migrations:migrate'); } }); desc('set shops online'); -task('migrate:setShopsOnline', function() { +task('shop:setShopsOnline', function() { if (has('bin/mysql') && strlen(get('bin/mysql')) && has('db_name') && strlen(get('db_name')) && has('db_conf_path') && strlen(get('db_conf_path')) && test("[ -f {{db_conf_path}} ]") @@ -91,3 +91,15 @@ task('setup:createDbConfig', function () { warning($e->getMessage()); } }); + +desc('show OXID shop version'); +task('shop:version', function () { + if (test("[ -f {{current_path}}/composer.lock ]")) { + cd('{{current_path}}'); + info( + run( + '{{bin/composer}} show oxid-esales/oxideshop-ce | grep -ws "versions" | cut -d " " -f 4' + ) + ); + } +});