Skip to content

Commit fb42265

Browse files
committed
changes to handle doctrine 2
1 parent 0d54fd4 commit fb42265

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

getLibrary.sh

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# PURPOSE: Script shell to automatically download, extract & symlink a specific version of libraries like ZF, doctrine, etc.
1111
# Supported libraries:
1212
# + Zend Framework
13-
# + Doctrine
13+
# + Doctrine 2
1414
#
1515
# IMPORTANT!!!
1616
# Make sure that the directory from which the script is executed is writable for the user which is executing the script! Otherwise the download will fail because writing permissions are missing.
@@ -22,7 +22,7 @@
2222
# ./getLibrary.sh <library> <version>
2323
# <library>
2424
# zf - Zend Framework
25-
# doc - Doctrine
25+
# doc - Doctrine 2
2626
# <version>
2727
# check the website of the library for the available versions
2828

@@ -36,7 +36,7 @@ PATHBASE="/usr/local/lib/"
3636

3737
### OTHER ###
3838
# supported libs variable (used in error messages)
39-
LIBSSUPPORTED="Zend Framework (zf), Doctrine (doc)"
39+
LIBSSUPPORTED="Zend Framework (zf), Doctrine2 (doc)"
4040
SCRIPTNAME="getLibrary"
4141

4242
### MESSAGES ###
@@ -160,21 +160,29 @@ case $LIB in
160160
# library name
161161
LIB="ZF"
162162
;;
163-
doctrine | doc)
163+
doctrine | doctrine2 | doc | doc2)
164164
# library name
165-
LIB="Doctrine"
165+
LIB="Doctrine2"
166166
;;
167167
*)
168168
echo "$ERROR: requested library '$LIB' not supported. Only the libraries $LIBSSUPPORTED are supported at the moment. Stopping script..."
169169
exit 1
170170
esac
171171

172+
# check if 2nd argument was passed
173+
if [ -z $2 ]
174+
then
175+
echo "$ERROR: Please provide the version number. Stopping script..."
176+
exit 1
177+
else
178+
# library version (2nd parameter passed)
179+
VERSION=$2
180+
fi
172181

173182
# final path in function of the requested library
174183
# ToDo: write function fctSetPath to set the path. Consider alpha, beta, stable versions.
175184
PATHDEST="$PATHBASE$LIB/stable/"
176185

177-
178186
# check if the path exists
179187
if [ ! -d $PATHDEST ]
180188
then
@@ -183,17 +191,6 @@ then
183191
mkdir -pv $PATHDEST
184192
fi
185193

186-
187-
# check if 2nd argument was passed
188-
if [ -z $2 ]
189-
then
190-
echo "$ERROR: Please provide the version number. Stopping script..."
191-
exit 1
192-
else
193-
# library version (2nd parameter passed)
194-
VERSION=$2
195-
fi
196-
197194
# change directory (to use directories relative to this dir path)
198195
cd $PATHDEST
199196
# debugging: uncomment the following line if you are unsure in which directory the script is...
@@ -243,7 +240,7 @@ case $LIB in
243240
# source
244241
SOURCE="http://framework.zend.com/releases/ZendFramework-$VERSION/$ARCHIVE"
245242
;;
246-
Doctrine)
243+
Doctrine2)
247244
ARCHIVENAME="DoctrineORM-$VERSION-full"
248245
ARCHIVEEXT=".tar.gz"
249246
ARCHIVE=$ARCHIVENAME$ARCHIVEEXT
@@ -297,7 +294,16 @@ tar -xzf $ARCHIVE
297294
# remove archive
298295
rm $ARCHIVE
299296
# rename untared directory
300-
mv $ARCHIVENAME $VERSION
297+
case $LIB in
298+
ZF)
299+
mv $ARCHIVENAME $VERSION
300+
;;
301+
Doctrine2)
302+
mv doctrine-orm $VERSION
303+
# move Symfony folder
304+
mv $VERSION/Doctrine/Symfony $VERSION/
305+
;;
306+
esac
301307

302308
# ask user if he wants to change the symbolic link of the latest stable to this version
303309
cat << EOF

0 commit comments

Comments
 (0)