Skip to content

Instantly share code, notes, and snippets.

@stormsson
Forked from mrosati84/devify
Last active August 29, 2015 14:06
Show Gist options
  • Save stormsson/5be8a388cd4132003efe to your computer and use it in GitHub Desktop.
Save stormsson/5be8a388cd4132003efe to your computer and use it in GitHub Desktop.
#!/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