forked from mandango/MandangoBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvendors.php
51 lines (40 loc) · 1.33 KB
/
vendors.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
<?php
set_time_limit(0);
if (!is_dir($vendorDir = __DIR__.'/vendor')) {
mkdir($vendorDir, 0777, true);
}
if (isset($argv[1])) {
$_SERVER['SYMFONY_VERSION'] = $argv[1];
}
$deps = array(
array('symfony', 'git://github.com/symfony/symfony', isset($_SERVER['SYMFONY_VERSION']) ? $_SERVER['SYMFONY_VERSION'] : '2.0'),
array('twig', 'git://github.com/fabpot/Twig', 'origin/master'),
array('mondator', 'git://github.com/mandango/mondator', 'origin/master'),
array('mandango', 'git://github.com/mandango/mandango', 'origin/master'),
);
foreach ($deps as $dep) {
if (3 === count($dep)) {
list($name, $url, $rev) = $dep;
$target = null;
} else {
list($name, $url, $rev, $target) = $dep;
}
if (null === $rev) {
$rev = 'origin/master';
}
if (null !== $target) {
$installDir = $vendorDir.'/'.$target;
} else {
$installDir = $vendorDir.'/'.$name;
}
$install = false;
if (!is_dir($installDir)) {
$install = true;
echo "> Installing $name\n";
system(sprintf('git clone -q %s %s', escapeshellarg($url), escapeshellarg($installDir)));
}
if (!$install) {
echo "> Updating $name\n";
}
system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
}