8000 [FrameworkBundle] added a --relative option to assets:install · mitchellzen/symfony@bfb99bf · GitHub
[go: up one dir, main page]

Skip to content

Commit bfb99bf

Browse files
committed
[FrameworkBundle] added a --relative option to assets:install
1 parent 258a1fd commit bfb99bf

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,25 @@ protected function configure()
3535
new InputArgument('target', InputArgument::REQUIRED, 'The target directory (usually "web")'),
3636
))
3737
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
38+
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
3839
->setDescription('Install bundles web assets under a public web directory')
3940
->setHelp(<<<EOT
4041
The <info>assets:install</info> command installs bundle assets into a given
4142
directory (e.g. the web directory).
4243
43-
<info>php app/console assets:install web [--symlink]</info>
44+
<info>php app/console assets:install web</info>
4445
4546
A "bundles" directory will be created inside the target directory, and the
4647
"Resources/public" directory of each bundle will be copied into it.
4748
4849
To create a symlink to each bundle instead of copying its assets, use the
49-
<info>--symlink</info> option.
50+
<info>--symlink</info> option:
51+
52+
<info>php app/console assets:install web --symlink</info>
53+
54+
To make symlink relative, add the <info>--relative</info> option:
55+
56+
<info>php app/console assets:install web --symlink --relative</info>
5057
5158
EOT
5259
)
@@ -86,7 +93,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
8693
$filesystem->remove($targetDir);
8794

8895
if ($input->getOption('symlink')) {
89-
$relativeOriginDir = $filesystem->makePathRelative($originDir, realpath($bundlesDir));
96+
if ($input->getOption('relative')) {
97+
$relativeOriginDir = $filesystem->makePathRelative($originDir, realpath($bundlesDir));
98+
} else {
99+
$relativeOriginDir = $originDir;
100+
}
90101
$filesystem->symlink($relativeOriginDir, $targetDir);
91102
} else {
92103
$filesystem->mkdir($targetDir, 0777);

0 commit comments

Comments
 (0)
0