Example #1
0
 public function execute(Context $context)
 {
     if (true !== $this->validateBuildDir($context->isForce())) {
         return false;
     }
     $this->io->write('');
     $this->io->write(sprintf('Building <info>%s</info> (<comment>%s</comment>) to <info>%s</info>', $context->getVersion()->getName(), $context->getTarget(), $context->getBuilddir()));
     $this->io->increaseIndention(1);
     $this->builder->setContext($context);
     $this->builder->build($context->getTarget(), $context->getVersion());
     $this->io->decreaseIndention(1);
     return true;
 }
 protected function compareRemoteVersionBuild(Context $context)
 {
     if ($context->isFullDeploy()) {
         return true;
     }
     if ($context->getVersion()->equals($context->getRemoteVersion())) {
         $this->io->write('Remote version is already up-to-date.', true);
         return false;
     } elseif (1 === $this->repository->versionCompare($context->getRemoteVersion(), $context->getVersion())) {
         if ($context->isForce()) {
             $answer = true;
         } else {
             $answer = $this->io->askConfirmation(sprintf('Remote version (%s) is newer than the selected version (%s). ' . 'Would you like to continue as full deploy? (Y/n): ', $context->getRemoteVersion()->getBuild(), $context->getVersion()->getBuild()), 'Y');
         }
         if ($answer) {
             $context->setFullDeploy(true);
         } else {
             return false;
         }
     }
     return true;
 }
 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;
 }