-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathwrapper-composer.sh
More file actions
executable file
·50 lines (45 loc) · 1.1 KB
/
wrapper-composer.sh
File metadata and controls
executable file
·50 lines (45 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#
# Wrapper to allow easily adding the relevant keys and updating
# or installing from Composer.
# Reset all variables that might be set
COMPOSER_COMMAND=""
COMPOSER_NO_DEV=""
while [ $# -gt 0 ]
do
case "$1" in
update)
COMPOSER_COMMAND="update"
echo "Composer update command, will get new packages as specified in composer.json"
shift
;;
install)
COMPOSER_COMMAND="install"
echo "Composer install command, will install all packages specified in composer.lock"
shift
;;
--no-dev)
COMPOSER_NO_DEV="--no-dev"
echo "Got '--no-dev' switch, composing for production environment"
shift
;;
--) # End of all options
shift
break
;;
*)
echo "WARN: Unknown option (ignored): $1" >&2
shift
;;
*) # no more options. Stop while loop
break
;;
esac
done
if [ ! $COMPOSER_COMMAND ]; then
echo "Could not find a recognised composer command, only 'update' and 'install' currently work with this script."
exit 4
fi
ssh-agent bash -c "ssh-add ssh/cftp_deploy_id_rsa; composer $COMPOSER_COMMAND $COMPOSER_NO_DEV;"
COMPOSER_EXIT=$?
exit $COMPOSER_EXIT