Exemple #1
0
 protected function getCommand($target, $version, $command)
 {
     $basepath = $path = $this->transporter->getPath();
     if (isset($this->options['path']) && $this->options['path']) {
         $path = FilePath::join($basepath, $this->options['path']);
     }
     $command = sprintf('cd %s && %s', $path, $command);
     return $command;
 }
 /**
  * Creates shared files and folders
  */
 protected function prepareSharedFilesAndFolders(Context $context)
 {
     $basepath = $this->transporter->getPath();
     $sharedPath = $basepath . '/shared';
     $shared = (array) $this->options['shared'];
     // add some white space to the output
     if (count($shared) > 0) {
         $this->io->write('');
     }
     foreach ($shared as $fileOrFolder) {
         $sharedFilepath = $sharedPath . '/' . $fileOrFolder;
         $localFilepath = $context->getBuilddir() . '/' . $fileOrFolder;
         if (false === $this->transporter->exists($sharedFilepath)) {
             // Hmm, the shared entity doesn't exist
             // is it a directory?
             if (is_dir($localFilepath) || '/' === substr($sharedFilepath, -1)) {
                 $this->transporter->mkdir($sharedFilepath);
             } else {
                 $parentDir = dirname($sharedFilepath);
                 if (false === $this->transporter->exists($parentDir) && $parentDir != $sharedPath) {
                     $this->transporter->mkdir($parentDir);
                 }
                 $this->transporter->putContent('', $sharedFilepath);
                 // make a dummy file
             }
         }
     }
 }
 public function setOptions(array $options)
 {
     // if the host, username or password changes, we should disconnect
     if ($this->host !== $options['host'] || $this->username !== $options['user'] || $this->password !== $options['pass']) {
         $this->sftp->disconnect();
     }
     parent::setOptions($options);
 }
 public function testRemoveDispatchesEvent()
 {
     $this->getDispatcherMock()->expects($this->once())->method('dispatch')->with(TransporterEvents::TRANSPORTER_REMOVE, $this->anything());
     $this->transporter->remove($this->transporter->getPath() . '/a/path');
 }
 public function ls($path)
 {
     return $this->innerTransporter->ls($path);
 }
 public function __construct(EventDispatcherInterface $dispatcher, Cli $cli)
 {
     parent::__construct($dispatcher);
     $this->cli = $cli;
 }
Exemple #7
0
 /**
  * Check in the remote if a current release exists
  *
  * @param Context $context
  *
  * @return bool
  */
 protected function currentReleaseExists(Context $context)
 {
     return $this->transporter->exists(FilePath::join($this->transporter->getPath(), $context->getStrategy()->getCurrentReleasePath()));
 }