Global bash script with Linux and OSX compatibility.

This commit is contained in:
marco
2015-08-14 23:39:38 +02:00
parent 0b0539dc83
commit 745700e5fe
4 changed files with 53 additions and 52 deletions

View File

@ -48,15 +48,15 @@ class RoboFile extends \Robo\Tasks {
function makepot() {
$this->_exec('grunt makepot'.
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__
);
}
function pushpot() {
$this->_exec('grunt pushpot'.
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__
);
}
@ -104,53 +104,6 @@ class RoboFile extends \Robo\Tasks {
$this->_exec('vendor/bin/codecept run unit --debug');
}
function zip() {
$rootPath = realpath('wysija-newsletters');
$zip = new ZipArchive();
$zip->open('mailpoet.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$directory = new \RecursiveDirectoryIterator(
$rootPath, \FilesystemIterator::FOLLOW_SYMLINKS
);
$filter = new \RecursiveCallbackFilterIterator(
$directory, function ($current, $key, $iterator) {
return ($current->getFilename()[0] !== '.');
}
);
$files = new \RecursiveIteratorIterator($filter);
foreach ($files as $name => $file) {
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($rootPath) + 1);
$zip->addFile($filePath, $relativePath);
}
$zip->close();
}
function build() {
$this->_exec('mkdir wysija-newsletters');
$this->_exec('mkdir wysija-newsletters/vendor');
$this->_exec('cp index.php wysija-newsletters/index.php');
$this->_exec('cp mailpoet.php wysija-newsletters/mailpoet.php');
$this->_exec('cp package.json wysija-newsletters/package.json');
$this->_exec('cp composer.* wysija-newsletters/');
$this->taskCopyDir(array(
'assets' => 'wysija-newsletters/assets',
'lang' => 'wysija-newsletters/lang',
'lib' => 'wysija-newsletters/lib',
'views' => 'wysija-newsletters/views'
))->run();
chdir('./wysija-newsletters');
$this->taskExecStack()
->stopOnFail()
// ->exec('cd wysija-newsletters') does not work as intended
->exec('./composer.phar install --no-dev')
->run();
chdir('..');
$this->_exec('rm wysija-newsletters/package.json');
$this->_exec('rm wysija-newsletters/composer.*');
$this->zip();
$this->taskDeleteDir('wysija-newsletters')->run();
}
protected function loadEnv() {
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();