setName('sync')
->setDescription('Performs a synchronization of your site')
->setHelp('The sync command performs a synchronization of your site. Useful if you want to run a periodic crontab job to automate it.')
;
}
protected function serve()
{
require_once __DIR__ . '/../vendor/autoload.php';
$plugin = new GitSync();
$repository = $plugin->getConfig('repository', false);
$this->output->writeln('');
if (!$repository) {
$this->output->writeln('ERROR: No repository has been configured');
}
$this->output->writeln('Synchronizing with ' . $repository . '');
if ($plugin->hasChangesToCommit()) {
$this->output->writeln('Changes detected, adding and committing...');
$plugin->add();
$plugin->commit();
}
$this->output->write('Starting Synchronization...');
$plugin->sync();
$this->output->writeln('completed.');
}
}