/** * 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√ [0;37m{$file}[0m [0;32mwill be uploaded[0m"; 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× [0;37m{$file}[0m [0;31mwill be removed[0m"; continue; } print "\n" . $deploy->delete($file); } } // Files were uploaded or deleted, so mark // it as dirty. if ($filesToUpload or $filesToDelete) { $dirty = true; } return $dirty; }