Example #1
0
 /**
  * @{inheritdoc}
  */
 protected function executeCommandByProject($projectName, ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $returnStatus = 0;
     foreach ($this->getSymfonyEnvs() as $symfonyEnv) {
         if (0 !== $returnStatus) {
             break;
         }
         $output->writeln(sprintf('<comment>%s for project "<info>%s</info>" and env "<info>%s</info>"</comment>', $this->getDescription(), $projectName, $symfonyEnv));
         if (!file_exists($projectConfig->getLocalVendorDir())) {
             $this->getApplication()->executeCommand('project:composer:install', ['--project-name' => $projectName], $output);
         }
         $this->getSymfonyRemoteConsoleExec()->run($projectConfig->getRemoteSymfonyConsolePath(), strtr('yaml:lint %project_dir%/src', ['%project_dir%' => $projectConfig->getRemoteWebappDir()]), $symfonyEnv, $output);
         $returnStatus = $this->getSymfonyRemoteConsoleExec()->getLastReturnStatus();
     }
     return $returnStatus;
 }
 protected function openProjectWithSublimeText(ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $projectConfigPath = sprintf('%s/sublimetext/%s.sublime-project', $this->configDir, $projectConfig->getProjectName());
     !$this->logger ?: $this->logger->debug(sprintf('Checks the existence of file %s', $projectConfigPath));
     if (!$this->getLocalFilesystem()->exists($projectConfigPath) || $this->rewritesConfigFile) {
         $configData = ['folders' => [['follow_symlinks' => false, 'name' => $projectConfig->getProjectName(), 'path' => realpath($projectConfig->getLocalGitRepositoryDir())], ['follow_symlinks' => false, 'name' => 'vendor', 'path' => realpath($projectConfig->getLocalVendorDir())]]];
         if ($projectConfig->getLocalAssetsDir()) {
             $configData['folders'][] = ['follow_symlinks' => false, 'name' => 'assets_project', 'path' => realpath($projectConfig->getLocalAssetsDir())];
         }
         foreach ($this->directoriesConfig as $configCommonDirectory) {
             $configData['folders'][] = $configCommonDirectory;
         }
         $content = json_encode($configData, JSON_PRETTY_PRINT);
         !$this->logger ?: $this->logger->debug(sprintf('Dumps project json config into a file "<info>%s</info>".', $projectConfigPath));
         $this->getLocalFilesystem()->dumpFile($projectConfigPath, $content);
     }
     if ('' !== exec('which subl')) {
         $commandLine = 'subl -n ' . $projectConfigPath . (defined('PHP_WINDOWS_VERSION_BUILD') ? '' : ' > `tty`');
         !$this->logger ?: $this->logger->debug(sprintf('Executes command line %s', $commandLine));
         system($commandLine);
     } else {
         $output->writeln('<error><info>subl</info> command not found</error>');
     }
 }
 /**
  * @param ProjectConfiguration $projectConfig
  * @param OutputInterface      $output
  *
  * @return int Exit code
  */
 protected function synchronizeRemoteProjectVendorToLocal(ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $output->writeln(sprintf('<comment>Synchronize remote project vendor to local for the project "<info>%s</info>"</comment>', $projectConfig->getProjectName()));
     $this->getLocalFilesystem()->mkdir($projectConfig->getLocalVendorDir());
     return $this->getRemoteFilesystem()->syncRemoteToLocal($projectConfig->getRemoteVendorDir(), $projectConfig->getLocalVendorDir(), ['delete' => true]);
 }