Browse Source

Adding assetic dump command (not used yet)

Julio Montoya 12 years ago
parent
commit
3808adb8bb
2 changed files with 45 additions and 0 deletions
  1. 2 0
      app/console.php
  2. 43 0
      src/ChamiloLMS/Command/Template/AsseticDumpCommand.php

+ 2 - 0
app/console.php

@@ -57,6 +57,8 @@ $cli->addCommands(array(
     new ChamiloLMS\Command\Database\StatusCommand(),
     new ChamiloLMS\Command\Database\SetupCommand(),
 
+    //new ChamiloLMS\Command\Template\AsseticDumpCommand(),
+
     //Chash commands
     new Chash\Command\Database\RunSQLCommand(),
     new Chash\Command\Database\DumpCommand(),

+ 43 - 0
src/ChamiloLMS/Command/Template/AsseticDumpCommand.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace ChamiloLMS\Command\Template;
+
+use Symfony\Component\Console\Input\ArrayInput;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console;
+use Symfony\Component\Console\Command\Command;
+
+class AsseticDumpCommand extends Command
+{
+
+    protected function configure()
+    {
+        $this
+            ->setName('assetic:dump')
+            ->setDescription('Dumps all assets to the filesystem');
+    }
+
+    protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
+    {
+        global $app;
+
+        if (!$app['assetic.enabled']) {
+            return false;
+        }
+
+        $themes = array('chamilo', 'public_admin');
+
+        foreach ($themes as $theme) {
+            $app['app.theme'] = $theme;
+            $dumper = $app['assetic.dumper'];
+
+            if (isset($app['twig'])) {
+                $dumper->addTwigAssets();
+            }
+            $dumper->dumpAssets();
+        }
+
+        $output->writeln('<info>Dump finished</info>');
+    }
+}