瀏覽代碼

moved vendors.sh to PHP

Fabien Potencier 14 年之前
父節點
當前提交
de61474cb7
共有 2 個文件被更改,包括 38 次插入59 次删除
  1. 38 0
      vendors.php
  2. 0 59
      vendors.sh

+ 38 - 0
vendors.php

@@ -0,0 +1,38 @@
+#!/usr/bin/env php
+<?php
+
+/*
+ * This file is part of the Symfony framework.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+if (!is_dir($vendorDir = dirname(__FILE__).'/vendor')) {
+    mkdir($vendorDir, 0777, true);
+}
+
+$deps = array(
+    array('assetic', 'http://github.com/kriswallsmith/assetic.git', 'origin/HEAD'),
+    array('doctrine', 'http://github.com/doctrine/doctrine2.git', '2.0.5'),
+    array('doctrine-dbal', 'http://github.com/doctrine/dbal.git', '2.0.5'),
+    array('doctrine-common', 'http://github.com/doctrine/common.git', 'origin/3.0.x'),
+    array('monolog', 'http://github.com/Seldaek/monolog.git', 'origin/HEAD'),
+    array('swiftmailer', 'http://github.com/swiftmailer/swiftmailer.git', 'origin/4.1'),
+    array('twig', 'http://github.com/fabpot/Twig.git', 'origin/HEAD'),
+);
+
+foreach ($deps as $dep) {
+    list($name, $url, $rev) = $dep;
+
+    echo "> Installing/Updating $name\n";
+
+    $installDir = $vendorDir.'/'.$name;
+    if (!is_dir($installDir)) {
+        system(sprintf('git clone %s %s', $url, $installDir));
+    }
+
+    system(sprintf('cd %s && git fetch origin && git reset --hard %s', $installDir, $rev));
+}

+ 0 - 59
vendors.sh

@@ -1,59 +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 ..
-}
-
-# Assetic
-install_git assetic git://github.com/kriswallsmith/assetic.git
-
-# Doctrine ORM
-install_git doctrine git://github.com/doctrine/doctrine2.git 2.0.5
-
-# Doctrine DBAL
-install_git doctrine-dbal git://github.com/doctrine/dbal.git 2.0.5
-
-# Doctrine Common
-install_git doctrine-common git://github.com/doctrine/common.git origin/3.0.x
-
-# Doctrine migrations
-install_git doctrine-migrations git://github.com/doctrine/migrations.git
-
-# Monolog
-install_git monolog git://github.com/Seldaek/monolog.git
-
-# Swiftmailer
-install_git swiftmailer git://github.com/swiftmailer/swiftmailer.git origin/4.1
-
-# Twig
-install_git twig git://github.com/fabpot/Twig.git