Skip to content

Instantly share code, notes, and snippets.

@deiu deiu/
Last active Dec 25, 2015

What would you like to do?
RWW.IO Web app deployer
# RWW.IO Web app deployer. Simply run `sh` inside your Web app dir and follow the steps.
# get target URI
read -p "Please provide the URI of the target dir (ex: " HOST
if [ "$HOST" = "" ]
read -p "Please provide the URI of the target dir (ex: " HOST
# get certificate path
read -p "Please provide the path containing the name of your certificate file, in PEM format (leave blank if none): " CERT
# add trailing slash to target dir if not present
if [ `echo "$HOST" | grep "[^/]$"` ]; then HOST="$HOST/"; fi
# add cert arguments to the curl command
if [ "$CERT" != "" ]; then CERTCMD="-E $CERT";fi
# create the dir structure (using MKCOL to increase interoperabilty)
for dir in `find . -mindepth 1 -type d ! -path ./.git\* | sed "s|^\./||"`:
echo "Creating dir: $dir"
curl -X 'MKCOL' $CERTCMD $HOST$dir
# upload the files now
for file in `find . -mindepth 1 -type f ! -path ./.git\* | sed "s|^\./||"`:
# remove trailing ":" (weird)
if [ ! `echo "$file" | grep "[^:]$"` ]; then file="${file%?}";fi
echo "Uploading file: $HOST$file"
curl --upload-file $file $CERTCMD $HOST$file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.