From bfb99bf219720f0867a9c7386fad79f8cdd998b5 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 28 Sep 2011 17:38:41 +0200 Subject: [PATCH] [FrameworkBundle] added a --relative option to assets:install --- .../Command/AssetsInstallCommand.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index f960a80e0f..59e13625df 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -35,18 +35,25 @@ class AssetsInstallCommand extends ContainerAwareCommand new InputArgument('target', InputArgument::REQUIRED, 'The target directory (usually "web")'), )) ->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it') + ->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks') ->setDescription('Install bundles web assets under a public web directory') ->setHelp(<<assets:install command installs bundle assets into a given directory (e.g. the web directory). -php app/console assets:install web [--symlink] +php app/console assets:install web 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. +--symlink option: + +php app/console assets:install web --symlink + +To make symlink relative, add the --relative option: + +php app/console assets:install web --symlink --relative EOT ) @@ -86,7 +93,11 @@ EOT $filesystem->remove($targetDir); if ($input->getOption('symlink')) { - $relativeOriginDir = $filesystem->makePathRelative($originDir, realpath($bundlesDir)); + if ($input->getOption('relative')) { + $relativeOriginDir = $filesystem->makePathRelative($originDir, realpath($bundlesDir)); + } else { + $relativeOriginDir = $originDir; + } $filesystem->symlink($relativeOriginDir, $targetDir); } else { $filesystem->mkdir($targetDir, 0777);