/** * Run the Middleware processes and then our actual sync process. * * @throws PropertyNotSetException */ public function run() { if (!isset($this->sync)) { throw new PropertyNotSetException('sync'); } $this->sortMiddleware(); foreach ($this->middleware as $index => $middleware) { $middleware->beforeProcess($this->sync); } $this->sync->init(); $this->sync->sync(); foreach ($this->middleware as $index => $middleware) { $middleware->afterProcess($this->sync); } }
/** * After process. * * @param SyncContract $sync */ public function afterProcess(SyncContract &$sync) { // Get output & console $console = $sync->getOutputHelper(); $output = $sync->getOutput(); // Display some stuff $console->out(SyncOutput::MISC_LINE_BREAK); $console->out(SyncOutput::ENC_START_ENCRYPTION); $console->out(SyncOutput::MISC_LINE_BREAK); // Encrypt $this->encrypt($output, $output, $console); $console->out(SyncOutput::MISC_LINE_BREAK); }
/** * This is a local one. * Just sync and commit then. * * @param SyncContract $sync * @param SyncOutputContract $output * @param LocalOutput $outputHandler * @param SyncSettingsContract $settings */ protected function local(SyncContract &$sync, SyncOutputContract $output, LocalOutput $outputHandler, SyncSettingsContract $settings) { // Set git to local $this->git->local($outputHandler); $this->git->init(); // Override the settings for versioning $settings->setExcludeOutput(array_merge($settings->excludeOutput(), ['.git/**/*', '**/.gitignore', '**/.gitkeep'])); $settings->setDelete(true); $sync->setSettings($settings); }