-
Notifications
You must be signed in to change notification settings - Fork 0
/
TgCommands.php
63 lines (56 loc) · 2 KB
/
TgCommands.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* This is project's local console commands configuration for Tg Robo task runner.
* Write this file the same as any Robo file
* @see http://robo.li/
*/
use Symfony\Component\Finder\Finder;
use twhiston\tg\Tasks\TgTasks;
class TgCommands extends TgTasks
{
/**
* build a phar, run it as php ./src/tg phar:build
*/
public function pharBuild()
{
$collection = $this->collection();
$this->taskComposerInstall()
->noDev()
->preferDist()
->printed(true)
->run();
$packer = $this->taskPackPhar('tg.phar');
$files = Finder::create()->ignoreVCS(true)
->files()
->name('*.php')
->name('CommandCacheMap.yml')
->name('RoboCommandCacheMap.yml')
->notName('dev.yml')//no dev modes
->path('src')
->path('cache')
->path('vendor')
->exclude('vendor/psr/log/Psr/Log/Test')
->exclude('vendor/symfony/config/Symfony/Component/Config/Tests')
->exclude('vendor/symfony/console/Tests')
->exclude('vendor/symfony/event-dispatcher/Tests')
->exclude('vendor/symfony/filesystem/Tests')
->exclude('vendor/symfony/finder/Tests')
->exclude('vendor/symfony/process/Tests')
->exclude('vendor/henrikbjorn/lurker/tests')
->exclude('vendor/symfony/yaml/Tests')
->exclude('vendor/twhiston/twlib/tests')
->exclude('vendor/codegyre/robo/tests')
->exclude('vendor/twig/twig/test')
->in(__DIR__);
foreach ($files as $file) {
$packer->addFile($file->getRelativePathname(), $file->getRealPath());
}
$packer->addFile('/src/tg', __DIR__ . '/src/tg')
->executable(__DIR__ . '/src/tg')
->addToCollection($collection);
$this->taskComposerInstall()
->printed(false)
->addToCollection($collection);
$collection->run();
}
}