Browse Source

Added --symlink option to assets:install command

henrikbjorn 14 years ago
parent
commit
7ad510d6ef

+ 8 - 2
src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

@@ -34,6 +34,7 @@ class AssetsInstallCommand extends Command
             ->setDefinition(array(
                 new InputArgument('target', InputArgument::REQUIRED, 'The target directory'),
             ))
+            ->addOption('symlink', null, InputOption::PARAMETER_NONE, 'Symlinks the assets instead of copying it')
             ->setName('assets:install')
         ;
     }
@@ -58,8 +59,13 @@ class AssetsInstallCommand extends Command
                 $targetDir = $input->getArgument('target').'/bundles/'.preg_replace('/bundle$/', '', strtolower($bundle->getName()));
 
                 $filesystem->remove($targetDir);
-                mkdir($targetDir, 0777, true);
-                $filesystem->mirror($originDir, $targetDir);
+
+                if ($input->getOption('symlink')) {
+                    $filesystem->symlink($originDir, $targetDir);
+                } else {
+                    mkdir($targetDir, 0777, true);
+                    $filesystem->mirror($originDir, $targetDir);
+                }
             }
         }
     }