-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.php
57 lines (41 loc) · 1.3 KB
/
run.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
<?php
/*
* This file is part of the Sonata package.
*
* (c) Thomas Rabaix <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$rootDir = __DIR__;
require_once __DIR__ . '/app/bootstrap.php.cache';
use Symfony\Component\Console\Output\OutputInterface;
// reset data
$fs = new \Symfony\Component\Filesystem\Filesystem;
$output = new \Symfony\Component\Console\Output\ConsoleOutput();
function execute_commands($commands, $output)
{
foreach($commands as $command) {
$output->writeln(sprintf('<info>Executing : </info> %s', $command));
$p = new \Symfony\Component\Process\Process($command);
$p->setTimeout(null);
$p->run(function($type, $data) use ($output) {
$output->write($data, false, OutputInterface::OUTPUT_RAW);
});
if (!$p->isSuccessful()) {
return false;
}
$output->writeln("");
}
return true;
}
$commands = array(
'./app/console assets:install --symlink web',
'bower install'
);
$success = execute_commands($commands, $output);
if (!$success) {
$output->writeln('<info>An error occurs when running a command!</info>');
exit(1);
}
$output->writeln('<info>Done!</info>');