Skip to content

Instantly share code, notes, and snippets.

@exileed
Created November 29, 2014 22:43
Show Gist options
  • Save exileed/5327a9235865be349be8 to your computer and use it in GitHub Desktop.
Save exileed/5327a9235865be349be8 to your computer and use it in GitHub Desktop.
Composer Openshift
#!/bin/bash
# This is a simple post deploy hook executed after your application
# is deployed and started. This script gets executed directly, so
# it could be python, php, ruby, etc.
export COMPOSER_HOME="$OPENSHIFT_DATA_DIR/.composer"
if [ ! -f "$OPENSHIFT_DATA_DIR/composer.phar" ]; then
echo !!! composer install ...
curl -s https://getcomposer.org/installer | php -- --install-dir=$OPENSHIFT_DATA_DIR
php $OPENSHIFT_DATA_DIR/composer.phar global require "fxp/composer-asset-plugin:1.0.0-beta3"
else
echo !!! composer update...
php $OPENSHIFT_DATA_DIR/composer.phar self-update
fi
# check and set the symlink for vendor dir
if [ ! -d "$OPENSHIFT_DATA_DIR/vendor" ]; then
echo !!! vendor directory does NOT exist - creating symlink...
mkdir $OPENSHIFT_DATA_DIR/vendor
echo !!! created vendor directory - creating symlink...
ln -s $OPENSHIFT_DATA_DIR/vendor $OPENSHIFT_REPO_DIR/vendor
echo !!! created symlink - setting permissions on directory...
chmod -R 0777 $OPENSHIFT_DATA_DIR/vendor
echo !!! permissions have been set on vendor directory!
else
echo !!! vendor directory already exists - skipping symlink...
fi
unset GIT_DIR
cd $OPENSHIFT_REPO_DIR
php $OPENSHIFT_DATA_DIR/composer.phar install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment