-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTaskfile
More file actions
57 lines (43 loc) · 1.54 KB
/
Taskfile
File metadata and controls
57 lines (43 loc) · 1.54 KB
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
<?php
require 'vendor/autoload.php';
use Task\Plugin;
use Symfony\Component\Finder\Finder;
$project = new Task\Project('task/cli');
$project->inject(function ($container) {
$container['phpunit'] = new Plugin\PHPUnitPlugin;
$container['fs'] = new Plugin\FilesystemPlugin;
$container['ps'] = new Plugin\ProcessPlugin;
$container['box'] = new Plugin\BoxPlugin;
$container['phpunit'] = new Plugin\PHPUnitPlugin;
});
$project->addTask('test', ['phpunit', function ($phpunit) {
$phpunit->getCommand('./vendor/bin/phpunit')
->pipe($this->getOutput());
}]);
$project->addTask('build', ['build.clean', 'build.prepare', 'build.phar']);
$project->addTask('build.clean', ['fs', function ($fs) {
$fs->remove('./build');
}]);
$project->addTask('build.prepare', ['fs', 'ps', function ($fs, $ps) {
$output = $this->getOutput();
$base = __DIR__;
$build = "$base/build";
$finder = (new Finder)
->in("$base/src")
->in("$base/bin")
->append(["$base/composer.json"]);
$fs->mkdir($build);
$fs->mirror($base, $build, $finder);
$ps->build('composer', ['install', '--no-dev', '--prefer-dist'])
->setWorkingDirectory($build)
->pipe($output);
}]);
$project->addTask('build.phar', ['box', function ($box) {
$box->command('build')->pipe($this->getOutput());
}]);
$project->addTask('test', ['phpunit', function ($phpunit) {
$phpunit->getCommand()
->setConfiguration($this->getProperty('config', 'phpunit.xml'))
->pipe($this->getOutput());
}]);
return $project;