|
@@ -24,13 +24,13 @@ Specify a command to run:
|
|
|
|
|
|
install: install vendors as specified in deps or deps.lock (recommended)
|
|
install: install vendors as specified in deps or deps.lock (recommended)
|
|
update: update vendors to their latest versions (as specified in deps)
|
|
update: update vendors to their latest versions (as specified in deps)
|
|
- lock: lock vendors to their current versions
|
|
|
|
|
|
+
|
|
|
|
|
|
EOF
|
|
EOF
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
-if (!in_array($command = array_shift($argv), array('install', 'update', 'lock'))) {
|
|
|
|
|
|
+if (!in_array($command = array_shift($argv), array('install', 'update'))) {
|
|
exit(sprintf("Command \"%s\" does not exist.\n", $command));
|
|
exit(sprintf("Command \"%s\" does not exist.\n", $command));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -73,40 +73,38 @@ if (false === $deps) {
|
|
foreach ($deps as $name => $dep) {
|
|
foreach ($deps as $name => $dep) {
|
|
$dep = array_map('trim', $dep);
|
|
$dep = array_map('trim', $dep);
|
|
|
|
|
|
|
|
+ // revision
|
|
|
|
+ if (isset($versions[$name])) {
|
|
|
|
+ $rev = $versions[$name];
|
|
|
|
+ } else {
|
|
|
|
+ $rev = isset($dep['version']) ? $dep['version'] : 'origin/HEAD';
|
|
|
|
+ }
|
|
|
|
+
|
|
// install dir
|
|
// install dir
|
|
$installDir = isset($dep['target']) ? $vendorDir.'/'.$dep['target'] : $vendorDir.'/'.$name;
|
|
$installDir = isset($dep['target']) ? $vendorDir.'/'.$dep['target'] : $vendorDir.'/'.$name;
|
|
if (in_array('--reinstall', $argv)) {
|
|
if (in_array('--reinstall', $argv)) {
|
|
- if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
|
|
|
|
|
+ if (PHP_OS == 'WINNT') {
|
|
system(sprintf('rmdir /S /Q %s', escapeshellarg(realpath($installDir))));
|
|
system(sprintf('rmdir /S /Q %s', escapeshellarg(realpath($installDir))));
|
|
} else {
|
|
} else {
|
|
system(sprintf('rm -rf %s', escapeshellarg($installDir)));
|
|
system(sprintf('rm -rf %s', escapeshellarg($installDir)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if ('install' === $command || 'update' === $command) {
|
|
|
|
- echo "> Installing/Updating $name\n";
|
|
|
|
-
|
|
|
|
- // url
|
|
|
|
- if (!isset($dep['git'])) {
|
|
|
|
- exit(sprintf('The "git" value for the "%s" dependency must be set.', $name));
|
|
|
|
- }
|
|
|
|
- $url = $dep['git'];
|
|
|
|
-
|
|
|
|
- if (!is_dir($installDir)) {
|
|
|
|
- system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir)));
|
|
|
|
- }
|
|
|
|
|
|
+ echo "> Installing/Updating $name\n";
|
|
|
|
|
|
- // revision
|
|
|
|
- if (isset($versions[$name])) {
|
|
|
|
- $rev = $versions[$name];
|
|
|
|
- } else {
|
|
|
|
- $rev = isset($dep['version']) ? $dep['version'] : 'origin/HEAD';
|
|
|
|
- }
|
|
|
|
|
|
+ // url
|
|
|
|
+ if (!isset($dep['git'])) {
|
|
|
|
+ exit(sprintf('The "git" value for the "%s" dependency must be set.', $name));
|
|
|
|
+ }
|
|
|
|
+ $url = $dep['git'];
|
|
|
|
|
|
- system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
|
|
|
|
|
|
+ if (!is_dir($installDir)) {
|
|
|
|
+ system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir)));
|
|
}
|
|
}
|
|
|
|
|
|
- if ('update' === $command || 'lock' === $command) {
|
|
|
|
|
|
+ system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
|
|
|
|
+
|
|
|
|
+ if ('update' === $command) {
|
|
ob_start();
|
|
ob_start();
|
|
system(sprintf('cd %s && git log -n 1 --format=%%H', escapeshellarg($installDir)));
|
|
system(sprintf('cd %s && git log -n 1 --format=%%H', escapeshellarg($installDir)));
|
|
$newversions[] = trim($name.' '.ob_get_clean());
|
|
$newversions[] = trim($name.' '.ob_get_clean());
|
|
@@ -114,14 +112,12 @@ foreach ($deps as $name => $dep) {
|
|
}
|
|
}
|
|
|
|
|
|
// update?
|
|
// update?
|
|
-if ('update' === $command || 'lock' === $command) {
|
|
|
|
- echo "> Updating deps.lock\n";
|
|
|
|
-
|
|
|
|
|
|
+if ('update' === $command) {
|
|
file_put_contents($rootDir.'/deps.lock', implode("\n", $newversions));
|
|
file_put_contents($rootDir.'/deps.lock', implode("\n", $newversions));
|
|
}
|
|
}
|
|
|
|
|
|
// php on windows can't use the shebang line from system()
|
|
// php on windows can't use the shebang line from system()
|
|
-$interpreter = defined('PHP_WINDOWS_VERSION_BUILD') ? 'php.exe' : '';
|
|
|
|
|
|
+$interpreter = PHP_OS == 'WINNT' ? 'php.exe' : '';
|
|
|
|
|
|
// Update the bootstrap files
|
|
// Update the bootstrap files
|
|
system(sprintf('%s %s %s', $interpreter, escapeshellarg($rootDir.'/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php'), escapeshellarg($rootDir)));
|
|
system(sprintf('%s %s %s', $interpreter, escapeshellarg($rootDir.'/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php'), escapeshellarg($rootDir)));
|
|
@@ -130,4 +126,4 @@ system(sprintf('%s %s %s', $interpreter, escapeshellarg($rootDir.'/vendor/bundle
|
|
system(sprintf('%s %s assets:install %s', $interpreter, escapeshellarg($rootDir.'/app/console'), escapeshellarg($rootDir.'/web/')));
|
|
system(sprintf('%s %s assets:install %s', $interpreter, escapeshellarg($rootDir.'/app/console'), escapeshellarg($rootDir.'/web/')));
|
|
|
|
|
|
// Remove the cache
|
|
// Remove the cache
|
|
-system(sprintf('%s %s cache:clear --no-warmup', $interpreter, escapeshellarg($rootDir.'/app/console')));
|
|
|
|
|
|
+system(sprintf('%s %s cache:clear --no-warmup', $interpreter, escapeshellarg($rootDir.'/app/console')));
|