コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $finder = new Finder();
     $iconSet = $this->getContainer()->getParameter('mopa_bootstrap.icons.icon_set');
     $webPath = $this->getContainer()->get('kernel')->getRootDir() . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'web';
     $iconWebPath = $webPath . DIRECTORY_SEPARATOR . "fonts";
     $fs = new Filesystem();
     if (!$fs->exists($iconWebPath)) {
         $fs->mkdir($iconWebPath);
     }
     $composer = ComposerAdapter::getComposer($input, $output);
     $cmanager = new ComposerPathFinder($composer);
     $sourcePackage = $cmanager->findPackage('mopa/bootstrap-bundle');
     $bsbPath = $composer->getInstallationManager()->getInstallPath($sourcePackage);
     $iconSetPath = $bsbPath . DIRECTORY_SEPARATOR . "Resources" . DIRECTORY_SEPARATOR . "public" . DIRECTORY_SEPARATOR . self::$iconSetsPaths[$iconSet];
     $finder->files()->in($iconSetPath);
     foreach ($finder as $file) {
         $fs->copy($file->getRealpath(), $iconWebPath . DIRECTORY_SEPARATOR . $file->getRelativePathname());
     }
     $output->writeln("Font: " . $iconSet . " Installed... <info>OK</info>");
 }
コード例 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     if ($input->getOption('manual')) {
         list($symlinkTarget, $symlinkName) = $this->getBootstrapPathsfromUser();
     } elseif (false !== ($composer = ComposerAdapter::getComposer($input, $output))) {
         $cmanager = new ComposerPathFinder($composer);
         $options = array('targetSuffix' => DIRECTORY_SEPARATOR . "Resources" . DIRECTORY_SEPARATOR . "bootstrap-sass", 'sourcePrefix' => '..' . DIRECTORY_SEPARATOR);
         list($symlinkTarget, $symlinkName) = $cmanager->getSymlinkFromComposer(self::$mopaBootstrapBundleName, self::$twitterBootstrapName, $options);
     } else {
         $this->output->writeln("<error>Could not find composer and manual option not secified!</error>");
         return;
     }
     $this->output->write("Checking Symlink");
     if (false === self::checkSymlink($symlinkTarget, $symlinkName, true)) {
         $this->output->writeln(" ... <comment>not existing</comment>");
         $this->output->writeln("Creating Symlink: " . $symlinkName);
         $this->output->write("for Target: " . $symlinkTarget);
         self::createSymlink($symlinkTarget, $symlinkName);
     }
     $this->output->writeln(" ... <info>OK</info>");
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     if ($input->getOption('manual')) {
         list($symlinkTarget, $symlinkName) = $this->getBootstrapPathsfromUser();
     } elseif (false !== ($composer = ComposerAdapter::getComposer($input, $output))) {
         $targetPath = $this->getContainer()->getParameter("mopa_bootstrap.bootstrap.install_path");
         $cmanager = new ComposerPathFinder($composer);
         $options = array('targetSuffix' => DIRECTORY_SEPARATOR . $targetPath . static::$targetSuffix, 'sourcePrefix' => '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
         list($symlinkTarget, $symlinkName) = $cmanager->getSymlinkFromComposer(self::$mopaBootstrapBundleName, $this->getTwitterBootstrapName(), $options);
     } else {
         $this->output->writeln("<error>Could not find composer and manual option not specified!</error>");
         return;
     }
     // Automatically detect if on Win XP where symlink will allways fail
     if ($input->getOption('no-symlink') or PHP_OS == "WINNT") {
         $this->output->write("Checking destination");
         if (true === self::checkSymlink($symlinkTarget, $symlinkName)) {
             $this->output->writeln(" ... <comment>symlink already existing</comment>");
         } else {
             $this->output->writeln(" ... <comment>not existing</comment>");
             $this->output->writeln("Mirroring from: " . $symlinkName);
             $this->output->write("for Target: " . $symlinkTarget);
             self::createMirror($symlinkTarget, $symlinkName);
         }
     } else {
         $this->output->write("Checking Symlink");
         if (false === self::checkSymlink($symlinkTarget, $symlinkName, true)) {
             $this->output->writeln(" ... <comment>not existing</comment>");
             $this->output->writeln("Creating Symlink: " . $symlinkName);
             $this->output->write("for Target: " . $symlinkTarget);
             self::createSymlink($symlinkTarget, $symlinkName);
         }
     }
     $this->output->writeln(" ... <info>OK</info>");
 }