mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 09:53:15 +00:00
remove recess, bower, grunt and uglifyJs dependencies in php utils and tests
updated minifier tests
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -13,9 +13,6 @@
|
|||||||
# Exclude node.js dependencies folder
|
# Exclude node.js dependencies folder
|
||||||
/node_modules
|
/node_modules
|
||||||
|
|
||||||
# Exclude compiled LESS folder
|
|
||||||
/www/skins/build
|
|
||||||
|
|
||||||
# Exclude compiled javascript test fixture folder
|
# Exclude compiled javascript test fixture folder
|
||||||
/www/scripts/tests/fixtures
|
/www/scripts/tests/fixtures
|
||||||
|
|
||||||
|
2
Makefile
2
Makefile
@@ -4,9 +4,7 @@ install:
|
|||||||
php bin/console system:clear-cache
|
php bin/console system:clear-cache
|
||||||
npm install
|
npm install
|
||||||
composer install -o
|
composer install -o
|
||||||
./node_modules/.bin/grunt install-assets
|
|
||||||
php bin/console system:clear-cache
|
php bin/console system:clear-cache
|
||||||
php bin/developer assets:compile-less
|
|
||||||
|
|
||||||
config:
|
config:
|
||||||
@php bin/console compile:configuration
|
@php bin/console compile:configuration
|
||||||
|
@@ -13,9 +13,7 @@ use Alchemy\Phrasea\CLI;
|
|||||||
use Alchemy\Phrasea\Core\Version;
|
use Alchemy\Phrasea\Core\Version;
|
||||||
use Alchemy\Phrasea\Command\Developer\APIRoutesDumper;
|
use Alchemy\Phrasea\Command\Developer\APIRoutesDumper;
|
||||||
use Alchemy\Phrasea\Command\Developer\Behat;
|
use Alchemy\Phrasea\Command\Developer\Behat;
|
||||||
use Alchemy\Phrasea\Command\Developer\BowerInstall;
|
|
||||||
use Alchemy\Phrasea\Command\Developer\ComposerInstall;
|
use Alchemy\Phrasea\Command\Developer\ComposerInstall;
|
||||||
use Alchemy\Phrasea\Command\Developer\LessCompiler;
|
|
||||||
use Alchemy\Phrasea\Command\Developer\IniReset;
|
use Alchemy\Phrasea\Command\Developer\IniReset;
|
||||||
use Alchemy\Phrasea\Command\Developer\InstallAll;
|
use Alchemy\Phrasea\Command\Developer\InstallAll;
|
||||||
use Alchemy\Phrasea\Command\Developer\JsFixtures;
|
use Alchemy\Phrasea\Command\Developer\JsFixtures;
|
||||||
@@ -71,13 +69,11 @@ $cli = new CLI("
|
|||||||
$cli->command(new TranslationDumper());
|
$cli->command(new TranslationDumper());
|
||||||
|
|
||||||
$cli->command(new InstallAll());
|
$cli->command(new InstallAll());
|
||||||
$cli->command(new BowerInstall());
|
|
||||||
$cli->command(new ComposerInstall());
|
$cli->command(new ComposerInstall());
|
||||||
$cli->command(new RegenerateSqliteDb());
|
$cli->command(new RegenerateSqliteDb());
|
||||||
$cli->command(new APIRoutesDumper());
|
$cli->command(new APIRoutesDumper());
|
||||||
$cli->command(new RoutesDumper());
|
$cli->command(new RoutesDumper());
|
||||||
$cli->command(new Behat());
|
$cli->command(new Behat());
|
||||||
$cli->command(new LessCompiler());
|
|
||||||
$cli->command(new Uninstaller());
|
$cli->command(new Uninstaller());
|
||||||
$cli->command(new JsFixtures());
|
$cli->command(new JsFixtures());
|
||||||
$cli->command(new IniReset());
|
$cli->command(new IniReset());
|
||||||
|
@@ -53,7 +53,6 @@ main:
|
|||||||
ffprobe_binary: null
|
ffprobe_binary: null
|
||||||
mp4box_binary: null
|
mp4box_binary: null
|
||||||
pdftotext_binary: null
|
pdftotext_binary: null
|
||||||
recess_binary: null
|
|
||||||
ffmpeg_timeout: 3600
|
ffmpeg_timeout: 3600
|
||||||
ffprobe_timeout: 60
|
ffprobe_timeout: 60
|
||||||
gs_timeout: 60
|
gs_timeout: 60
|
||||||
|
@@ -20,7 +20,6 @@ use Symfony\Component\Console;
|
|||||||
use Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider;
|
use Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider;
|
||||||
use Alchemy\Phrasea\Core\CLIProvider\ComposerSetupServiceProvider;
|
use Alchemy\Phrasea\Core\CLIProvider\ComposerSetupServiceProvider;
|
||||||
use Alchemy\Phrasea\Core\CLIProvider\DoctrineMigrationServiceProvider;
|
use Alchemy\Phrasea\Core\CLIProvider\DoctrineMigrationServiceProvider;
|
||||||
use Alchemy\Phrasea\Core\CLIProvider\LessBuilderServiceProvider;
|
|
||||||
use Alchemy\Phrasea\Core\CLIProvider\PluginServiceProvider;
|
use Alchemy\Phrasea\Core\CLIProvider\PluginServiceProvider;
|
||||||
use Alchemy\Phrasea\Core\CLIProvider\SignalHandlerServiceProvider;
|
use Alchemy\Phrasea\Core\CLIProvider\SignalHandlerServiceProvider;
|
||||||
use Alchemy\Phrasea\Core\CLIProvider\TaskManagerServiceProvider;
|
use Alchemy\Phrasea\Core\CLIProvider\TaskManagerServiceProvider;
|
||||||
@@ -68,7 +67,6 @@ class CLI extends Application
|
|||||||
$this->register(new PluginServiceProvider());
|
$this->register(new PluginServiceProvider());
|
||||||
$this->register(new ComposerSetupServiceProvider());
|
$this->register(new ComposerSetupServiceProvider());
|
||||||
$this->register(new CLIDriversServiceProvider());
|
$this->register(new CLIDriversServiceProvider());
|
||||||
$this->register(new LessBuilderServiceProvider());
|
|
||||||
$this->register(new SignalHandlerServiceProvider());
|
$this->register(new SignalHandlerServiceProvider());
|
||||||
$this->register(new TaskManagerServiceProvider());
|
$this->register(new TaskManagerServiceProvider());
|
||||||
$this->register(new TranslationExtractorServiceProvider());
|
$this->register(new TranslationExtractorServiceProvider());
|
||||||
|
@@ -1,78 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2015 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Command\Developer;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Command\Command;
|
|
||||||
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
|
|
||||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use vierbergenlars\SemVer\version;
|
|
||||||
|
|
||||||
class BowerInstall extends Command
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct('dependencies:bower');
|
|
||||||
|
|
||||||
$this
|
|
||||||
->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 <info>".$grunt->getProcessBuilderFactory()->getBinary()."</info> for driver");
|
|
||||||
$output->writeln("Using <info>".$bower->getProcessBuilderFactory()->getBinary()."</info> 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("<comment>OK</comment>");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$output->write("Installing assets...");
|
|
||||||
$grunt->command('install-assets');
|
|
||||||
$output->write(" <comment>OK</comment>");
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -34,7 +34,6 @@ class InstallAll extends Command
|
|||||||
$ret = 0;
|
$ret = 0;
|
||||||
|
|
||||||
$ret += $this->container['console']->get('dependencies:composer')->execute($input, $output);
|
$ret += $this->container['console']->get('dependencies:composer')->execute($input, $output);
|
||||||
$ret += $this->container['console']->get('dependencies:bower')->execute($input, $output);
|
|
||||||
|
|
||||||
return min($ret, 255);
|
return min($ret, 255);
|
||||||
}
|
}
|
||||||
|
@@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2015 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Command\Developer;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Command\Command;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This command builds less file
|
|
||||||
*/
|
|
||||||
class LessCompiler extends Command
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct('assets:compile-less');
|
|
||||||
|
|
||||||
$this->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;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2015 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Command\Developer\Utils;
|
|
||||||
|
|
||||||
use Alchemy\BinaryDriver\AbstractBinary;
|
|
||||||
use Alchemy\BinaryDriver\Configuration;
|
|
||||||
use Alchemy\BinaryDriver\ConfigurationInterface;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
|
|
||||||
class BowerDriver extends AbstractBinary
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'bower';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array|ConfigurationInterface $conf
|
|
||||||
* @param LoggerInterface $logger
|
|
||||||
*
|
|
||||||
* @return BowerDriver
|
|
||||||
*/
|
|
||||||
public static function create($conf = [], LoggerInterface $logger = null)
|
|
||||||
{
|
|
||||||
if (!$conf instanceof ConfigurationInterface) {
|
|
||||||
$conf = new Configuration($conf);
|
|
||||||
}
|
|
||||||
|
|
||||||
$binaries = $conf->get('bower.binaries', ['bower']);
|
|
||||||
|
|
||||||
return static::load($binaries, $logger, $conf);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,48 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2014 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Command\Developer\Utils;
|
|
||||||
|
|
||||||
use Alchemy\BinaryDriver\AbstractBinary;
|
|
||||||
use Alchemy\BinaryDriver\Configuration;
|
|
||||||
use Alchemy\BinaryDriver\ConfigurationInterface;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
|
|
||||||
class GruntDriver extends AbstractBinary
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'grunt';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array|ConfigurationInterface $conf
|
|
||||||
* @param LoggerInterface $logger
|
|
||||||
*
|
|
||||||
* @return GruntDriver
|
|
||||||
*/
|
|
||||||
public static function create($conf = [], LoggerInterface $logger = null)
|
|
||||||
{
|
|
||||||
if (!$conf instanceof ConfigurationInterface) {
|
|
||||||
$conf = new Configuration($conf);
|
|
||||||
}
|
|
||||||
|
|
||||||
$binaries = $conf->get('grunt.binaries', ['grunt']);
|
|
||||||
|
|
||||||
$driver = static::load($binaries, $logger, $conf);
|
|
||||||
$driver->getProcessBuilderFactory()->getBuilder()->setWorkingDirectory(__DIR__.'/../../../../../..');
|
|
||||||
|
|
||||||
return $driver;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2015 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Command\Developer\Utils;
|
|
||||||
|
|
||||||
use Alchemy\BinaryDriver\AbstractBinary;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
use Alchemy\BinaryDriver\Configuration;
|
|
||||||
use Alchemy\BinaryDriver\ConfigurationInterface;
|
|
||||||
|
|
||||||
class RecessDriver extends AbstractBinary
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'recess';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array|ConfigurationInterface $conf
|
|
||||||
* @param LoggerInterface $logger
|
|
||||||
*
|
|
||||||
* @return RecessDriver
|
|
||||||
*/
|
|
||||||
public static function create($conf = [], LoggerInterface $logger = null)
|
|
||||||
{
|
|
||||||
if (!$conf instanceof ConfigurationInterface) {
|
|
||||||
$conf = new Configuration($conf);
|
|
||||||
}
|
|
||||||
|
|
||||||
$binaries = $conf->get('recess.binaries', ['recess']);
|
|
||||||
|
|
||||||
return static::load($binaries, $logger, $conf);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2015 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Command\Developer\Utils;
|
|
||||||
|
|
||||||
use Alchemy\BinaryDriver\AbstractBinary;
|
|
||||||
use Alchemy\BinaryDriver\Configuration;
|
|
||||||
use Alchemy\BinaryDriver\ConfigurationInterface;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
|
|
||||||
class UglifyJsDriver extends AbstractBinary
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'uglifyjs';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array|ConfigurationInterface $conf
|
|
||||||
* @param LoggerInterface $logger
|
|
||||||
*
|
|
||||||
* @return UglifyJsDriver
|
|
||||||
*/
|
|
||||||
public static function create($conf = [], LoggerInterface $logger = null)
|
|
||||||
{
|
|
||||||
if (!$conf instanceof ConfigurationInterface) {
|
|
||||||
$conf = new Configuration($conf);
|
|
||||||
}
|
|
||||||
|
|
||||||
$binaries = $conf->get('uglifyjs.binaries', ['uglifyjs']);
|
|
||||||
|
|
||||||
return static::load($binaries, $logger, $conf);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -50,9 +50,5 @@ abstract class AbstractPluginCommand extends Command
|
|||||||
$output->write("Updating config files...");
|
$output->write("Updating config files...");
|
||||||
$this->container['plugins.autoloader-generator']->write($manifests);
|
$this->container['plugins.autoloader-generator']->write($manifests);
|
||||||
$output->writeln(" <comment>OK</comment>");
|
$output->writeln(" <comment>OK</comment>");
|
||||||
|
|
||||||
$output->write('Building LESS assets ...');
|
|
||||||
$this->container['phraseanet.less-builder']->build($this->container['phraseanet.less-mapping.customizable']);
|
|
||||||
$output->writeln(" <comment>OK</comment>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -311,7 +311,6 @@ class Install extends Command
|
|||||||
'mp4box_binary' => $this->executableFinder->find('MP4Box'),
|
'mp4box_binary' => $this->executableFinder->find('MP4Box'),
|
||||||
'pdftotext_binary' => $this->executableFinder->find('pdftotext'),
|
'pdftotext_binary' => $this->executableFinder->find('pdftotext'),
|
||||||
'ghostscript_binary' => $this->executableFinder->find('gs'),
|
'ghostscript_binary' => $this->executableFinder->find('gs'),
|
||||||
'recess_binary' => $this->executableFinder->find('recess'),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -323,7 +323,6 @@ class V1Controller extends Controller
|
|||||||
'ffprobe' => isset($binaries['ffprobe_binary']) ? $binaries['ffprobe_binary'] : null,
|
'ffprobe' => isset($binaries['ffprobe_binary']) ? $binaries['ffprobe_binary'] : null,
|
||||||
'mp4box' => isset($binaries['mp4box_binary']) ? $binaries['mp4box_binary'] : null,
|
'mp4box' => isset($binaries['mp4box_binary']) ? $binaries['mp4box_binary'] : null,
|
||||||
'pdftotext' => isset($binaries['pdftotext_binary']) ? $binaries['pdftotext_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']),
|
'pdfmaxpages' => $conf->get(['registry', 'executables', 'pdf-max-pages']),
|
||||||
],
|
],
|
||||||
'mainConfiguration' => [
|
'mainConfiguration' => [
|
||||||
|
@@ -169,7 +169,6 @@ class SetupController extends Controller
|
|||||||
'ffmpeg_binary' => $request->request->get('binary_ffmpeg'),
|
'ffmpeg_binary' => $request->request->get('binary_ffmpeg'),
|
||||||
'mp4box_binary' => $request->request->get('binary_MP4Box'),
|
'mp4box_binary' => $request->request->get('binary_MP4Box'),
|
||||||
'pdftotext_binary' => $request->request->get('binary_xpdf'),
|
'pdftotext_binary' => $request->request->get('binary_xpdf'),
|
||||||
'recess_binary' => $request->request->get('binary_recess'),
|
|
||||||
] as $key => $path) {
|
] as $key => $path) {
|
||||||
$binaryData[$key] = $path;
|
$binaryData[$key] = $path;
|
||||||
}
|
}
|
||||||
|
@@ -11,11 +11,7 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\Core\CLIProvider;
|
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\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 Alchemy\Phrasea\Exception\RuntimeException;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ServiceProviderInterface;
|
use Silex\ServiceProviderInterface;
|
||||||
@@ -47,26 +43,6 @@ class CLIDriversServiceProvider implements ServiceProviderInterface
|
|||||||
return $app['executable-finder']->find($name, null, $extraDirs);
|
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) {
|
$app['driver.composer'] = $app->share(function (Application $app) {
|
||||||
$composerBinary = $app['driver.binary-finder']('composer', 'composer_binary');
|
$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']);
|
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)
|
public function boot(Application $app)
|
||||||
|
@@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2015 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Core\CLIProvider;
|
|
||||||
|
|
||||||
use Silex\Application;
|
|
||||||
use Silex\ServiceProviderInterface;
|
|
||||||
use Alchemy\Phrasea\Utilities\Less\Builder as LessBuilder;
|
|
||||||
use Alchemy\Phrasea\Utilities\Less\Compiler as LessCompiler;
|
|
||||||
|
|
||||||
class LessBuilderServiceProvider implements ServiceProviderInterface
|
|
||||||
{
|
|
||||||
public function register(Application $app)
|
|
||||||
{
|
|
||||||
$app['phraseanet.less-assets'] = $app->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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@@ -30,8 +30,8 @@ class AutoloaderGenerator
|
|||||||
->doWrite('services.php', $this->createServices($manifests))
|
->doWrite('services.php', $this->createServices($manifests))
|
||||||
->doWrite('commands.php', $this->createCommands($manifests))
|
->doWrite('commands.php', $this->createCommands($manifests))
|
||||||
->doWrite('twig-paths.php', $this->createTwigPathsMap($manifests))
|
->doWrite('twig-paths.php', $this->createTwigPathsMap($manifests))
|
||||||
->doWrite('login.less', $this->createLoginLess($manifests))
|
->doWrite('login.scss', $this->createLoginStylesheet($manifests))
|
||||||
->doWrite('account.less', $this->createAccountLess($manifests));
|
->doWrite('account.scss', $this->createAccountStylesheet($manifests));
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -40,16 +40,16 @@ class AutoloaderGenerator
|
|||||||
* @param Manifest[] $manifests
|
* @param Manifest[] $manifests
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function createLoginLess($manifests)
|
private function createLoginStylesheet($manifests)
|
||||||
{
|
{
|
||||||
$buffer = <<<EOF
|
$buffer = <<<EOF
|
||||||
// This file is automatically generated, please do not edit it.
|
// This file is automatically generated, please do not edit it.
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
foreach ($manifests as $manifest) {
|
foreach ($manifests as $manifest) {
|
||||||
$filepath = $this->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)) {
|
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 .= <<<EOF
|
$buffer .= <<<EOF
|
||||||
|
|
||||||
@import "$relativePath";
|
@import "$relativePath";
|
||||||
@@ -64,16 +64,16 @@ EOF;
|
|||||||
* @param Manifest[] $manifests
|
* @param Manifest[] $manifests
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function createAccountLess($manifests)
|
private function createAccountStylesheet($manifests)
|
||||||
{
|
{
|
||||||
$buffer = <<<EOF
|
$buffer = <<<EOF
|
||||||
// This file is automatically generated, please do not edit it.
|
// This file is automatically generated, please do not edit it.
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
foreach ($manifests as $manifest) {
|
foreach ($manifests as $manifest) {
|
||||||
$filepath = $this->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)) {
|
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 .= <<<EOF
|
$buffer .= <<<EOF
|
||||||
|
|
||||||
@import "$relativePath";
|
@import "$relativePath";
|
||||||
|
@@ -28,7 +28,6 @@ class BinariesProbe extends BinariesRequirements implements ProbeInterface
|
|||||||
'pdftotext_binary' => isset($binaries['pdftotext_binary']) ? $binaries['pdftotext_binary'] : null,
|
'pdftotext_binary' => isset($binaries['pdftotext_binary']) ? $binaries['pdftotext_binary'] : null,
|
||||||
'ffmpeg_binary' => isset($binaries['ffmpeg_binary']) ? $binaries['ffmpeg_binary'] : null,
|
'ffmpeg_binary' => isset($binaries['ffmpeg_binary']) ? $binaries['ffmpeg_binary'] : null,
|
||||||
'ffprobe_binary' => isset($binaries['ffprobe_binary']) ? $binaries['ffprobe_binary'] : null,
|
'ffprobe_binary' => isset($binaries['ffprobe_binary']) ? $binaries['ffprobe_binary'] : null,
|
||||||
'recess_binary' => isset($binaries['recess_binary']) ? $binaries['recess_binary'] : null,
|
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -215,13 +215,5 @@ class BinariesRequirements extends RequirementCollection implements RequirementI
|
|||||||
'FFProbe (or avprobe) is required for Video processing',
|
'FFProbe (or avprobe) is required for Video processing',
|
||||||
'Please install FFProbe (or avprobe)'
|
'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)'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2015 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Utilities\Less;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Utilities\Less\Compiler as LessCompiler;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
|
||||||
|
|
||||||
class Builder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var LessCompiler
|
|
||||||
*/
|
|
||||||
protected $compiler;
|
|
||||||
/**
|
|
||||||
* @var Filesystem
|
|
||||||
*/
|
|
||||||
protected $filesystem;
|
|
||||||
|
|
||||||
public function __construct(LessCompiler $compiler, Filesystem $filesystem)
|
|
||||||
{
|
|
||||||
$this->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 <info>" . basename($target) . "</info>... <comment>OK</comment>");
|
|
||||||
}
|
|
||||||
$this->compiler->compile($target, $lessFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,68 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2015 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Utilities\Less;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Command\Developer\Utils\RecessDriver;
|
|
||||||
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
|
|
||||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
|
||||||
|
|
||||||
class Compiler
|
|
||||||
{
|
|
||||||
private $filesystem;
|
|
||||||
private $recess;
|
|
||||||
|
|
||||||
public function __construct(Filesystem $filesystem, RecessDriver $recess)
|
|
||||||
{
|
|
||||||
$this->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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -59,10 +59,6 @@ class setup
|
|||||||
'name' => 'FFmpeg',
|
'name' => 'FFmpeg',
|
||||||
'binary' => $finder->find('ffmpeg')
|
'binary' => $finder->find('ffmpeg')
|
||||||
],
|
],
|
||||||
'recess' => [
|
|
||||||
'name' => 'Recesss',
|
|
||||||
'binary' => $finder->find('recess')
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -53,7 +53,6 @@ main:
|
|||||||
ffprobe_binary: null
|
ffprobe_binary: null
|
||||||
mp4box_binary: null
|
mp4box_binary: null
|
||||||
pdftotext_binary: null
|
pdftotext_binary: null
|
||||||
recess_binary: null
|
|
||||||
ffmpeg_timeout: 3600
|
ffmpeg_timeout: 3600
|
||||||
ffprobe_timeout: 60
|
ffprobe_timeout: 60
|
||||||
gs_timeout: 60
|
gs_timeout: 60
|
||||||
|
@@ -60,7 +60,6 @@ main:
|
|||||||
ffprobe_binary: null
|
ffprobe_binary: null
|
||||||
mp4box_binary: null
|
mp4box_binary: null
|
||||||
pdftotext_binary: null
|
pdftotext_binary: null
|
||||||
recess_binary: null
|
|
||||||
ffmpeg_timeout: 3600
|
ffmpeg_timeout: 3600
|
||||||
ffprobe_timeout: 60
|
ffprobe_timeout: 60
|
||||||
gs_timeout: 60
|
gs_timeout: 60
|
||||||
|
@@ -70,9 +70,6 @@ find . -maxdepth 1 -type f -exec rm {} \;
|
|||||||
sudo cp -rf * /usr/local/
|
sudo cp -rf * /usr/local/
|
||||||
|
|
||||||
# npm binaries
|
# npm binaries
|
||||||
sudo npm install -g recess
|
|
||||||
sudo npm install -g bower
|
|
||||||
sudo npm install -g uglify-js
|
|
||||||
|
|
||||||
#twig
|
#twig
|
||||||
cd /tmp
|
cd /tmp
|
||||||
|
@@ -1,78 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Alchemy\Tests\Phrasea\Command\Developper;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Command\Developer\BowerInstall;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group functional
|
|
||||||
* @group legacy
|
|
||||||
*/
|
|
||||||
class BowerInstallTest extends \PhraseanetTestCase
|
|
||||||
{
|
|
||||||
public function testRunWithoutProblems()
|
|
||||||
{
|
|
||||||
$input = $this->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));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -21,8 +21,7 @@ class InstallAllTest extends \PhraseanetTestCase
|
|||||||
|
|
||||||
$n = 0;
|
$n = 0;
|
||||||
foreach ([
|
foreach ([
|
||||||
'dependencies:composer',
|
'dependencies:composer'
|
||||||
'dependencies:bower'
|
|
||||||
] as $name) {
|
] as $name) {
|
||||||
$command = $this->getMockBuilder('Symfony\Component\Console\Command\Command')
|
$command = $this->getMockBuilder('Symfony\Component\Console\Command\Command')
|
||||||
->setMethods(['execute'])
|
->setMethods(['execute'])
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Alchemy\Tests\Phrasea\Command\Developper\Utils;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Command\Developer\Utils\BowerDriver;
|
|
||||||
use Symfony\Component\Process\PhpExecutableFinder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group functional
|
|
||||||
* @group legacy
|
|
||||||
*/
|
|
||||||
class BowerDriverTest extends \PhraseanetTestCase
|
|
||||||
{
|
|
||||||
public function testCreate()
|
|
||||||
{
|
|
||||||
$driver = BowerDriver::create();
|
|
||||||
$this->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());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Alchemy\Tests\Phrasea\Command\Developper\Utils;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Command\Developer\Utils\GruntDriver;
|
|
||||||
use Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider;
|
|
||||||
use Symfony\Component\Process\PhpExecutableFinder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group functional
|
|
||||||
* @group legacy
|
|
||||||
*/
|
|
||||||
class GruntDriverTest extends \PhraseanetTestCase
|
|
||||||
{
|
|
||||||
public function testCreate()
|
|
||||||
{
|
|
||||||
$app = $this->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());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Alchemy\Tests\Phrasea\Command\Developper\Utils;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Command\Developer\Utils\RecessDriver;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group functional
|
|
||||||
* @group legacy
|
|
||||||
*/
|
|
||||||
class RecessDriverTest extends \PhraseanetTestCase
|
|
||||||
{
|
|
||||||
public function testGetCreate()
|
|
||||||
{
|
|
||||||
$recessDriver = RecessDriver::create();
|
|
||||||
|
|
||||||
$this->assertInstanceOf('Alchemy\BinaryDriver\BinaryInterface', $recessDriver);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGetName()
|
|
||||||
{
|
|
||||||
$recessDriver = RecessDriver::create();
|
|
||||||
|
|
||||||
$this->assertEquals('recess', $recessDriver->getName());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Alchemy\Tests\Phrasea\Command\Developper\Utils;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver;
|
|
||||||
use Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider;
|
|
||||||
use Symfony\Component\Process\PhpExecutableFinder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group functional
|
|
||||||
* @group legacy
|
|
||||||
*/
|
|
||||||
class UglifyJsDriverTest extends \PhraseanetTestCase
|
|
||||||
{
|
|
||||||
public function testCreate()
|
|
||||||
{
|
|
||||||
$app = $this->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());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -5,6 +5,7 @@ namespace Alchemy\Tests\Phrasea\Controller;
|
|||||||
/**
|
/**
|
||||||
* @group functional
|
* @group functional
|
||||||
* @group legacy
|
* @group legacy
|
||||||
|
* @group minify
|
||||||
*/
|
*/
|
||||||
class MinifierTest extends \PhraseanetTestCase
|
class MinifierTest extends \PhraseanetTestCase
|
||||||
{
|
{
|
||||||
@@ -25,23 +26,6 @@ class MinifierTest extends \PhraseanetTestCase
|
|||||||
$_GET = [];
|
$_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
|
* @dataProvider provideFilesToMinify
|
||||||
*/
|
*/
|
||||||
@@ -54,17 +38,7 @@ class MinifierTest extends \PhraseanetTestCase
|
|||||||
|
|
||||||
public function provideFilesToMinify()
|
public function provideFilesToMinify()
|
||||||
{
|
{
|
||||||
$files = [];
|
return [['scripts/apps/admin/require.config.js']];
|
||||||
|
|
||||||
$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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFileMinificationWithoutParamsShouldReturnA400()
|
public function testFileMinificationWithoutParamsShouldReturnA400()
|
||||||
|
@@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Alchemy\Tests\Phrasea\Core\CLIProvider;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\CLI;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group functional
|
|
||||||
* @group legacy
|
|
||||||
* @covers Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider
|
|
||||||
*/
|
|
||||||
class CLISDriversServiceProviderTest extends ServiceProviderTestCase
|
|
||||||
{
|
|
||||||
public function provideServiceDescription()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[
|
|
||||||
'Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider',
|
|
||||||
'executable-finder',
|
|
||||||
'Symfony\Component\Process\ExecutableFinder'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider',
|
|
||||||
'driver.bower',
|
|
||||||
'Alchemy\Phrasea\Command\Developer\Utils\BowerDriver'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider',
|
|
||||||
'driver.composer',
|
|
||||||
'Alchemy\Phrasea\Command\Developer\Utils\ComposerDriver'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider',
|
|
||||||
'driver.uglifyjs',
|
|
||||||
'Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider',
|
|
||||||
'driver.recess',
|
|
||||||
'Alchemy\Phrasea\Command\Developer\Utils\RecessDriver'
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testComposerTimeout()
|
|
||||||
{
|
|
||||||
$cli = new CLI('test');
|
|
||||||
$this->assertEquals(300, $cli['driver.composer']->getProcessBuilderFactory()->getTimeout());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testBowerTimeout()
|
|
||||||
{
|
|
||||||
$cli = new CLI('test');
|
|
||||||
$this->assertEquals(300, $cli['driver.bower']->getProcessBuilderFactory()->getTimeout());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Alchemy\Tests\Phrasea\Core\CLIProvider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group functional
|
|
||||||
* @group legacy
|
|
||||||
* @covers Alchemy\Phrasea\Core\CLIProvider\LessBuilderServiceProvider
|
|
||||||
*/
|
|
||||||
class LessBuilderServiceProviderTest extends ServiceProviderTestCase
|
|
||||||
{
|
|
||||||
public function provideServiceDescription()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[
|
|
||||||
'Alchemy\Phrasea\Core\CLIProvider\LessBuilderServiceProvider',
|
|
||||||
'phraseanet.less-compiler',
|
|
||||||
'\Alchemy\Phrasea\Utilities\Less\Compiler'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'Alchemy\Phrasea\Core\CLIProvider\LessBuilderServiceProvider',
|
|
||||||
'phraseanet.less-builder',
|
|
||||||
'\Alchemy\Phrasea\Utilities\Less\Builder'
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -53,7 +53,6 @@ main:
|
|||||||
ffprobe_binary: null
|
ffprobe_binary: null
|
||||||
mp4box_binary: null
|
mp4box_binary: null
|
||||||
pdftotext_binary: null
|
pdftotext_binary: null
|
||||||
recess_binary: null
|
|
||||||
ffmpeg_timeout: 3600
|
ffmpeg_timeout: 3600
|
||||||
ffprobe_timeout: 60
|
ffprobe_timeout: 60
|
||||||
gs_timeout: 60
|
gs_timeout: 60
|
||||||
|
@@ -67,7 +67,6 @@ main:
|
|||||||
ffprobe_binary: null
|
ffprobe_binary: null
|
||||||
mp4box_binary: null
|
mp4box_binary: null
|
||||||
pdftotext_binary: null
|
pdftotext_binary: null
|
||||||
recess_binary: null
|
|
||||||
ffmpeg_timeout: 3600
|
ffmpeg_timeout: 3600
|
||||||
ffprobe_timeout: 60
|
ffprobe_timeout: 60
|
||||||
gs_timeout: 60
|
gs_timeout: 60
|
||||||
|
@@ -53,7 +53,6 @@ main:
|
|||||||
ffprobe_binary: null
|
ffprobe_binary: null
|
||||||
mp4box_binary: null
|
mp4box_binary: null
|
||||||
pdftotext_binary: null
|
pdftotext_binary: null
|
||||||
recess_binary: null
|
|
||||||
ffmpeg_timeout: 3600
|
ffmpeg_timeout: 3600
|
||||||
ffprobe_timeout: 60
|
ffprobe_timeout: 60
|
||||||
gs_timeout: 60
|
gs_timeout: 60
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
@import "my-plugin/account.less";
|
|
@@ -1 +0,0 @@
|
|||||||
@import "my-plugin/login.less";
|
|
@@ -0,0 +1 @@
|
|||||||
|
@import "my-plugin/account.scss";
|
@@ -0,0 +1 @@
|
|||||||
|
@import "my-plugin/login.scss";
|
@@ -1 +0,0 @@
|
|||||||
@import "my-plugin/account.less";
|
|
@@ -1 +0,0 @@
|
|||||||
@import "my-plugin/login.less";
|
|
@@ -0,0 +1 @@
|
|||||||
|
@import "my-plugin/account.scss";
|
@@ -0,0 +1 @@
|
|||||||
|
@import "my-plugin/login.scss";
|
@@ -25,8 +25,8 @@ class AutoloaderGeneratorTest extends \PhraseanetTestCase
|
|||||||
$pluginsDir . '/autoload.php',
|
$pluginsDir . '/autoload.php',
|
||||||
$pluginsDir . '/commands.php',
|
$pluginsDir . '/commands.php',
|
||||||
$pluginsDir . '/twig-paths.php',
|
$pluginsDir . '/twig-paths.php',
|
||||||
$pluginsDir . '/login.less',
|
$pluginsDir . '/login.scss',
|
||||||
$pluginsDir . '/account.less',
|
$pluginsDir . '/account.scss',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->cleanup($files);
|
$this->cleanup($files);
|
||||||
@@ -73,8 +73,8 @@ class AutoloaderGeneratorTest extends \PhraseanetTestCase
|
|||||||
$mapping = require $pluginsDir . '/twig-paths.php';
|
$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->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 . '/login.scss'));
|
||||||
$this->assertRegExp('#@import#', file_get_contents($pluginsDir . '/account.less'));
|
$this->assertRegExp('#@import#', file_get_contents($pluginsDir . '/account.scss'));
|
||||||
|
|
||||||
$this->cleanup($files);
|
$this->cleanup($files);
|
||||||
}
|
}
|
||||||
|
@@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Alchemy\Tests\Phrasea\Utilities\Less;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Utilities\Less\Builder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group functional
|
|
||||||
* @group legacy
|
|
||||||
*/
|
|
||||||
class BuilderTest extends \PhraseanetTestCase
|
|
||||||
{
|
|
||||||
public function testBuildSuccess()
|
|
||||||
{
|
|
||||||
$compiler = $this->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']);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Alchemy\Tests\Phrasea\Utilities\Less;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Utilities\Less\Compiler;
|
|
||||||
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group functional
|
|
||||||
* @group legacy
|
|
||||||
*/
|
|
||||||
class CompilerTest extends \PhraseanetTestCase
|
|
||||||
{
|
|
||||||
public function testCompileSuccess()
|
|
||||||
{
|
|
||||||
$recessDriver = $this->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__);
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user