Skip to content

Commit

Permalink
bug #25033 [FrameworkBundle] Dont create empty bundles directory by d…
Browse files Browse the repository at this point in the history
…efault (ro0NL)

This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] Dont create empty bundles directory by default

| Q             | A
| ------------- | ---
| Branch?       | 3.4 / 4.1?
| Bug fix?      | yes?
| New feature?  | no
| BC breaks?    | no?
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

we still run `assets:install` by default, which in bundle-less apps gives this annoying empty public/bundles dir and some useless cli output, all the time. This fixes it.

Commits
-------

f8e7478 [FrameworkBundle] Dont create empty bundles directory
  • Loading branch information
fabpot committed Nov 20, 2017
2 parents 57b26b6 + f8e7478 commit 1b6597d
Showing 1 changed file with 8 additions and 6 deletions.
Expand Up @@ -120,9 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}

// Create the bundles directory otherwise symlink will fail.
$bundlesDir = $targetArg.'/bundles/';
$this->filesystem->mkdir($bundlesDir, 0777);

$io = new SymfonyStyle($input, $output);
$io->newLine();
Expand Down Expand Up @@ -186,18 +184,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}
// remove the assets of the bundles that no longer exist
$dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir);
$this->filesystem->remove($dirsToRemove);
if (is_dir($bundlesDir)) {
$dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir);
$this->filesystem->remove($dirsToRemove);
}

$io->table(array('', 'Bundle', 'Method / Error'), $rows);
if ($rows) {
$io->table(array('', 'Bundle', 'Method / Error'), $rows);
}

if (0 !== $exitCode) {
$io->error('Some errors occurred while installing assets.');
} else {
if ($copyUsed) {
$io->note('Some assets were installed via copy. If you make changes to these assets you have to run this command again.');
}
$io->success('All assets were successfully installed.');
$io->success($rows ? 'All assets were successfully installed.' : 'No assets were provided by any bundle.');
}

return $exitCode;
Expand Down

0 comments on commit 1b6597d

Please sign in to comment.