-
Notifications
You must be signed in to change notification settings - Fork 1
/
RoboFile.php
49 lines (40 loc) · 1.49 KB
/
RoboFile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
use Symfony\Component\Finder\Finder;
class RoboFile extends \Robo\Tasks
{
/**
* Build the PHAR file.
*/
public function buildPhar()
{
if (!file_exists('build/phar')) {
mkdir('build/phar', 0755, true);
}
if (!function_exists('token_get_all')) {
$this->say('<error>Function "token_get_all()" is not available. To create a smaller phar file, please install ....</error>');
}
$this->say('Preparing phar creation');
$packer = $this->taskPackPhar('build/phar/cssprites.phar');
$packer->compress();
$this->say('Adding files');
$finder = Finder::create()
->ignoreVCS(true)
->name('*.php')
->path('src')
->path('vendor')
->notPath('vendor/symfony/finder/Tests')
->notPath('vendor/symfony/console/Tests')
->notPath('vendor/symfony/jbroadway/urlify/tests')
->notPath('vendor/symfony/jbroadway/urlify/scripts')
->in(__DIR__);
foreach ($finder as $file) {
$packer->addStripped($file->getRelativePathname(), $file->getRealPath());
}
$packer->addFile('config/cssprites.json', 'config/cssprites.json');
$packer->addFile('bin/cssprites', 'bin/cssprites')->executable('bin/cssprites');
$this->say('Build phar');
$packer->run();
$this->say('Test build');
$this->taskExec('php build/phar/cssprites.phar -V')->run();
}
}