Exemple #1
0
 /**
  * @param Application $application
  * @return string
  */
 public function getWorkspacePath(Application $application)
 {
     $workspacePath = FLOW_PATH_DATA . 'Surf/';
     if ($application->hasOption('repositoryUrl')) {
         $urlParts = GeneralUtility::getUrlPartsFromRepositoryUrl($application->getOption('repositoryUrl'));
         $workspacePath .= preg_replace('/[^a-zA-Z0-9]/', '-', $urlParts['path']);
         $workspacePath .= '_' . substr(sha1($application->getOption('repositoryUrl')), 0, 5);
     } else {
         // Default
         $workspacePath .= $this->getName() . '/' . $application->getName();
     }
     return $workspacePath;
 }
 /**
  * Executes this task
  *
  * @param \TYPO3\Surf\Domain\Model\Node $node
  * @param \TYPO3\Surf\Domain\Model\Application $application
  * @param \TYPO3\Surf\Domain\Model\Deployment $deployment
  * @param array $options
  * @return void
  * @throws \TYPO3\Surf\Exception\TaskExecutionException
  */
 public function execute(Node $node, Application $application, Deployment $deployment, array $options = array())
 {
     $this->hosting = $application->getOption('hosting');
     $this->username = $options['username'];
     $this->hostname = $node->getHostname();
     $this->deployment = $deployment;
     $this->resourcePath = $this->packageManager->getPackage('Famelo.Surf.SharedHosting')->getResourcesPath() . 'Private/' . $this->hosting;
     $this->temporaryPath = FLOW_PATH_ROOT . '/Data/Temporary/Deployment/' . $this->hosting;
     if (!is_dir($this->temporaryPath)) {
         \TYPO3\Flow\Utility\Files::createDirectoryRecursively($this->temporaryPath);
     }
 }
 /**
  * @param \TYPO3\Surf\Domain\Model\Node $node
  * @param \TYPO3\Surf\Domain\Model\Application $application
  * @param \TYPO3\Surf\Domain\Model\Deployment $deployment
  * @param array $options
  * @throws \TYPO3\Surf\Exception\TaskExecutionException
  * @return void
  */
 public function execute(Node $node, Application $application, Deployment $deployment, array $options = array())
 {
     if ($application->getOption('transferMethod') == 'rsync') {
         $path = $deployment->getWorkspacePath($application);
         $node = $deployment->getNode('localhost');
         $command = 'beard patch';
     } else {
         $patch = $deployment->getApplicationReleasePath($application);
         $command = $application->getOption('phpPath') . ' beard.phar patch';
     }
     $command = sprintf('cd %s && %s', escapeshellarg($path), $command);
     $this->shell->executeOrSimulate($command, $node, $deployment);
 }