protected function execute(InputInterface $input, OutputInterface $output)
{
$tmp = '/tmp/pagekit-languages';
$repo = '[email protected]:pagekit/languages.git';
// if cloned repo exists? rm
if (file_exists($tmp)) {
exec(sprintf('rm -rf %s', $tmp));
}
// git clone to tmp
exec(sprintf("git clone %s %s", $repo, $tmp));
// foreach resource:
$resources = ['system', 'blog', 'theme-one'];
// mv translation files to correct folder
foreach ($resources as $resource) {
$from = sprintf("%s/%s/*", $tmp, $resource);
if ($to = $this->getPath($resource)) {
$this->info("[{$resource}] Moving languages files to: " . $to);
exec(sprintf('rsync -av %s %s', $from, $to));
} else {
$this->error("[{$resource}] Package not found. Skipping.");
}
}
// rm git repo from tmp
exec(sprintf('rm -rf %s', $tmp));
}