-
Notifications
You must be signed in to change notification settings - Fork 156
/
symfony2
executable file
·51 lines (42 loc) · 1.38 KB
/
symfony2
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
51
#!/bin/bash
BUILD_DIR="$2"
basedir="$( cd -P "$( dirname "$0" )" && pwd )"
source $basedir/../bin/common.sh
function requires_symfony2() {
jq --raw-output '.packages | .[] | .name' < "$BUILD_DIR/composer.lock" | grep -q '^symfony/symfony$'
}
function sets_framework_symfony2() {
[ $(jq --raw-output '.extra.heroku.framework' < "$BUILD_DIR/composer.json") == "symfony2" ]
}
case "$1" in
detect)
if [ ! -f "$BUILD_DIR/composer.json" ]; then
exit 1
fi
if requires_symfony2 || sets_framework_symfony2; then
echo "-----> Detected Symfony2 App"
exit 0
else
exit 1
fi
;;
get-log-files)
echo "app/logs/prod.log" "app/logs/dev.log"
;;
compile)
echo "-----> Setting up Symfony2 app"
cp "$basedir/../conf/nginx/symfony2.conf.erb" "$BUILD_DIR/conf/site.conf.erb"
;;
end)
BUILD_DIR="$1"
CACHE_DIR="$2"
APP_DIR="/app"
status "Warming up cache"
rm -rf app/cache/*
php app/console cache:warmup --env=prod --no-debug | indent
status "In-place replacement of $CACHE_DIR to $APP_DIR"
find $CACHE_DIR/app/cache/prod -type f -exec sed -i "s@$CACHE_DIR@$APP_DIR@g" {} \; | indent
grep $CACHE_DIR/app/cache/prod -r . && error "Could find some '$CACHE_DIR' :/ "
status "End"
;;
esac