-
-
Save stormsson/5be8a388cd4132003efe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# create Dev Machine structure | |
function createStructure { | |
# TODO | |
# 1- check existing folders | |
# 2- ask user for overwriting | |
if [ -d manifests ] || | |
[ -d modules ] || | |
[ -d xdebug ] || | |
[ -f Vagrantfile ] || | |
[ -f README.md ] || | |
[ -f info.php ]; then | |
echo -ne 'Already devified. Overwrite? [yN]: ' | |
read OVERWRITE | |
if [[ $OVERWRITE == 'y' ]] || [[ $OVERWRITE == 'Y' ]]; then | |
# ok, overwrite | |
echo "Overwriting existing structure..." | |
rm -rf manifests &> /dev/null | |
rm -rf modules &> /dev/null | |
rm -rf xdebug &> /dev/null | |
rm Vagrantfile &> /dev/null | |
rm README &> /dev/null | |
rm info.pho &> /dev/null | |
wget https://github.com/h-art/Dev-Machine/archive/master.zip && | |
unzip master && | |
rm master.zip && | |
mv Dev-Machine-master/* . && | |
rm -rf Dev-Machine-master | |
else | |
echo "Keeping original structure" | |
fi | |
else | |
echo 'Structure not found, creating...' | |
wget https://github.com/h-art/Dev-Machine/archive/master.zip && | |
unzip master && | |
rm master.zip && | |
mv Dev-Machine-master/* . && | |
rm -rf Dev-Machine-master | |
fi | |
} | |
# devify the directory | |
function devify { | |
if [ $1 ]; then | |
createStructure | |
git clone $1 src | |
else | |
createStructure | |
fi | |
} | |
# fire devify with parameters | |
devify $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment