浏览代码

Merge install_vendors.sh and update_vendors.sh

Install or update vendors as needed. To force the old
install_vendors.sh behavior, you can call
update_vendors.sh --reinstall.
Laurent Bachelier 14 年之前
父节点
当前提交
f1633f89c4
共有 2 个文件被更改,包括 30 次插入50 次删除
  1. 30 15
      install_vendors.sh
  2. 0 35
      update_vendors.sh

+ 30 - 15
install_vendors.sh

@@ -3,40 +3,55 @@
 cd $(dirname $0)
 
 # initialization
-if [ -d "vendor" ]; then
-  rm -rf vendor/*
-else
-  mkdir vendor
+if [ "$1" = "--reinstall" ]; then
+    rm -rf vendor
 fi
 
-cd vendor
+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)
+#
+install_git()
+{
+    INSTALL_DIR=$1
+    SOURCE_URL=$2
+    if [ -d $INSTALL_DIR ]; then
+        cd $INSTALL_DIR
+        git pull
+        cd ..
+    else
+        git clone $SOURCE_URL $INSTALL_DIR
+    fi
+}
 
 # Doctrine ORM
-git clone git://github.com/doctrine/doctrine2.git doctrine
+install_git doctrine git://github.com/doctrine/doctrine2.git
 
 # Doctrine Data Fixtures Extension
-git clone git://github.com/doctrine/data-fixtures doctrine-data-fixtures
+install_git doctrine-data-fixtures git://github.com/doctrine/data-fixtures
 
 # Doctrine DBAL
-git clone git://github.com/doctrine/dbal.git doctrine-dbal
+install_git doctrine-dbal git://github.com/doctrine/dbal.git
 
 # Doctrine Common
-git clone git://github.com/doctrine/common.git doctrine-common
+install_git doctrine-common git://github.com/doctrine/common.git
 
 # Doctrine migrations
-git clone git://github.com/doctrine/migrations.git doctrine-migrations
+install_git doctrine-migrations git://github.com/doctrine/migrations.git
 
 # Doctrine MongoDB
-git clone git://github.com/doctrine/mongodb.git doctrine-mongodb
+install_git doctrine-mongodb git://github.com/doctrine/mongodb.git
 
 # Doctrine MongoDB
-git clone git://github.com/doctrine/mongodb-odm.git doctrine-mongodb-odm
+install_git doctrine-mongodb-odm git://github.com/doctrine/mongodb-odm.git
 
 # Swiftmailer
-git clone git://github.com/swiftmailer/swiftmailer.git swiftmailer
+install_git swiftmailer git://github.com/swiftmailer/swiftmailer.git
 
 # Twig
-git clone git://github.com/fabpot/Twig.git twig
+install_git twig git://github.com/fabpot/Twig.git
 
 # Zend Framework
-git clone git://github.com/zendframework/zf2.git zend
+install_git zend git://github.com/zendframework/zf2.git

+ 0 - 35
update_vendors.sh

@@ -1,35 +0,0 @@
-#!/bin/sh
-
-cd $(dirname $0)
-
-CURRENT=${PWD}/vendor
-
-# Doctrine ORM
-cd $CURRENT/doctrine && git pull
-
-# Doctrine Data Fixtures Extension
-cd $CURRENT/doctrine-data-fixtures && git pull
-
-# Doctrine DBAL
-cd $CURRENT/doctrine-dbal && git pull
-
-# Doctrine common
-cd $CURRENT/doctrine-common && git pull
-
-# Doctrine migrations
-cd $CURRENT/doctrine-migrations && git pull
-
-# Doctrine MongoDB
-cd $CURRENT/doctrine-mongodb && git pull
-
-# Doctrine MongoDB ODM
-cd $CURRENT/doctrine-mongodb-odm && git pull
-
-# Swiftmailer
-cd $CURRENT/swiftmailer && git pull
-
-# Twig
-cd $CURRENT/twig && git pull
-
-# Zend Framework
-cd $CURRENT/zend && git pull