Skip to content

Instantly share code, notes, and snippets.

@jmeyo
Last active August 29, 2015 13:57
Show Gist options
  • Save jmeyo/9514322 to your computer and use it in GitHub Desktop.
Save jmeyo/9514322 to your computer and use it in GitHub Desktop.
Installer for dacorp symfony manager
#!/bin/bash -x
# https://github.com/jmeyo/dacorp-symfony-manager installer script
if [ "x"$USER != 'x' ]; then
if [ "x"$USER != 'xroot' ]; then
sm_path=$HOME/.symfony-manager
else
sm_path=/root/.symfony-manager
fi
else
sm_path=/root/.symfony-manager
fi
if [ ! -f ${sm_path}/symfony_manager.sh ]; then
#Move conf if already present
[ -d ${sm_path}/sm-config ] && tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'symanager') && mv ${sm_path}/sm-config $tmpdir
#install dacorp-symfony-manager
git clone https://github.com/jmeyo/dacorp-symfony-manager.git ${sm_path} && mkdir ${sm_path}/sm-config || (echo "can't git dacorp-symfony-manager" && exit 1)
[ ! -z "$tmpdir" -a -d "$tmpdir" ] && mv $tmpdir/sm-config/* ${sm_path}/sm-config
fi
# sm conf alias loader
sm_bin=${sm_path}/symfony_manager.sh
sm_conf_directory=${sm_path}/sm-config
# default shortcut for the calling symfony manager without any conf files
alias sm_='${sm_bin}'
for conffile in `ls $sm_conf_directory`; do
project_name=${conffile/sm-config-}
project_name=${project_name/pm-config-}
alias sm_$project_name="${sm_bin} -l $sm_conf_directory/${conffile}"
project_path=`cat $sm_conf_directory/$conffile | grep application_install_path | sed 's/application_install_path="//g' | sed 's/"//g'`
alias po_$project_name="cd $project_path"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment