From 8c9fea16e81d119b3dc1b23f277e1a0634b540c2 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 28 Sep 2015 17:33:56 +0200 Subject: [PATCH 1/2] Updated the styles of the assets:install command --- .../Command/AssetsInstallCommand.php | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 5b627ded6ae6..fb4cf3a4cb6e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -15,6 +15,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Finder\Finder; @@ -68,6 +69,7 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + $output = new SymfonyStyle($input, $output); $targetArg = rtrim($input->getArgument('target'), '/'); if (!is_dir($targetArg)) { @@ -81,23 +83,18 @@ protected function execute(InputInterface $input, OutputInterface $output) $filesystem->mkdir($bundlesDir, 0777); // relative implies symlink - $symlink = $input->getOption('symlink') || $input->getOption('relative'); - - if ($symlink) { - $output->writeln('Trying to install assets as symbolic links.'); - } else { - $output->writeln('Installing assets as hard copies.'); - } + $useSymlinks = $input->getOption('symlink') || $input->getOption('relative'); + $symlinksSupported = false; foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) { if (is_dir($originDir = $bundle->getPath().'/Resources/public')) { $targetDir = $bundlesDir.preg_replace('/bundle$/', '', strtolower($bundle->getName())); - $output->writeln(sprintf('Installing assets for %s into %s', $bundle->getNamespace(), $targetDir)); + $output->text(sprintf('Installing assets for %s into %s', $bundle->getNamespace(), $targetDir)); $filesystem->remove($targetDir); - if ($symlink) { + if ($useSymlinks) { if ($input->getOption('relative')) { $relativeOriginDir = $filesystem->makePathRelative($originDir, realpath($bundlesDir)); } else { @@ -109,11 +106,12 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!file_exists($targetDir)) { throw new IOException('Symbolic link is broken'); } - $output->writeln('The assets were installed using symbolic links.'); + $output->comment('The assets were installed using symbolic links.'); + $symlinksSupported = true; } catch (IOException $e) { if (!$input->getOption('relative')) { $this->hardCopy($originDir, $targetDir); - $output->writeln('It looks like your system doesn\'t support symbolic links, so the assets were installed by copying them.'); + $output->comment('It looks like your system doesn\'t support symbolic links, so the assets were installed by copying them.'); } // try again without the relative option @@ -122,17 +120,27 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!file_exists($targetDir)) { throw new IOException('Symbolic link is broken'); } - $output->writeln('It looks like your system doesn\'t support relative symbolic links, so the assets were installed by using absolute symbolic links.'); + $output->comment('It looks like your system doesn\'t support relative symbolic links, so the assets were installed by using absolute symbolic links.'); } catch (IOException $e) { $this->hardCopy($originDir, $targetDir); - $output->writeln('It looks like your system doesn\'t support symbolic links, so the assets were installed by copying them.'); + $output->comment('It looks like your system doesn\'t support symbolic links, so the assets were installed by copying them.'); } } + + $output->newLine(); } else { $this->hardCopy($originDir, $targetDir); } } } + + if (false && !$useSymlinks) { + $output->success('Assets were installed as hard copies.'); + } elseif (true || ($useSymlinks && !$symlinksSupported)) { + $output->warning('Assets were installed as hard copies because your system does not support symlinks.'); + } else { + $output->success('Assets were installed as symlinks.'); + } } /** From f4bc6b03a0067aab29db51cad41b0b2b31a9f09a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 28 Sep 2015 17:37:14 +0200 Subject: [PATCH 2/2] Removed some leftovers --- .../Bundle/FrameworkBundle/Command/AssetsInstallCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index fb4cf3a4cb6e..455d1d59c10c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -134,9 +134,9 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - if (false && !$useSymlinks) { + if (!$useSymlinks) { $output->success('Assets were installed as hard copies.'); - } elseif (true || ($useSymlinks && !$symlinksSupported)) { + } elseif ($useSymlinks && !$symlinksSupported) { $output->warning('Assets were installed as hard copies because your system does not support symlinks.'); } else { $output->success('Assets were installed as symlinks.'); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy