diff --git a/.gitignore b/.gitignore index 208178d22d..ac144ce26c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,9 +13,6 @@ # Exclude node.js dependencies folder /node_modules -# Exclude compiled LESS folder -/www/skins/build - # Exclude compiled javascript test fixture folder /www/scripts/tests/fixtures diff --git a/Makefile b/Makefile index d324352438..840ea663f0 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,7 @@ install: php bin/console system:clear-cache npm install composer install -o - ./node_modules/.bin/grunt install-assets php bin/console system:clear-cache - php bin/developer assets:compile-less config: @php bin/console compile:configuration diff --git a/bin/developer b/bin/developer index 86fae9fce6..0f71e8e3d7 100755 --- a/bin/developer +++ b/bin/developer @@ -13,9 +13,7 @@ use Alchemy\Phrasea\CLI; use Alchemy\Phrasea\Core\Version; use Alchemy\Phrasea\Command\Developer\APIRoutesDumper; use Alchemy\Phrasea\Command\Developer\Behat; -use Alchemy\Phrasea\Command\Developer\BowerInstall; use Alchemy\Phrasea\Command\Developer\ComposerInstall; -use Alchemy\Phrasea\Command\Developer\LessCompiler; use Alchemy\Phrasea\Command\Developer\IniReset; use Alchemy\Phrasea\Command\Developer\InstallAll; use Alchemy\Phrasea\Command\Developer\JsFixtures; @@ -71,13 +69,11 @@ $cli = new CLI(" $cli->command(new TranslationDumper()); $cli->command(new InstallAll()); -$cli->command(new BowerInstall()); $cli->command(new ComposerInstall()); $cli->command(new RegenerateSqliteDb()); $cli->command(new APIRoutesDumper()); $cli->command(new RoutesDumper()); $cli->command(new Behat()); -$cli->command(new LessCompiler()); $cli->command(new Uninstaller()); $cli->command(new JsFixtures()); $cli->command(new IniReset()); diff --git a/config/configuration.sample.yml b/config/configuration.sample.yml index 2dacef0004..098101f1a3 100644 --- a/config/configuration.sample.yml +++ b/config/configuration.sample.yml @@ -53,7 +53,6 @@ main: ffprobe_binary: null mp4box_binary: null pdftotext_binary: null - recess_binary: null ffmpeg_timeout: 3600 ffprobe_timeout: 60 gs_timeout: 60 diff --git a/lib/Alchemy/Phrasea/CLI.php b/lib/Alchemy/Phrasea/CLI.php index 52803b6463..10e869ec3b 100644 --- a/lib/Alchemy/Phrasea/CLI.php +++ b/lib/Alchemy/Phrasea/CLI.php @@ -20,7 +20,6 @@ use Symfony\Component\Console; use Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider; use Alchemy\Phrasea\Core\CLIProvider\ComposerSetupServiceProvider; use Alchemy\Phrasea\Core\CLIProvider\DoctrineMigrationServiceProvider; -use Alchemy\Phrasea\Core\CLIProvider\LessBuilderServiceProvider; use Alchemy\Phrasea\Core\CLIProvider\PluginServiceProvider; use Alchemy\Phrasea\Core\CLIProvider\SignalHandlerServiceProvider; use Alchemy\Phrasea\Core\CLIProvider\TaskManagerServiceProvider; @@ -68,7 +67,6 @@ class CLI extends Application $this->register(new PluginServiceProvider()); $this->register(new ComposerSetupServiceProvider()); $this->register(new CLIDriversServiceProvider()); - $this->register(new LessBuilderServiceProvider()); $this->register(new SignalHandlerServiceProvider()); $this->register(new TaskManagerServiceProvider()); $this->register(new TranslationExtractorServiceProvider()); diff --git a/lib/Alchemy/Phrasea/Command/Developer/BowerInstall.php b/lib/Alchemy/Phrasea/Command/Developer/BowerInstall.php deleted file mode 100644 index c679ad0dec..0000000000 --- a/lib/Alchemy/Phrasea/Command/Developer/BowerInstall.php +++ /dev/null @@ -1,78 +0,0 @@ -setDescription('Installs bower dependencies') - ->addOption('no-dev', 'd', InputOption::VALUE_NONE, 'Do not install dev dependencies') - ->addOption('clear-cache', null, InputOption::VALUE_NONE, 'If defined forces to clear the cache before installation'); - } - - protected function doExecute(InputInterface $input, OutputInterface $output) - { - $grunt = $this->container['driver.grunt']; - $grunt->getProcessBuilderFactory()->setTimeout(600); - - $bower = $this->container['driver.bower']; - - $output->writeln("Using ".$grunt->getProcessBuilderFactory()->getBinary()." for driver"); - $output->writeln("Using ".$bower->getProcessBuilderFactory()->getBinary()." for driver"); - - $version = trim($bower->command('-v')); - - if (version::lt($version, '1.0.0-alpha.1')) { - throw new RuntimeException(sprintf( - 'Bower version 1.0.0-alpha.1 is required (version %s provided), please install bower-canary : `npm install -g bower-canary or run npm install from root directory`', $version - )); - } - - $version = trim($grunt->command('--version')); - - if (!version_compare('0.4.0', substr($version, -5), '<=')) { - throw new RuntimeException(sprintf( - 'Grunt version >= 0.4.0 is required (version %s provided), please install grunt `http://gruntjs.com/getting-started`', $version - )); - } - - if ($input->getOption('clear-cache')) { - $output->write("Cleaning bower cache... "); - $bower->command(['cache', 'clean']); - $output->writeln("OK"); - } - - try { - $output->write("Installing assets..."); - $grunt->command('install-assets'); - $output->write(" OK"); - $output->writeln(""); - $this->container['console']->get('assets:compile-less')->execute($input, $output); - } catch (ExecutionFailureException $e) { - throw new RuntimeException('Unable to install bower dependencies', $e->getCode(), $e); - } - - return 0; - } -} diff --git a/lib/Alchemy/Phrasea/Command/Developer/InstallAll.php b/lib/Alchemy/Phrasea/Command/Developer/InstallAll.php index 8fc6c3c5b1..b3dc333d5a 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/InstallAll.php +++ b/lib/Alchemy/Phrasea/Command/Developer/InstallAll.php @@ -34,7 +34,6 @@ class InstallAll extends Command $ret = 0; $ret += $this->container['console']->get('dependencies:composer')->execute($input, $output); - $ret += $this->container['console']->get('dependencies:bower')->execute($input, $output); return min($ret, 255); } diff --git a/lib/Alchemy/Phrasea/Command/Developer/LessCompiler.php b/lib/Alchemy/Phrasea/Command/Developer/LessCompiler.php deleted file mode 100644 index 07391cb9c7..0000000000 --- a/lib/Alchemy/Phrasea/Command/Developer/LessCompiler.php +++ /dev/null @@ -1,45 +0,0 @@ -setDescription('Compiles Phraseanet LESS files'); - } - - /** - * {@inheritdoc} - */ - protected function doExecute(InputInterface $input, OutputInterface $output) - { - foreach ($this->container['phraseanet.less-assets'] as $source => $target) { - $this->container['filesystem']->mkdir(dirname($target)); - $this->container['filesystem']->copy($source, $target); - } - - $output->writeln('Building LESS assets'); - $this->container['phraseanet.less-builder']->build($this->container['phraseanet.less-mapping'], $output); - - return 0; - } -} diff --git a/lib/Alchemy/Phrasea/Command/Developer/Utils/BowerDriver.php b/lib/Alchemy/Phrasea/Command/Developer/Utils/BowerDriver.php deleted file mode 100644 index 48628daee3..0000000000 --- a/lib/Alchemy/Phrasea/Command/Developer/Utils/BowerDriver.php +++ /dev/null @@ -1,45 +0,0 @@ -get('bower.binaries', ['bower']); - - return static::load($binaries, $logger, $conf); - } -} diff --git a/lib/Alchemy/Phrasea/Command/Developer/Utils/GruntDriver.php b/lib/Alchemy/Phrasea/Command/Developer/Utils/GruntDriver.php deleted file mode 100644 index 51956c1cf1..0000000000 --- a/lib/Alchemy/Phrasea/Command/Developer/Utils/GruntDriver.php +++ /dev/null @@ -1,48 +0,0 @@ -get('grunt.binaries', ['grunt']); - - $driver = static::load($binaries, $logger, $conf); - $driver->getProcessBuilderFactory()->getBuilder()->setWorkingDirectory(__DIR__.'/../../../../../..'); - - return $driver; - } -} diff --git a/lib/Alchemy/Phrasea/Command/Developer/Utils/RecessDriver.php b/lib/Alchemy/Phrasea/Command/Developer/Utils/RecessDriver.php deleted file mode 100644 index f4e5db4abd..0000000000 --- a/lib/Alchemy/Phrasea/Command/Developer/Utils/RecessDriver.php +++ /dev/null @@ -1,45 +0,0 @@ -get('recess.binaries', ['recess']); - - return static::load($binaries, $logger, $conf); - } -} diff --git a/lib/Alchemy/Phrasea/Command/Developer/Utils/UglifyJsDriver.php b/lib/Alchemy/Phrasea/Command/Developer/Utils/UglifyJsDriver.php deleted file mode 100644 index cf6a0f5b88..0000000000 --- a/lib/Alchemy/Phrasea/Command/Developer/Utils/UglifyJsDriver.php +++ /dev/null @@ -1,45 +0,0 @@ -get('uglifyjs.binaries', ['uglifyjs']); - - return static::load($binaries, $logger, $conf); - } -} diff --git a/lib/Alchemy/Phrasea/Command/Plugin/AbstractPluginCommand.php b/lib/Alchemy/Phrasea/Command/Plugin/AbstractPluginCommand.php index c12bc83ca6..915054c24b 100644 --- a/lib/Alchemy/Phrasea/Command/Plugin/AbstractPluginCommand.php +++ b/lib/Alchemy/Phrasea/Command/Plugin/AbstractPluginCommand.php @@ -50,9 +50,5 @@ abstract class AbstractPluginCommand extends Command $output->write("Updating config files..."); $this->container['plugins.autoloader-generator']->write($manifests); $output->writeln(" OK"); - - $output->write('Building LESS assets ...'); - $this->container['phraseanet.less-builder']->build($this->container['phraseanet.less-mapping.customizable']); - $output->writeln(" OK"); } } diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index 51557641ef..6b2ecabad9 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -311,7 +311,6 @@ class Install extends Command 'mp4box_binary' => $this->executableFinder->find('MP4Box'), 'pdftotext_binary' => $this->executableFinder->find('pdftotext'), 'ghostscript_binary' => $this->executableFinder->find('gs'), - 'recess_binary' => $this->executableFinder->find('recess'), ]; } } diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php index f783e52787..39c91128b6 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php @@ -323,7 +323,6 @@ class V1Controller extends Controller 'ffprobe' => isset($binaries['ffprobe_binary']) ? $binaries['ffprobe_binary'] : null, 'mp4box' => isset($binaries['mp4box_binary']) ? $binaries['mp4box_binary'] : null, 'pdftotext' => isset($binaries['pdftotext_binary']) ? $binaries['pdftotext_binary'] : null, - 'recess' => isset($binaries['recess_binary']) ? $binaries['recess_binary'] : null, 'pdfmaxpages' => $conf->get(['registry', 'executables', 'pdf-max-pages']), ], 'mainConfiguration' => [ diff --git a/lib/Alchemy/Phrasea/Controller/SetupController.php b/lib/Alchemy/Phrasea/Controller/SetupController.php index c45c07ede5..af89540ef9 100644 --- a/lib/Alchemy/Phrasea/Controller/SetupController.php +++ b/lib/Alchemy/Phrasea/Controller/SetupController.php @@ -169,7 +169,6 @@ class SetupController extends Controller 'ffmpeg_binary' => $request->request->get('binary_ffmpeg'), 'mp4box_binary' => $request->request->get('binary_MP4Box'), 'pdftotext_binary' => $request->request->get('binary_xpdf'), - 'recess_binary' => $request->request->get('binary_recess'), ] as $key => $path) { $binaryData[$key] = $path; } diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/CLIDriversServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/CLIDriversServiceProvider.php index 9f9c4a331c..148d0db870 100644 --- a/lib/Alchemy/Phrasea/Core/CLIProvider/CLIDriversServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/CLIProvider/CLIDriversServiceProvider.php @@ -11,11 +11,7 @@ namespace Alchemy\Phrasea\Core\CLIProvider; -use Alchemy\Phrasea\Command\Developer\Utils\BowerDriver; use Alchemy\Phrasea\Command\Developer\Utils\ComposerDriver; -use Alchemy\Phrasea\Command\Developer\Utils\GruntDriver; -use Alchemy\Phrasea\Command\Developer\Utils\RecessDriver; -use Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver; use Alchemy\Phrasea\Exception\RuntimeException; use Silex\Application; use Silex\ServiceProviderInterface; @@ -47,26 +43,6 @@ class CLIDriversServiceProvider implements ServiceProviderInterface return $app['executable-finder']->find($name, null, $extraDirs); }); - $app['driver.bower'] = $app->share(function (Application $app) { - $bowerBinary = $app['driver.binary-finder']('bower', 'bower_binary'); - - if (null === $bowerBinary) { - throw new RuntimeException('Unable to find bower executable.'); - } - - return BowerDriver::create(['bower.binaries' => $bowerBinary, 'timeout' => 300], $app['monolog']); - }); - - $app['driver.recess'] = $app->share(function (Application $app) { - $recessBinary = $app['driver.binary-finder']('recess', 'recess_binary'); - - if (null === $recessBinary) { - throw new RuntimeException('Unable to find recess executable.'); - } - - return RecessDriver::create(['recess.binaries' => $recessBinary], $app['monolog']); - }); - $app['driver.composer'] = $app->share(function (Application $app) { $composerBinary = $app['driver.binary-finder']('composer', 'composer_binary'); @@ -76,26 +52,6 @@ class CLIDriversServiceProvider implements ServiceProviderInterface return ComposerDriver::create(['composer.binaries' => $composerBinary, 'timeout' => 300], $app['monolog']); }); - - $app['driver.uglifyjs'] = $app->share(function (Application $app) { - $uglifyJsBinary = $app['driver.binary-finder']('uglifyjs', 'uglifyjs_binary'); - - if (null === $uglifyJsBinary) { - throw new RuntimeException('Unable to find uglifyJs executable.'); - } - - return UglifyJsDriver::create(['uglifyjs.binaries' => $uglifyJsBinary], $app['monolog']); - }); - - $app['driver.grunt'] = $app->share(function (Application $app) { - $gruntBinary = $app['driver.binary-finder']('grunt', 'grunt_binary'); - - if (null === $gruntBinary) { - throw new RuntimeException('Unable to find grunt executable.'); - } - - return GruntDriver::create(['grunt.binaries' => $gruntBinary], $app['monolog']); - }); } public function boot(Application $app) diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/LessBuilderServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/LessBuilderServiceProvider.php deleted file mode 100644 index 88696f0ccf..0000000000 --- a/lib/Alchemy/Phrasea/Core/CLIProvider/LessBuilderServiceProvider.php +++ /dev/null @@ -1,60 +0,0 @@ -share(function ($app) { - return [ - $app['root.path'] . '/www/assets/bootstrap/img/glyphicons-halflings-white.png' => $app['root.path'] . '/www/skins/build/bootstrap/img/glyphicons-halflings-white.png', - $app['root.path'] . '/www/assets/bootstrap/img/glyphicons-halflings.png' => $app['root.path'] . '/www/skins/build/bootstrap/img/glyphicons-halflings.png', - ]; - }); - - $app['phraseanet.less-mapping.base'] = $app->share(function ($app) { - return []; - }); - - $app['phraseanet.less-mapping.customizable'] = $app->share(function ($app) { - return [ - $app['root.path'] . '/www/skins/login/less/login.less' => $app['root.path'] . '/www/assets/build/login.css', - $app['root.path'] . '/www/skins/account/less/account.less' => $app['root.path'] . '/www/assets/build/account.css', - ]; - }); - - $app['phraseanet.less-mapping'] = $app->share(function ($app) { - return array_merge( - $app['phraseanet.less-mapping.base'], - $app['phraseanet.less-mapping.customizable'] - ); - }); - - $app['phraseanet.less-compiler'] = $app->share(function ($app) { - return new LessCompiler($app['filesystem'], $app['driver.recess']); - }); - - $app['phraseanet.less-builder'] = $app->share(function ($app) { - return new LessBuilder($app['phraseanet.less-compiler'], $app['filesystem']); - }); - } - - public function boot(Application $app) - { - } -} diff --git a/lib/Alchemy/Phrasea/Plugin/Management/AutoloaderGenerator.php b/lib/Alchemy/Phrasea/Plugin/Management/AutoloaderGenerator.php index a2a88743da..a79c6811b0 100644 --- a/lib/Alchemy/Phrasea/Plugin/Management/AutoloaderGenerator.php +++ b/lib/Alchemy/Phrasea/Plugin/Management/AutoloaderGenerator.php @@ -30,8 +30,8 @@ class AutoloaderGenerator ->doWrite('services.php', $this->createServices($manifests)) ->doWrite('commands.php', $this->createCommands($manifests)) ->doWrite('twig-paths.php', $this->createTwigPathsMap($manifests)) - ->doWrite('login.less', $this->createLoginLess($manifests)) - ->doWrite('account.less', $this->createAccountLess($manifests)); + ->doWrite('login.scss', $this->createLoginStylesheet($manifests)) + ->doWrite('account.scss', $this->createAccountStylesheet($manifests)); return $this; } @@ -40,16 +40,16 @@ class AutoloaderGenerator * @param Manifest[] $manifests * @return string */ - private function createLoginLess($manifests) + private function createLoginStylesheet($manifests) { $buffer = <<pluginDirectory . DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . 'less' . DIRECTORY_SEPARATOR . 'login.less'; + $filepath = $this->pluginDirectory . DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . 'scss' . DIRECTORY_SEPARATOR . 'login.scss'; if (is_file($filepath)) { - $relativePath = $manifest->getName() . DIRECTORY_SEPARATOR . 'less' . DIRECTORY_SEPARATOR . 'login.less'; + $relativePath = $manifest->getName() . DIRECTORY_SEPARATOR . 'scss' . DIRECTORY_SEPARATOR . 'login.scss'; $buffer .= <<pluginDirectory . DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . 'less' . DIRECTORY_SEPARATOR . 'account.less'; + $filepath = $this->pluginDirectory . DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . 'scss' . DIRECTORY_SEPARATOR . 'account.scss'; if (is_file($filepath)) { - $relativePath = $manifest->getName() . DIRECTORY_SEPARATOR . 'less' . DIRECTORY_SEPARATOR . 'account.less'; + $relativePath = $manifest->getName() . DIRECTORY_SEPARATOR . 'scss' . DIRECTORY_SEPARATOR . 'account.scss'; $buffer .= << isset($binaries['pdftotext_binary']) ? $binaries['pdftotext_binary'] : null, 'ffmpeg_binary' => isset($binaries['ffmpeg_binary']) ? $binaries['ffmpeg_binary'] : null, 'ffprobe_binary' => isset($binaries['ffprobe_binary']) ? $binaries['ffprobe_binary'] : null, - 'recess_binary' => isset($binaries['recess_binary']) ? $binaries['recess_binary'] : null, ])); } diff --git a/lib/Alchemy/Phrasea/Setup/Requirements/BinariesRequirements.php b/lib/Alchemy/Phrasea/Setup/Requirements/BinariesRequirements.php index 4c1c32b8a6..a397757bee 100644 --- a/lib/Alchemy/Phrasea/Setup/Requirements/BinariesRequirements.php +++ b/lib/Alchemy/Phrasea/Setup/Requirements/BinariesRequirements.php @@ -215,13 +215,5 @@ class BinariesRequirements extends RequirementCollection implements RequirementI 'FFProbe (or avprobe) is required for Video processing', 'Please install FFProbe (or avprobe)' ); - - $recess = isset($binaries['recess_binary']) ? $binaries['recess_binary'] : $finder->find('recess'); - - $this->addRecommendation( - null !== $recess && is_executable($recess), - 'Recess is required for compiling css or less files.', - 'Please install Recess (https://github.com/twitter/recess)' - ); } } diff --git a/lib/Alchemy/Phrasea/Utilities/Less/Builder.php b/lib/Alchemy/Phrasea/Utilities/Less/Builder.php deleted file mode 100644 index 827c5ffdff..0000000000 --- a/lib/Alchemy/Phrasea/Utilities/Less/Builder.php +++ /dev/null @@ -1,52 +0,0 @@ -compiler = $compiler; - $this->filesystem = $filesystem; - } - - /** - * Build LESS files - * - * @param array $files - * - * @throws RuntimeException - */ - public function build($files, OutputInterface $output = null) - { - foreach ($files as $lessFile => $target) { - $this->filesystem->mkdir(dirname($target)); - if (null !== $output) { - $output->writeln(" Building " . basename($target) . "... OK"); - } - $this->compiler->compile($target, $lessFile); - } - } -} diff --git a/lib/Alchemy/Phrasea/Utilities/Less/Compiler.php b/lib/Alchemy/Phrasea/Utilities/Less/Compiler.php deleted file mode 100644 index d8a26e2376..0000000000 --- a/lib/Alchemy/Phrasea/Utilities/Less/Compiler.php +++ /dev/null @@ -1,68 +0,0 @@ -filesystem = $filesystem; - $this->recess = $recess; - } - - /** - * Compile LESS files - * - * @param string $target - * @param string $files - * - * @throws RuntimeException - */ - public function compile($target, $files) - { - $this->filesystem->mkdir(dirname($target)); - - if (!$files instanceof \Traversable) { - $files = new \ArrayObject(is_array($files) ? $files : [$files]); - } - - $files = (array) $files; - - foreach ($files as $file) { - if (false === is_file($file)) { - throw new RuntimeException($file . ' does not exists.'); - } - } - - if (!is_writable(dirname($target))) { - throw new RuntimeException(dirname($target) . ' is not writable.'); - } - - $commands = $files; - array_unshift($commands, '--compile'); - - try { - $output = $this->recess->command($commands); - $this->filesystem->dumpFile($target, $output); - } catch (ExecutionFailureException $e) { - throw new RuntimeException('Could not execute recess command.', $e->getCode(), $e); - } - } -} diff --git a/lib/classes/setup.php b/lib/classes/setup.php index 0564f9c8d3..641ac393d5 100644 --- a/lib/classes/setup.php +++ b/lib/classes/setup.php @@ -59,10 +59,6 @@ class setup 'name' => 'FFmpeg', 'binary' => $finder->find('ffmpeg') ], - 'recess' => [ - 'name' => 'Recesss', - 'binary' => $finder->find('recess') - ], ]; } } diff --git a/lib/conf.d/configuration.yml b/lib/conf.d/configuration.yml index 9e48276ba4..371b7b1d02 100644 --- a/lib/conf.d/configuration.yml +++ b/lib/conf.d/configuration.yml @@ -53,7 +53,6 @@ main: ffprobe_binary: null mp4box_binary: null pdftotext_binary: null - recess_binary: null ffmpeg_timeout: 3600 ffprobe_timeout: 60 gs_timeout: 60 diff --git a/resources/vagrant/config/phraseanet/configuration.yml b/resources/vagrant/config/phraseanet/configuration.yml index 3237c114e2..f897cfe0ce 100644 --- a/resources/vagrant/config/phraseanet/configuration.yml +++ b/resources/vagrant/config/phraseanet/configuration.yml @@ -60,7 +60,6 @@ main: ffprobe_binary: null mp4box_binary: null pdftotext_binary: null - recess_binary: null ffmpeg_timeout: 3600 ffprobe_timeout: 60 gs_timeout: 60 diff --git a/resources/vagrant/vms/phraseanet-php55-nginx/puphpet/files/exec-once/setup b/resources/vagrant/vms/phraseanet-php55-nginx/puphpet/files/exec-once/setup index 81b2b072fe..19a93088d3 100644 --- a/resources/vagrant/vms/phraseanet-php55-nginx/puphpet/files/exec-once/setup +++ b/resources/vagrant/vms/phraseanet-php55-nginx/puphpet/files/exec-once/setup @@ -70,9 +70,6 @@ find . -maxdepth 1 -type f -exec rm {} \; sudo cp -rf * /usr/local/ # npm binaries -sudo npm install -g recess -sudo npm install -g bower -sudo npm install -g uglify-js #twig cd /tmp diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/BowerInstallTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/BowerInstallTest.php deleted file mode 100644 index a63e99589c..0000000000 --- a/tests/Alchemy/Tests/Phrasea/Command/Developper/BowerInstallTest.php +++ /dev/null @@ -1,78 +0,0 @@ -getMock('Symfony\Component\Console\Input\InputInterface'); - $output = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); - - self::$DI['cli']['filesystem'] = $this->getMockBuilder('Symfony\Component\Filesystem\Filesystem') - ->disableOriginalConstructor() - ->getMock(); - - self::$DI['cli']['driver.bower'] = $this->getMockBuilder('Alchemy\Phrasea\Command\Developer\Utils\BowerDriver') - ->disableOriginalConstructor() - ->getMock(); - - self::$DI['cli']['console'] = $this->getMockBuilder('Symfony\Component\Console\Application') - ->disableOriginalConstructor() - ->getMock(); - - $mockedCommand = $this->getMockBuilder('Symfony\Component\Console\Command\Command') - ->setMethods(['execute']) - ->disableOriginalConstructor() - ->getMock(); - - self::$DI['cli']['console']->expects($this->any()) - ->method('get') - ->will($this->returnValue($mockedCommand)); - - self::$DI['cli']['driver.grunt'] = $this->getMockBuilder('Alchemy\Phrasea\Command\Developer\Utils\GruntDriver') - ->disableOriginalConstructor() - ->getMock(); - - $processBuilder = $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface'); - $processBuilder->expects($this->any()) - ->method('getBinary'); - - self::$DI['cli']['driver.bower']->expects($this->at(0)) - ->method('getProcessBuilderFactory') - ->will($this->returnValue($processBuilder)); - - self::$DI['cli']['driver.bower']->expects($this->at(1)) - ->method('command') - ->with('-v') - ->will($this->returnValue('1.0.0-alpha.5')); - - self::$DI['cli']['driver.grunt']->expects($this->at(0)) - ->method('getProcessBuilderFactory') - ->will($this->returnValue($processBuilder)); - - self::$DI['cli']['driver.grunt']->expects($this->at(1)) - ->method('getProcessBuilderFactory') - ->will($this->returnValue($processBuilder)); - - self::$DI['cli']['driver.grunt']->expects($this->at(2)) - ->method('command') - ->with('--version') - ->will($this->returnValue('4.0.1')); - - self::$DI['cli']['driver.grunt']->expects($this->at(3)) - ->method('command') - ->with('install-assets'); - - $command = new BowerInstall(); - $command->setContainer(self::$DI['cli']); - - $this->assertEquals(0, $command->execute($input, $output)); - } -} diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/InstallAllTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/InstallAllTest.php index 040a8381d3..203a3b27bf 100644 --- a/tests/Alchemy/Tests/Phrasea/Command/Developper/InstallAllTest.php +++ b/tests/Alchemy/Tests/Phrasea/Command/Developper/InstallAllTest.php @@ -21,8 +21,7 @@ class InstallAllTest extends \PhraseanetTestCase $n = 0; foreach ([ - 'dependencies:composer', - 'dependencies:bower' + 'dependencies:composer' ] as $name) { $command = $this->getMockBuilder('Symfony\Component\Console\Command\Command') ->setMethods(['execute']) diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/BowerDriverTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/BowerDriverTest.php deleted file mode 100644 index a570b49f47..0000000000 --- a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/BowerDriverTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\BowerDriver', $driver); - $this->assertEquals('bower', $driver->getName()); - } - - public function testCreateWithCustomBinary() - { - $finder = new PhpExecutableFinder(); - $php = $finder->find(); - - $driver = BowerDriver::create(['bower.binaries' => $php]); - $this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\BowerDriver', $driver); - $this->assertEquals($php, $driver->getProcessBuilderFactory()->getBinary()); - } -} diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php deleted file mode 100644 index 963046a3d9..0000000000 --- a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php +++ /dev/null @@ -1,33 +0,0 @@ -getApplication(); - $app->register(new CLIDriversServiceProvider()); - $driver = GruntDriver::create(['grunt.binaries' => $app['driver.binary-finder']('grunt', 'grunt_binary')]); - $this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\GruntDriver', $driver); - $this->assertEquals('grunt', $driver->getName()); - } - - public function testCreateWithCustomBinary() - { - $finder = new PhpExecutableFinder(); - $php = $finder->find(); - - $driver = GruntDriver::create(['grunt.binaries' => $php]); - $this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\GruntDriver', $driver); - $this->assertEquals($php, $driver->getProcessBuilderFactory()->getBinary()); - } -} diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/RecessDriverTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/RecessDriverTest.php deleted file mode 100644 index 61243f188a..0000000000 --- a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/RecessDriverTest.php +++ /dev/null @@ -1,26 +0,0 @@ -assertInstanceOf('Alchemy\BinaryDriver\BinaryInterface', $recessDriver); - } - - public function testGetName() - { - $recessDriver = RecessDriver::create(); - - $this->assertEquals('recess', $recessDriver->getName()); - } -} diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php deleted file mode 100644 index fedb166caf..0000000000 --- a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php +++ /dev/null @@ -1,33 +0,0 @@ -getApplication(); - $app->register(new CLIDriversServiceProvider()); - $driver = UglifyJsDriver::create(['uglifyjs.binaries' => $app['driver.binary-finder']('uglifyjs', 'uglifyjs_binary')]); - $this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver', $driver); - $this->assertEquals('uglifyjs', $driver->getName()); - } - - public function testCreateWithCustomBinary() - { - $finder = new PhpExecutableFinder(); - $php = $finder->find(); - - $driver = UglifyJsDriver::create(['uglifyjs.binaries' => $php]); - $this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver', $driver); - $this->assertEquals($php, $driver->getProcessBuilderFactory()->getBinary()); - } -} diff --git a/tests/Alchemy/Tests/Phrasea/Controller/MinifierTest.php b/tests/Alchemy/Tests/Phrasea/Controller/MinifierTest.php index 13bae44990..832ee5ddb1 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/MinifierTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/MinifierTest.php @@ -5,6 +5,7 @@ namespace Alchemy\Tests\Phrasea\Controller; /** * @group functional * @group legacy + * @group minify */ class MinifierTest extends \PhraseanetTestCase { @@ -25,23 +26,6 @@ class MinifierTest extends \PhraseanetTestCase $_GET = []; } - /** - * @dataProvider provideGroupsToMinify - */ - public function testGenerationOfGroups($name) - { - $_GET['g'] = $name; - self::$DI['client']->request('GET', '/include/minify/?g=' . $name); - $this->assertTrue(self::$DI['client']->getResponse()->isOk(), "Group $name is ok"); - } - - public function provideGroupsToMinify() - { - $groups = require __DIR__ . '/../../../../../lib/conf.d/minifyGroupsConfig.php'; - - return array_map(function ($group) {return [$group];}, array_keys($groups)); - } - /** * @dataProvider provideFilesToMinify */ @@ -54,17 +38,7 @@ class MinifierTest extends \PhraseanetTestCase public function provideFilesToMinify() { - $files = []; - - $groups = require __DIR__ . '/../../../../../lib/conf.d/minifyGroupsConfig.php'; - - foreach ($groups as $name => $data) { - foreach ($data as $file) { - $files[] = substr($file, 2); - } - } - - return array_map(function ($file) {return [$file];}, array_unique($files)); + return [['scripts/apps/admin/require.config.js']]; } public function testFileMinificationWithoutParamsShouldReturnA400() diff --git a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/CLISDriversServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/CLISDriversServiceProviderTest.php deleted file mode 100644 index acc7007eee..0000000000 --- a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/CLISDriversServiceProviderTest.php +++ /dev/null @@ -1,56 +0,0 @@ -assertEquals(300, $cli['driver.composer']->getProcessBuilderFactory()->getTimeout()); - } - - public function testBowerTimeout() - { - $cli = new CLI('test'); - $this->assertEquals(300, $cli['driver.bower']->getProcessBuilderFactory()->getTimeout()); - } -} diff --git a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/LessBuilderServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/LessBuilderServiceProviderTest.php deleted file mode 100644 index 4f82a0024d..0000000000 --- a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/LessBuilderServiceProviderTest.php +++ /dev/null @@ -1,27 +0,0 @@ -cleanup($files); @@ -73,8 +73,8 @@ class AutoloaderGeneratorTest extends \PhraseanetTestCase $mapping = require $pluginsDir . '/twig-paths.php'; $this->assertSame(['plugin-test-plugin' => realpath($pluginsDir) . '/test-plugin/views', realpath($pluginsDir) . '/test-plugin/views', realpath($pluginsDir) . '/test-plugin/twig-views'], $mapping); - $this->assertRegExp('#@import#', file_get_contents($pluginsDir . '/login.less')); - $this->assertRegExp('#@import#', file_get_contents($pluginsDir . '/account.less')); + $this->assertRegExp('#@import#', file_get_contents($pluginsDir . '/login.scss')); + $this->assertRegExp('#@import#', file_get_contents($pluginsDir . '/account.scss')); $this->cleanup($files); } diff --git a/tests/Alchemy/Tests/Phrasea/Utilities/Less/BuilderTest.php b/tests/Alchemy/Tests/Phrasea/Utilities/Less/BuilderTest.php deleted file mode 100644 index 0a5e8a0073..0000000000 --- a/tests/Alchemy/Tests/Phrasea/Utilities/Less/BuilderTest.php +++ /dev/null @@ -1,27 +0,0 @@ -getMockBuilder('Alchemy\Phrasea\Utilities\Less\Compiler') - ->disableOriginalConstructor() - ->getMock(); - $compiler->expects($this->once())->method('compile'); - - $filesystem = $this->getMock('Symfony\Component\Filesystem\Filesystem'); - $filesystem->expects($this->once())->method('mkdir'); - - $builder = new Builder($compiler, $filesystem); - - $builder->build([ __FILE__ => __DIR__ . '/output.css']); - } -} diff --git a/tests/Alchemy/Tests/Phrasea/Utilities/Less/CompilerTest.php b/tests/Alchemy/Tests/Phrasea/Utilities/Less/CompilerTest.php deleted file mode 100644 index 0171ebdafa..0000000000 --- a/tests/Alchemy/Tests/Phrasea/Utilities/Less/CompilerTest.php +++ /dev/null @@ -1,66 +0,0 @@ -getMockBuilder('Alchemy\Phrasea\Command\Developer\Utils\RecessDriver') - ->disableOriginalConstructor() - ->getMock(); - $recessDriver->expects($this->once())->method('command'); - - $filesystem = $this->getMock('Symfony\Component\Filesystem\Filesystem'); - $filesystem->expects($this->once())->method('mkdir'); - $filesystem->expects($this->once())->method('dumpFile'); - - $compiler = new Compiler($filesystem, $recessDriver); - - $compiler->compile(__DIR__ . '/output.css', __FILE__); - } - - /** - * @expectedException \Alchemy\Phrasea\Exception\RuntimeException - */ - public function testCompileFileNotExists() - { - $recessDriver = $this->getMockBuilder('Alchemy\Phrasea\Command\Developer\Utils\RecessDriver') - ->disableOriginalConstructor() - ->getMock(); - - $filesystem = $this->getMock('Symfony\Component\Filesystem\Filesystem'); - $filesystem->expects($this->once())->method('mkdir'); - - $compiler = new Compiler($filesystem, $recessDriver); - - $compiler->compile(__DIR__ . '/output.css', 'not_existsing_file'); - } - - /** - * @expectedException \Alchemy\Phrasea\Exception\RuntimeException - */ - public function testCompileExecutionFailure() - { - $recessDriver = $this->getMockBuilder('Alchemy\Phrasea\Command\Developer\Utils\RecessDriver') - ->disableOriginalConstructor() - ->getMock(); - - $recessDriver->expects($this->once())->method('command')->will( - $this->throwException(new ExecutionFailureException()) - ); - - $filesystem = $this->getMock('Symfony\Component\Filesystem\Filesystem'); - - $compiler = new Compiler($filesystem, $recessDriver); - - $compiler->compile(__DIR__ . '/output.css', __FILE__); - } -}