Skip to content

Instantly share code, notes, and snippets.

@mrosati84
Last active August 29, 2015 14:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrosati84/2f1aecf0961260fe37ec to your computer and use it in GitHub Desktop.
Save mrosati84/2f1aecf0961260fe37ec to your computer and use it in GitHub Desktop.
Easily manage projects using H-ART Dev Machine
#!/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 $@
@ifthenelse
Copy link

Launch setopt interactivecomments on zsh if command returns "Bad pattern error"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment