8000 Added --symlink option to assets:install command · lcf/symfony@7ad510d · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ad510d

Browse files
henrikbjornfabpot
henrikbjorn
authored andcommitted
Added --symlink option to assets:install command
1 parent 18ba4fd commit 7ad510d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ protected function configure()
3434
->setDefinition(array(
3535
new InputArgument('target', InputArgument::REQUIRED, 'The target directory'),
3636
))
37+
->addOption('symlink', null, InputOption::PARAMETER_NONE, 'Symlinks the assets instead of copying it')
3738
->setName('assets:install')
3839
;
3940
}
@@ -58,8 +59,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
5859
$targetDir = $input->getArgument('target').'/bundles/'.preg_replace('/bundle$/', '', strtolower($bundle->getName()));
5960

6061
$filesystem->remove($targetDir);
61-
mkdir($targetDir, 0777, true);
62-
$filesystem->mirror($originDir, $targetDir);
62+
63+
if ($input->getOption('symlink')) {
64+
$filesystem->symlink($originDir, $targetDir);
65+
} else {
66+
mkdir($targetDir, 0777, true);
67+
$filesystem->mirror($originDir, $targetDir);
68+
}
6369
}
6470
}
6571
}

0 commit comments

Comments
 (0)
0