public function execute(Context $context)
 {
     if ($this->io) {
         $this->io->write(sprintf('Wring remote info file'));
     }
     $version = $context->getVersion();
     $versionFile = FilePath::join($this->transporter->getPath(), $context->getStrategy()->getUploadPath($context->getVersion()), $this->remoteInfoFile);
     $this->transporter->putContent($version->getUID(), $versionFile);
 }
 protected function getRemoteVersion(Context $context)
 {
     if ($context->isFullDeploy()) {
         return;
     }
     $versionFile = FilePath::join($this->transporter->getPath(), $context->getStrategy()->getCurrentReleasePath(), $this->remoteInfoFile);
     $content = $this->transporter->get($versionFile);
     list($name, $build) = explode(':', trim($content));
     $context->setRemoteVersion(new Version($name, $build));
 }
Example #3
0
 protected function removeFiles(array $files, Context $context)
 {
     $total = count($files);
     foreach ($files as $t => $file) {
         $src = FilePath::join($context->getBuilddir(), $file);
         $dest = FilePath::join($this->getDestinationPath($context->getStrategy(), $context->getVersion()), $file);
         $this->transporter->remove($dest, true);
         if ($this->io && true === $this->showProgress) {
             $this->io->overwrite(sprintf('Progress: <comment>%d%%</comment>', ($t + 1) * 100 / $total), false);
         }
     }
 }
Example #4
0
 public function execute(Context $context)
 {
     $target = $context->getTarget();
     $version = $context->getVersion();
     $strategy = $context->getStrategy();
     $tasks = $this->getSupportedTasks($target, $version);
     $this->taskRunner->setTasks($tasks);
     if (true === $this->taskRunner->hasTasks()) {
         foreach ($this->taskRunner->getTasks() as $task) {
             if ($task instanceof SshTask) {
                 $task->setOption('path', $strategy->getUploadPath($version));
             }
         }
         $this->executeTaskrunner($context);
     }
 }
 protected function validateRemoteVersionFile(Context $context)
 {
     if ($context->isFullDeploy()) {
         return;
     }
     $versionFile = FilePath::join($this->transporter->getPath(), $context->getStrategy()->getCurrentReleasePath(), $this->remoteInfoFile);
     if (false == $this->transporter->exists($versionFile)) {
         if ($context->isForce()) {
             $answer = true;
         } else {
             $answer = $this->io->askConfirmation(sprintf('Remote version information not found. Would you like to do a full deploy? (Y/n): '), 'Y');
         }
         if ($answer) {
             $context->setFullDeploy(true);
         } else {
             return false;
         }
     }
     return true;
 }