Init wizard

Closes #7
This commit is contained in:
Josh Sherman 2014-12-23 14:50:06 -05:00
parent f1df104443
commit 2f305d592c

25
ship
View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
case $# in
0)
@ -55,16 +55,24 @@ case $# in
fi
;;
4)
1)
if [ "$1" == "init" ]
then
USER=$2
SERVER=$3
DESTINATION=$4
echo -n "Remote user to ship as [captain]: "
read USER
USER=${USER:-captain}
echo -n "Server to deploy to: "
read SERVER
echo -n "Destination on server to deploy to: "
read DESTINATION
CLONEURL=`git config --get remote.origin.url`
ssh captain@$SERVER "
if [ -a $DESTINATION ]; then
if [ -a $DESTINATION ]
then
echo "Error: Destination exists"
exit 1
else
@ -72,19 +80,16 @@ case $# in
fi
"
if [ $? -eq 0 ]
then
echo "USER=$USER" > .ship
echo "SERVER=$SERVER" >> .ship
echo "DESTINATION=$DESTINATION" >> .ship
fi
else
echo "Error: Invalid argument '$1'"
fi
;;
*)
echo "Usage: ship [init user server destination]"
echo "Usage: ship [init]"
exit 1
;;
esac