Upload translation files to Transifex via publish command [MAILPOET-855]

This commit is contained in:
Alexey Stoletniy
2017-03-16 15:11:38 +03:00
parent 18e2d26587
commit a0d2be50e8
4 changed files with 41 additions and 13 deletions

View File

@ -104,10 +104,24 @@ class RoboFile extends \Robo\Tasks {
);
}
function pushpot() {
return $this->collectionBuilder()
->addCode(array($this, 'txinit'))
->taskExec('tx push -s')
->run();
}
function packtranslations() {
return $this->collectionBuilder()
->addCode(array($this, 'txinit'))
->taskExec('./tasks/pack_translations.sh')
->run();
}
function txinit() {
// Define WP_TRANSIFEX_API_TOKEN env. variable
$this->loadEnv();
return $this->_exec('./tasks/pack_translations.sh');
return $this->_exec('./tasks/transifex_init.sh');
}
function testUnit($opts=['file' => null, 'xml' => false]) {
@ -311,6 +325,15 @@ class RoboFile extends \Robo\Tasks {
return $result;
}
public function publish($opts = ['force' => false]) {
return $this->collectionBuilder()
->addCode(array($this, 'pushpot'))
->addCode(function () use ($opts) {
return $this->svnPublish($opts);
})
->run();
}
protected function loadEnv() {
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();