diff --git a/bin/developer b/bin/developer index 0e2f6f3159..ed7f1d9579 100755 --- a/bin/developer +++ b/bin/developer @@ -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( diff --git a/lib/Alchemy/Phrasea/Command/Developer/InstallAll.php b/lib/Alchemy/Phrasea/Command/Developer/InstallAll.php index 8336a9b550..f5a7a6953b 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/InstallAll.php +++ b/lib/Alchemy/Phrasea/Command/Developer/InstallAll.php @@ -35,9 +35,8 @@ 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); } } diff --git a/lib/Alchemy/Phrasea/Command/Developer/JavascriptBuilder.php b/lib/Alchemy/Phrasea/Command/Developer/JavascriptBuilder.php deleted file mode 100644 index ad1b2802a3..0000000000 --- a/lib/Alchemy/Phrasea/Command/Developer/JavascriptBuilder.php +++ /dev/null @@ -1,92 +0,0 @@ -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); - } -}