From 5b0e9eebdb73772327f7b984c46246b014e22cb0 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 13 May 2015 14:01:45 +0200 Subject: [PATCH] Refactor pre/post composer script class. --- composer.json | 8 ++++- .../CoreBundle/Component/Theme/DumpTheme.php | 23 ------------- .../CoreBundle/Composer/ScriptHandler.php | 33 +++++++++++++++++++ 3 files changed, 40 insertions(+), 24 deletions(-) delete mode 100644 src/Chamilo/CoreBundle/Component/Theme/DumpTheme.php create mode 100644 src/Chamilo/CoreBundle/Composer/ScriptHandler.php diff --git a/composer.json b/composer.json index b02d59eb84..ce548295cf 100755 --- a/composer.json +++ b/composer.json @@ -86,8 +86,14 @@ "behat/mink-selenium2-driver": "*" }, "scripts": { + "pre-update-cmd": [ + "Chamilo\\CoreBundle\\Composer\\ScriptHandler::deleteOldFilesFrom19x" + ], "post-update-cmd": [ - "Chamilo\\CoreBundle\\Component\\Theme\\DumpTheme::dumpCssFiles" + "Chamilo\\CoreBundle\\Composer\\ScriptHandler::dumpCssFiles" + ], + "pre-install-cmd": [ + "Chamilo\\CoreBundle\\Composer\\ScriptHandler::deleteOldFilesFrom19x" ], "post-install-cmd": [ "Chamilo\\CoreBundle\\Component\\Theme\\DumpTheme::dumpCssFiles" diff --git a/src/Chamilo/CoreBundle/Component/Theme/DumpTheme.php b/src/Chamilo/CoreBundle/Component/Theme/DumpTheme.php deleted file mode 100644 index 1b7ac90840..0000000000 --- a/src/Chamilo/CoreBundle/Component/Theme/DumpTheme.php +++ /dev/null @@ -1,23 +0,0 @@ -mirror($appCss, $newPath); - } -} diff --git a/src/Chamilo/CoreBundle/Composer/ScriptHandler.php b/src/Chamilo/CoreBundle/Composer/ScriptHandler.php new file mode 100644 index 0000000000..f855260437 --- /dev/null +++ b/src/Chamilo/CoreBundle/Composer/ScriptHandler.php @@ -0,0 +1,33 @@ +mirror($appCss, $newPath); + } + + /** + * Delete old symfony folder before update (generates conflicts with composer) + */ + public static function deleteOldFilesFrom19x() + { + $path = __DIR__.'/../../../../main/inc/lib/symfony/'; + $fs = new Filesystem(); + $fs->remove($path); + } +}