mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 22:13:13 +00:00
Remove javascript builder command
This commit is contained in:
@@ -15,9 +15,8 @@ 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\InstallAll;
|
||||
use Alchemy\Phrasea\Command\Developer\JavascriptBuilder;
|
||||
use Alchemy\Phrasea\Command\Developer\LessCompiler;
|
||||
use Alchemy\Phrasea\Command\Developer\RegenerateSqliteDb;
|
||||
use Alchemy\Phrasea\Command\Developer\RoutesDumper;
|
||||
|
||||
@@ -72,12 +71,11 @@ try {
|
||||
$cli->command(new InstallAll());
|
||||
$cli->command(new BowerInstall());
|
||||
$cli->command(new ComposerInstall());
|
||||
$cli->command(new LessCompiler());
|
||||
$cli->command(new RegenerateSqliteDb());
|
||||
$cli->command(new APIRoutesDumper());
|
||||
$cli->command(new RoutesDumper());
|
||||
$cli->command(new Behat());
|
||||
$cli->command(new LessCompiler());
|
||||
$cli->command(new JavascriptBuilder());
|
||||
$cli->command(new \module_console_systemTemplateGenerator('system:generate-templates'));
|
||||
|
||||
$cli['console']->addCommands(array(
|
||||
|
@@ -35,7 +35,6 @@ class InstallAll extends Command
|
||||
|
||||
$ret += $this->container['console']->get('dependencies:bower')->execute($input, $output);
|
||||
$ret += $this->container['console']->get('dependencies:composer')->execute($input, $output);
|
||||
$ret += $this->container['console']->get('assets:build-javascript')->execute($input, $output);
|
||||
$ret += $this->container['console']->get('assets:compile-less')->execute($input, $output);
|
||||
|
||||
return min($ret, 255);
|
||||
|
@@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2013 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;
|
||||
use Symfony\Component\Process\ProcessBuilder;
|
||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||
|
||||
/**
|
||||
* This command builds javascript files
|
||||
*/
|
||||
class JavascriptBuilder extends Command
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('assets:build-javascript');
|
||||
|
||||
$this->setDescription('Builds Phraseanet JavaScript files');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$files = array(
|
||||
$this->container['root.path'] . '/www/skins/build/bootstrap/js/bootstrap.js' => array(
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-transition.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-alert.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-button.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-carousel.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-collapse.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-dropdown.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-modal.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-tooltip.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-popover.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-scrollspy.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-tab.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-typeahead.js',
|
||||
$this->container['root.path'] . '/www/assets/bootstrap/js/bootstrap-affix.js',
|
||||
)
|
||||
);
|
||||
|
||||
$output->writeln('Building JavaScript assets');
|
||||
foreach ($files as $target => $sources) {
|
||||
$this->buildJavascript($input, $output, $target, $sources);
|
||||
|
||||
$minifiedTarget = substr($target, 0, -3) . '.min.js';
|
||||
$this->buildMinifiedJavascript($input, $output, $minifiedTarget, $target);
|
||||
}
|
||||
}
|
||||
|
||||
private function buildJavascript(InputInterface $input, OutputInterface $output, $target, $sources)
|
||||
{
|
||||
$output->writeln("\t".basename($target));
|
||||
$this->container['filesystem']->remove($target);
|
||||
|
||||
$process = ProcessBuilder::create(array_merge(array('cat'), $sources))->getProcess();
|
||||
if ($input->getOption('verbose')) {
|
||||
$output->writeln("Executing ".$process->getCommandLine()."\n");
|
||||
}
|
||||
$process->run();
|
||||
|
||||
if (!$process->isSuccessFul()) {
|
||||
throw new RuntimeException(sprintf('Failed to generate %s', $target));
|
||||
}
|
||||
|
||||
$this->container['filesystem']->mkdir(dirname($target));
|
||||
file_put_contents($target, $process->getOutput());
|
||||
}
|
||||
|
||||
private function buildMinifiedJavascript(InputInterface $input, OutputInterface $output, $target, $source)
|
||||
{
|
||||
$output->writeln("\t".basename($target));
|
||||
$this->container['filesystem']->remove($target);
|
||||
|
||||
$output = $this->container['driver.uglifyjs']->command(array($source, '-nc'));
|
||||
|
||||
file_put_contents($target, $output);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user