Пример #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
 /**
  * @param ProjectConfiguration $projectConfig
  * @param OutputInterface      $output
  *
  * @return int Exit code
  */
 protected function createRemoteVendorDir(ProjectConfiguration $projectConfig, OutputInterface $output)
 {
     if ($output->isVeryVerbose()) {
         $output->writeln(sprintf('<comment>Creates composer autoload file for use vendor dir "<info>%s</info>" for project "<info>%s</info>"</comment>', $projectConfig->getRemoteVendorDir(), $projectConfig->getProjectName()));
     }
     $filesystem = $this->getLocalFilesystem();
     $filesystem->remove($projectConfig->getLocalWebappDir() . '/vendor');
     $autoloadFilePath = $projectConfig->getLocalWebappDir() . '/vendor/autoload.php';
     $autoloadContent = sprintf('<?php return require \'%s/autoload.php\';', $projectConfig->getRemoteVendorDir());
     $filesystem->dumpFile($autoloadFilePath, $autoloadContent);
     if ($output->isVeryVerbose()) {
         $output->writeln(sprintf('<comment>Creates remote vendor dir for project "<info>%s</info>"</comment>', $projectConfig->getProjectName()));
     }
     $this->getSshExec()->exec(strtr('test -d %composer_vendor_dir% || mkdir -p %composer_vendor_dir%', ['%composer_vendor_dir%' => $projectConfig->getRemoteVendorDir()]));
     if (0 !== $this->getSshExec()->getLastReturnStatus()) {
         $this->getSshExec()->checkStatus($output);
     }
     return $this->getSshExec()->getLastReturnStatus();
 }