コード例 #1
0
ファイル: Maneuver.php プロジェクト: Penderis/penderis.co.za
 /**
  * Handles the upload and delete processes
  *
  * @param \Fadion\Maneuver\Deploy $deploy
  * @return bool
  */
 public function push($deploy)
 {
     // Compare local revision to the remote one, to
     // build files to upload and delete.
     $message = $deploy->compare();
     print $message;
     print "\n+ --------------- + --------------- +";
     $dirty = false;
     $filesToUpload = $deploy->getFilesToUpload();
     $filesToDelete = $deploy->getFilesToDelete();
     if ($filesToUpload) {
         foreach ($filesToUpload as $file) {
             // On list mode, just print the file.
             if ($this->mode == self::MODE_LIST) {
                 print "\n√ {$file} will be uploaded";
                 continue;
             }
             $output = $deploy->upload($file);
             // An upload procedure may have more than one
             // output message (uploaded file, created dir, etc).
             foreach ($output as $message) {
                 print "\n" . $message;
             }
         }
     }
     if ($filesToDelete) {
         foreach ($filesToDelete as $file) {
             // On list mode, just print the file.
             if ($this->mode == self::MODE_LIST) {
                 print "\n× {$file} will be removed";
                 continue;
             }
             print "\n" . $deploy->delete($file);
         }
     }
     // Files were uploaded or deleted, so mark
     // it as dirty.
     if ($filesToUpload or $filesToDelete) {
         $dirty = true;
     }
     return $dirty;
 }