2011-12-26 14:49:33 +00:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
2012-01-06 15:28:42 +00:00
|
|
|
/**
|
|
|
|
* Builds the Chat
|
|
|
|
*
|
|
|
|
* @author Tim Düsterhus
|
|
|
|
* @copyright 2010-2012 Tim Düsterhus
|
|
|
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
|
|
|
* @package timwolla.wcf.chat
|
|
|
|
*/
|
2012-01-06 15:15:40 +00:00
|
|
|
echo <<<EOT
|
|
|
|
Cleaning up
|
|
|
|
-----------
|
|
|
|
|
|
|
|
EOT;
|
|
|
|
if (file_exists('file.tar')) unlink('file.tar');
|
|
|
|
if (file_exists('template.tar')) unlink('template.tar');
|
2012-02-04 19:50:18 +00:00
|
|
|
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
2012-01-06 15:15:40 +00:00
|
|
|
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
|
|
|
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
|
|
|
if (file_exists('timwolla.wcf.chat.tar')) unlink('timwolla.wcf.chat.tar');
|
|
|
|
echo <<<EOT
|
|
|
|
|
|
|
|
Building JavaScript
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
EOT;
|
|
|
|
foreach (glob('file/js/*.coffee') as $coffeeFile) {
|
|
|
|
echo $coffeeFile."\n";
|
2012-01-06 15:32:12 +00:00
|
|
|
passthru('coffee -cb '.escapeshellarg($coffeeFile), $code);
|
|
|
|
if ($code != 0) exit($code);
|
2012-01-06 15:15:40 +00:00
|
|
|
}
|
|
|
|
echo <<<EOT
|
|
|
|
|
|
|
|
Building CSS
|
|
|
|
------------
|
|
|
|
|
|
|
|
EOT;
|
|
|
|
foreach (glob('file/style/*.scss') as $sassFile) {
|
|
|
|
echo $sassFile."\n";
|
2012-01-06 15:32:12 +00:00
|
|
|
passthru('scss '.escapeshellarg($sassFile).' '.escapeshellarg(substr($sassFile, 0, -4).'css'), $code);
|
|
|
|
if ($code != 0) exit($code);
|
2012-01-06 15:15:40 +00:00
|
|
|
}
|
|
|
|
echo <<<EOT
|
|
|
|
|
|
|
|
Building file.tar
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
EOT;
|
|
|
|
chdir('file');
|
2012-01-07 15:31:20 +00:00
|
|
|
passthru('tar cvf ../file.tar * --exclude=*.coffee --exclude=*.scss', $code);
|
2012-01-06 15:32:12 +00:00
|
|
|
if ($code != 0) exit($code);
|
2012-01-06 15:15:40 +00:00
|
|
|
echo <<<EOT
|
|
|
|
|
|
|
|
Building template.tar
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
EOT;
|
|
|
|
chdir('../template');
|
2012-01-06 15:32:12 +00:00
|
|
|
passthru('tar cvf ../template.tar *', $code);
|
|
|
|
if ($code != 0) exit($code);
|
2012-01-06 15:15:40 +00:00
|
|
|
echo <<<EOT
|
|
|
|
|
2012-02-04 19:50:18 +00:00
|
|
|
Building acptemplate.tar
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
EOT;
|
|
|
|
chdir('../acptemplate');
|
|
|
|
passthru('tar cvf ../acptemplate.tar *', $code);
|
|
|
|
if ($code != 0) exit($code);
|
|
|
|
echo <<<EOT
|
|
|
|
|
2012-01-06 15:15:40 +00:00
|
|
|
Building timwolla.wcf.chat.tar
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
EOT;
|
|
|
|
chdir('..');
|
2012-03-04 17:20:32 +00:00
|
|
|
file_put_contents('package.xml.bak', file_get_contents('package.xml'));
|
|
|
|
file_put_contents('package.xml', str_replace('</version>', '.'.time().'</version>', file_get_contents('package.xml')));
|
|
|
|
passthru('tar cvf timwolla.wcf.chat.tar * --exclude=*.bak --exclude=file --exclude=template --exclude=acptemplate --exclude=build.php', $code);
|
|
|
|
file_put_contents('package.xml', file_get_contents('package.xml.bak'));
|
2012-01-06 15:32:12 +00:00
|
|
|
if ($code != 0) exit($code);
|
2012-01-06 15:15:40 +00:00
|
|
|
|
2012-03-04 17:20:32 +00:00
|
|
|
if (file_exists('package.xml.bak')) unlink('package.xml.bak');
|
2012-01-06 15:15:40 +00:00
|
|
|
if (file_exists('file.tar')) unlink('file.tar');
|
|
|
|
if (file_exists('template.tar')) unlink('template.tar');
|
2012-02-04 19:50:18 +00:00
|
|
|
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
2012-01-06 15:15:40 +00:00
|
|
|
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
|
|
|
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|