Example #1
0
 /**
  * The output is a remote one.
  * So we need to sync to a local directory first,
  * commit the changes and sync to changes to the
  * actual output.
  *
  * @param SyncContract         $sync
  * @param SyncOutputContract   $output
  * @param SyncSettingsContract $settings
  */
 protected function remote(SyncContract &$sync, SyncOutputContract $output, SyncSettingsContract $settings)
 {
     // Display starting msg
     $output->out(SyncOutput::VERSIONING_SYNC_TO_LOCAL);
     // Set git to remote
     $this->git->remote();
     $this->git->init();
     // Sync to local git repo
     $localSettings = new SyncSettings($settings->excludeInput(), ['.git/**/*', '**/.gitignore', '**/.gitkeep'], $settings->ignoreInput(), true, true);
     $localSync = Application::createSync($sync->getInput(), $this->git->getOutputHandler(), $localSettings, $sync->getOutputHelper());
     $localSync->init();
     $localSync->sync();
     // Free some RAM
     unset($localSync);
     $output->out(SyncOutput::MISC_LINE_BREAK);
     // Commit
     $this->commit($output);
     $output->out(SyncOutput::VERSIONING_SYNC_TO_OUTPUT);
     // Modify existing sync object to take the local git repository as input
     $sync->setInput($this->git->getInputHandler());
     $sync->setSettings(new SyncSettings([], $settings->excludeOutput(), true, $settings->ignoreOutput(), true));
 }