Bladeren bron

Merge remote branch 'naderman/watch-debug'

* naderman/watch-debug:
  [AsseticBundle] Throw exception if --watch is used without --debug.
Fabien Potencier 14 jaren geleden
bovenliggende
commit
689f0e1d58
1 gewijzigde bestanden met toevoegingen van 6 en 4 verwijderingen
  1. 6 4
      src/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php

+ 6 - 4
src/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php

@@ -33,7 +33,7 @@ class DumpCommand extends Command
             ->setName('assetic:dump')
             ->setDescription('Dumps all assets to the filesystem')
             ->addArgument('write_to', InputArgument::OPTIONAL, 'Override the configured asset root')
-            ->addOption('watch', null, InputOption::VALUE_NONE, 'Check for changes every second')
+            ->addOption('watch', null, InputOption::VALUE_NONE, 'Check for changes every second, debug mode only')
         ;
     }
 
@@ -70,6 +70,10 @@ class DumpCommand extends Command
      */
     protected function watch(LazyAssetManager $am, $basePath, OutputInterface $output, $debug = false)
     {
+        if (!$debug) {
+            throw new \RuntimeException('The --watch option is only available in debug mode.');
+        }
+
         $refl = new \ReflectionClass('Assetic\\AssetManager');
         $prop = $refl->getProperty('assets');
         $prop->setAccessible(true);
@@ -92,9 +96,7 @@ class DumpCommand extends Command
 
                 // reset the asset manager
                 $prop->setValue($am, array());
-                if ($debug) {
-                    $am->load();
-                }
+                $am->load();
 
                 file_put_contents($cache, serialize($previously));
                 $error = '';