blob: fd98733782f2216765a09f303958e0d94319d05b [file] [log] [blame] [raw]
#! /bin/bash
# This script is Benjamín C. Calderón's brain child (@benjcal).
# Written by Bo and a "good enough for now" draft.
#
# Expected changes will update the makefile and the boiler plate code.
if [ -z $1 ]
then
echo "Please provide file name."
exit 0
fi
if [ -a $1 ]; then echo "Couldn't create folder, already exists?"; exit 1; fi
if [ -d $1 ]; then echo "Couldn't create folder, already exists?"; exit 1; fi
echo "Creating $1"
mkdir $1
cd $1
# Was: curl -s -LJO https://github.com/boazsegev/facil.io/archive/stable.tar.gz
# But it's better to use releases than the stable branch:
curl -s -o facil.io.tar.gz -LJO $(curl -s https://api.github.com/repos/boazsegev/facil.io/releases/latest | grep tarball_url | cut -d '"' -f 4)
if [ $? -ne 0 ]; then echo "Couldn't download the latest release from facil.io's GitHub repo."; exit 1; fi
tar --strip-components=1 -xzf facil.io.tar.gz
if [ $? -ne 0 ]; then echo "Couldn't extract tar."; exit 1; fi
rm facil.io.tar.gz
rm -R dev
rm -R docs
rm -R tests
rm CHANGELOG.md
rm README.md
rm CONTRIBUTING.md
rm Doxyfile
rm CMakeLists.txt
rm LICENSE
rm NOTICE
make clean &> /dev/null
mv ./examples/boiler_plates/http/* ./
rm -R ./examples/boiler_plates
make clean &> /dev/null