예제 #1
0
 /**
  * {@inheritdoc}
  */
 protected function executeCommandByProject($projectName, ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $this->getSshExec()->passthru(strtr('cd %project_dir% && /usr/local/bin/sami update sami_config.php' . ($output->isDebug() ? ' -v' : ''), ['%project_dir%' => $projectConfig->getRemoteWebappDir()]));
     $localBuildDir = sprintf('%s/build/apidoc', $projectConfig->getLocalWebappDir());
     $apiDocIndexFilepath = strtr('%build_dir%/index.html', ['%project_name%' => $projectConfig->getProjectName(), '%build_dir%' => $localBuildDir]);
     if (file_exists($apiDocIndexFilepath)) {
         $this->openFile($apiDocIndexFilepath);
     }
 }
예제 #2
0
 /**
  * @{inheritdoc}
  */
 protected function executeCommandByProject($projectName, ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $this->getApplication()->executeCommand('project:symfony:cache:clear', ['--project-name' => $projectName, '--symfony-env' => ['test']], $output);
     $buildReportHtmlPath = !empty($this->remoteBuildDir) ? '--testdox-html ' . $this->remoteBuildDir . '/tests/integration.html' : null;
     $this->getSshExec()->exec(strtr('phpunit --configuration %remote_phpunit_configuration_xml_path%  --colors %build_report_html% ' . ($output->isDebug() ? ' --verbose --debug' : ''), ['%project_dir%' => $projectConfig->getRemoteWebappDir(), '%remote_phpunit_configuration_xml_path%' => $projectConfig->getRemotePhpunitConfigurationXmlPath(), '%build_report_html%' => $buildReportHtmlPath]));
     if ($this->displayStatusText) {
         $output->writeln(sprintf('<comment>Executes integration tests for project "<info>%s</info>"</comment>: %s', $projectName, $this->getSshExec()->getLastReturnStatus() == 0 ? ' <info>SUCCESS</info>' : ' <error>ERROR</error>'));
     }
     return $this->getSshExec()->getLastReturnStatus();
 }
예제 #3
0
 /**
  * @{inheritdoc}
  */
 protected function executeCommandByProject($projectName, ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $output->writeln(sprintf('<comment>%s for project "<info>%s</info>"</comment>', $this->getDescription(), $projectName));
     if (strpos($projectName, 'bundle') === false) {
         $commandLine = 'php-parallel-lint -e php -j 10 %project_dir%/app %project_dir%/src %project_dir%/web --exclude %project_dir%/vendor';
     } else {
         $commandLine = 'php-parallel-lint -e php -j 10 %project_dir%/src';
     }
     $this->getSshExec()->run(strtr($commandLine, ['%project_dir%' => $projectConfig->getRemoteWebappDir()]), $output, OutputInterface::VERBOSITY_NORMAL);
     return $this->getSshExec()->getLastReturnStatus();
 }
예제 #4
0
 /**
  * @{inheritdoc}
  */
 protected function executeCommandByProject($projectName, ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $remoteReportFilePath = strtr('%build_dir%/%project_name%.html', ['%project_name%' => $projectConfig->getProjectName(), '%build_dir%' => $this->remoteBuildDir]);
     // Analyse source project code
     $this->getSshExec()->passthru(strtr('mkdir -p %build_dir% && /usr/local/bin/phpmetrics --level=0 --report-html=%report_file% %project_dir%/src' . ($output->isDebug() ? ' --verbose' : ''), ['%report_file%' => $remoteReportFilePath, '%build_dir%' => $this->remoteBuildDir, '%project_dir%' => $projectConfig->getRemoteWebappDir()]));
     $localReportFilePath = str_replace($this->remoteBuildDir, $this->localBuildDir, $remoteReportFilePath);
     $this->getRemoteFilesystem()->copyRemoteFileToLocal($remoteReportFilePath, $localReportFilePath);
     if ($this->getLocalFilesystem()->exists($localReportFilePath)) {
         $this->openFile($localReportFilePath);
     }
     return $this->getSshExec()->getLastReturnStatus();
 }
예제 #5
0
 /**
  * @{inheritdoc}
  */
 protected function executeCommandByProject($projectName, ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $this->getSshExec()->passthru(strtr('cd %project_dir% && phpspec run --format=%format% --stop-on-failure ' . ($output->isDebug() ? ' --verbose' : ''), ['%format%' => $this->format, '%project_dir%' => $projectConfig->getRemoteWebappDir()]));
     $buildDir = $this->remoteBuildDir . '/tests';
     $this->getRemoteFilesystem()->mkdir($buildDir);
     $report = $this->getSshExec()->exec(strtr('cd %project_dir% && phpspec run --format=html --no-interaction > %build_dir%/unit.html', ['%project_dir%' => $projectConfig->getRemoteWebappDir(), '%build_dir%' => $buildDir]));
     $this->getRemoteFilesystem()->syncRemoteToLocal($this->remoteBuildDir, $this->localBuildDir, ['delete' => true]);
     $statusCode = $this->getSshExec()->getLastReturnStatus() == 0 && strpos($report, 'broken') === false ? 0 : 1;
     if ($this->displayStatusText) {
         $output->writeln(sprintf('<comment>Executes unit tests for project "<info>%s</info>"</comment>: %s', $projectName, $statusCode == 0 ? '<info>SUCCESS</info>' : '<error>ERROR</error>'));
     }
     return $statusCode;
 }
예제 #6
0
 /**
  * {@inheritdoc}
  */
 protected function executeCommandByProject($projectName, ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $remoteBuildDir = sprintf('%s/apidoc', $this->getRemoteBuildDir());
     $localBuildDir = sprintf('%s/apidoc', $this->getLocalBuildDir());
     $this->getSshExec()->run(strtr('cd %project_dir% && sami.php update sami_config.php', ['%project_dir%' => $projectConfig->getRemoteWebappDir()]), $output, OutputInterface::VERBOSITY_NORMAL);
     $this->getRemoteFilesystem()->mkdir($remoteBuildDir);
     $this->getLocalFilesystem()->mkdir($localBuildDir);
     $this->getRemoteFilesystem()->syncRemoteToLocal($remoteBuildDir, $localBuildDir, ['delete' => true]);
     $apiDocIndexFilepath = strtr('%build_dir%/index.html', ['%project_name%' => $projectConfig->getProjectName(), '%build_dir%' => $localBuildDir]);
     if (file_exists($apiDocIndexFilepath)) {
         $this->openFile($apiDocIndexFilepath);
     }
 }
예제 #7
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;
 }
예제 #8
0
 /**
  * @{inheritdoc}
  */
 protected function executeCommandByProject($projectName, ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $this->getSshExec()->passthru(strtr('cd %project_dir%;%command_name%', ['%project_dir%' => $projectConfig->getRemoteWebappDir(), '%command_name%' => escapeshellcmd($this->commandName)]));
     return $this->getSshExec()->getLastReturnStatus();
 }
예제 #9
0
 /**
  * @{inheritdoc}
  */
 protected function executeCommandByProject($projectName, ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $output->writeln(sprintf('<comment>%s for project "<info>%s</info>"</comment>', $this->getDescription(), $projectName));
     return $this->getPhpCsFixer()->fixRemoteDir($projectConfig->getRemoteWebappDir(), $output, ['level' => $this->level, 'dry-run' => !$this->fixCodingStandardProblems]);
 }
예제 #10
0
 /**
  * @param string               $commandName
  * @param ProjectConfiguration $projectConfig
  * @param OutputInterface      $output
  *
  * @return int Exit code
  */
 protected function executeComposerCommandOnRemoteServer($commandName, ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     $output->writeln('<comment>' . $this->getDescription() . '</comment>');
     $this->getSshExec()->passthru(strtr('COMPOSER_VENDOR_DIR=%COMPOSER_VENDOR_DIR% composer %command_name% %command_options% --working-dir=%project_dir% ' . ($output->isDebug() ? ' -vvv' : ''), ['%COMPOSER_VENDOR_DIR%' => $projectConfig->getRemoteVendorDir(), '%command_name%' => $commandName, '%command_options%' => is_array($this->commandOptions) ? implode(' ', $this->commandOptions) : null, '%project_dir%' => $projectConfig->getRemoteWebappDir()]));
     return $this->getSshExec()->getLastReturnStatus();
 }
 protected function getGraphComposer(ProjectConfiguration $projectConfig)
 {
     $composerJsonFileContent = $this->getRemoteFilesystem()->getRemoteFileContent($projectConfig->getRemoteWebappDir() . '/composer.json');
     $composerLockFileContent = $this->getRemoteFilesystem()->getRemoteFileContent($projectConfig->getRemoteWebappDir() . '/composer.lock');
     $installedFileContent = $this->getRemoteFilesystem()->getRemoteFileContent($projectConfig->getRemoteVendorDir() . '/composer/installed.json');
     if (null === $this->dependencyAnalyzer) {
         $this->dependencyAnalyzer = new DependencyAnalyzer();
     }
     $dependencyGraph = $this->dependencyAnalyzer->analyze($composerJsonFileContent, $composerLockFileContent, $installedFileContent);
     $class = $this->getGraphComposerClass();
     return new $class($dependencyGraph);
 }