Last active
August 29, 2015 14:04
-
-
Save mrosati84/2f1aecf0961260fe37ec to your computer and use it in GitHub Desktop.
Easily manage projects using H-ART Dev Machine
This file contains hidden or 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
Launch
setopt interactivecomments
on zsh if command returns "Bad pattern error"