Merge remote branch 'naderman/watch-debug'

* naderman/watch-debug:
  [AsseticBundle] Throw exception if --watch is used without --debug.
This commit is contained in:
Fabien Potencier 2011-03-09 12:51:38 +01:00
commit 689f0e1d58

View File

@ -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 = '';