-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFrontEnd.php
55 lines (45 loc) · 1.3 KB
/
FrontEnd.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
<?php
namespace Solire\Install;
use Composer\Script\Event;
use Solire\Conf\Loader as ConfLoader;
use Solire\Lib\Path;
/**
* Install front end tools.
*
* @author thansen <thansen@solire.fr>
* @license CC by-nc http://creativecommons.org/licenses/by-nc/3.0/fr/
*/
class FrontEnd
{
const SCRIPT = 'bin/frontEnd';
/**
* A composer installation script to make symlinks.
*
* @param Event $event The composer event
*
* @return void
*/
public static function install(Event $event)
{
$extra = $event->getComposer()->getPackage()->getExtra();
$conf = ConfLoader::load($extra['solire']['frontEnd']['dirs']);
$cmd = __DIR__ . Path::DS . self::SCRIPT . ' %s';
foreach ($conf->dirs as $targetName) {
$targetDirPath = new Path(
$targetName,
Path::SILENT
);
if ($targetDirPath->get() === false) {
continue;
}
$targetDir = $targetDirPath->get();
$msg = sprintf(
'<info>Installation du Front End "%s"</info>',
$targetDir
);
$event->getIO()->write($msg);
$output = shell_exec(sprintf($cmd, $targetDir));
$event->getIO()->write($output);
}
}
}