Refactor pre/post composer script class.

1.10.x
Julio Montoya 10 years ago
parent 1cc169a7f1
commit 5b0e9eebdb
  1. 8
      composer.json
  2. 23
      src/Chamilo/CoreBundle/Component/Theme/DumpTheme.php
  3. 33
      src/Chamilo/CoreBundle/Composer/ScriptHandler.php

@ -86,8 +86,14 @@
"behat/mink-selenium2-driver": "*" "behat/mink-selenium2-driver": "*"
}, },
"scripts": { "scripts": {
"pre-update-cmd": [
"Chamilo\\CoreBundle\\Composer\\ScriptHandler::deleteOldFilesFrom19x"
],
"post-update-cmd": [ "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": [ "post-install-cmd": [
"Chamilo\\CoreBundle\\Component\\Theme\\DumpTheme::dumpCssFiles" "Chamilo\\CoreBundle\\Component\\Theme\\DumpTheme::dumpCssFiles"

@ -1,23 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Component\Theme;
use Symfony\Component\Filesystem\Filesystem;
/**
* Class DumpTheme
*/
class DumpTheme
{
/**
* Dump files
*/
public static function dumpCssFiles()
{
$fs = new Filesystem();
$appCss = __DIR__.'/../../../../../app/Resources/public/css';
$newPath = __DIR__.'/../../../../../web/css';
$fs->mirror($appCss, $newPath);
}
}

@ -0,0 +1,33 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Composer;
use Symfony\Component\Filesystem\Filesystem;
/**
* Class DumpTheme
*/
class ScriptHandler
{
/**
* Dump files to the web/css folder
*/
public static function dumpCssFiles()
{
$appCss = __DIR__.'/../../../../app/Resources/public/css';
$newPath = __DIR__.'/../../../../web/css';
$fs = new Filesystem();
$fs->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);
}
}
Loading…
Cancel
Save