예제 #1
0
 /**
  * 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
             }
         }
     }
 }
예제 #2
0
 /**
  * Checks if a file or directory exists on the remote server
  *
  * @param  string $path remote source path
  * @return bool   true when the resource exists, false otherwise
  */
 public function exists($path)
 {
     return $this->innerTransporter->exists($path);
 }
예제 #3
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()));
 }