Skip to content

Commit

Permalink
Merge remote branch 'naderman/watch-debug'
Browse files Browse the repository at this point in the history
* naderman/watch-debug:
  [AsseticBundle] Throw exception if --watch is used without --debug.
  • Loading branch information
fabpot committed Mar 9, 2011
2 parents d3d496f + 94aacd0 commit 689f0e1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php
Expand Up @@ -33,7 +33,7 @@ protected function configure()
->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')
;
}

Expand Down Expand Up @@ -70,6 +70,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
*/
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);
Expand All @@ -92,9 +96,7 @@ protected function watch(LazyAssetManager $am, $basePath, OutputInterface $outpu

// reset the asset manager
$prop->setValue($am, array());
if ($debug) {
$am->load();
}
$am->load();

file_put_contents($cache, serialize($previously));
$error = '';
Expand Down

0 comments on commit 689f0e1

Please sign in to comment.