diff --git a/bin/vendors b/bin/vendors new file mode 100755 index 000000000..5b13cf739 --- /dev/null +++ b/bin/vendors @@ -0,0 +1,102 @@ +#!/usr/bin/env php + + */ + +$rootDir = dirname(__DIR__); +$vendorDir = $rootDir.'/vendor'; + +array_shift($argv); +if (!isset($argv[0])) { + exit(<< $dep) { + // revision + if (isset($versions[$name])) { + $rev = $versions[$name]; + } else { + $rev = isset($dep['version']) ? $dep['version'] : 'origin/HEAD'; + } + + // install dir + $installDir = isset($dep['target']) ? $vendorDir.'/'.$dep['target'] : $vendorDir.'/'.$name; + if (in_array('--reinstall', $argv)) { + if (PHP_OS == 'WINNT') { + system(sprintf('rmdir /S /Q %s', escapeshellarg(realpath($installDir)))); + } else { + system(sprintf('rm -rf %s', escapeshellarg($installDir))); + } + } + + 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))); + } + + system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev))); + + if ('update' === $command) { + ob_start(); + system(sprintf('cd %s && git log -n 1 --format=%%H', escapeshellarg($installDir))); + $newversions[] = trim($name.' '.ob_get_clean()); + } +} diff --git a/deps b/deps new file mode 100644 index 000000000..d68888117 --- /dev/null +++ b/deps @@ -0,0 +1,8 @@ +[symfony] + git=http://github.com/symfony/symfony.git + +[doctrine-common] + git=http://github.com/doctrine/common.git + +[doctrine-dbal] + git=http://github.com/doctrine/dbal.git diff --git a/vendors.sh b/vendors.sh deleted file mode 100755 index 71fedbd60..000000000 --- a/vendors.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -cd $(dirname $0) - -# initialization -if [ "$1" = "--reinstall" ]; then - rm -rf vendor -fi - -mkdir -p vendor && cd vendor - -## -# @param destination directory (e.g. "doctrine") -# @param URL of the git remote (e.g. git://github.com/doctrine/doctrine2.git) -# @param revision to point the head (e.g. origin/HEAD) -# -install_git() -{ - INSTALL_DIR=$1 - SOURCE_URL=$2 - REV=$3 - - if [ -z $REV ]; then - REV=origin/HEAD - fi - - if [ ! -d $INSTALL_DIR ]; then - git clone $SOURCE_URL $INSTALL_DIR - fi - - cd $INSTALL_DIR - git fetch origin - git reset --hard $REV - cd .. -} - -# Symfony -install_git symfony git://github.com/symfony/symfony.git