Skip to content

Commit

Permalink
[FrameworkBundle] added a --relative option to assets:install
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 28, 2011
1 parent 258a1fd commit bfb99bf
Showing 1 changed file with 14 additions and 3 deletions.
Expand Up @@ -35,18 +35,25 @@ protected function configure()
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(<<<EOT
The <info>assets:install</info> command installs bundle assets into a given
directory (e.g. the web directory).
<info>php app/console assets:install web [--symlink]</info>
<info>php app/console assets:install web</info>
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
<info>--symlink</info> option.
<info>--symlink</info> option:
<info>php app/console assets:install web --symlink</info>
To make symlink relative, add the <info>--relative</info> option:
<info>php app/console assets:install web --symlink --relative</info>
EOT
)
Expand Down Expand Up @@ -86,7 +93,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$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);
Expand Down

3 comments on commit bfb99bf

@lisachenko
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, include this commit into the 2.0 branch.

@stof
Copy link
Member

@stof stof commented on bfb99bf Mar 12, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lisachenko new features are never added to maintenance releases. This is exactly what makes the difference between the maintenance releases (bug fixes only) and the minor releases (new features)

@lisachenko
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof Yes, you are right. I lost sight of that.

Please sign in to comment.