From 91df6d9f5c878467cfedcf2f3115d1ce8f885f9d Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 9 Apr 2011 09:13:24 -0500 Subject: [PATCH] [FrameworkBundle] Improving the output and help messages in the task (no behavioral change) --- .../Command/AssetsInstallCommand.php | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 1f80df8366..8cf0c09332 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -18,7 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\Output; /** - * AssetsInstallCommand. + * Command that places bundle web assets into a given directory. * * @author Fabien Potencier */ @@ -31,9 +31,23 @@ class AssetsInstallCommand extends Command { $this ->setDefinition(array( - new InputArgument('target', InputArgument::REQUIRED, 'The target directory'), + new InputArgument('target', InputArgument::REQUIRED, 'The target directory (usually "web")'), )) ->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it') + ->setHelp(<<assets:install command installs bundle assets into a given +directory (e.g. the web directory). + +./app/console assets:install web [--symlink] + +A "bundles" directory will be created inside the target directory, and the +"Resources/public" directory of each bundle will be copied into it. + +To create a symlink to each bundle instead of copying its assets, use the +--symlink option. + +EOT + ) ->setName('assets:install') ; } @@ -56,10 +70,10 @@ class AssetsInstallCommand extends Command foreach ($this->container->get('kernel')->getBundles() as $bundle) { if (is_dir($originDir = $bundle->getPath().'/Resources/public')) { - $output->writeln(sprintf('Installing assets for %s', $bundle->getNamespace())); - $targetDir = $input->getArgument('target').'/bundles/'.preg_replace('/bundle$/', '', strtolower($bundle->getName())); + $output->writeln(sprintf('Installing assets for %s into %s', $bundle->getNamespace(), $targetDir)); + $filesystem->remove($targetDir); if ($input->getOption('symlink')) {