Last active
April 6, 2018 20:40
-
-
Save BrandonDyer64/f08efbfd4770204d255c03a1e6129a44 to your computer and use it in GitHub Desktop.
WM Table Build Script
This file contains 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/sh | |
# A script to make our lives easier | |
# Place this script into the table_config_files directory of any WM project. | |
build_script_version="2.4.0" | |
# Version | |
if [ "$1" == "--version" ] | |
then | |
echo "$build_script_version" | |
exit 0 | |
fi | |
# Updater | |
if [ "$1" == "--update" ] | |
then | |
echo "Updating..." | |
wget -q -O build https://gist.githubusercontent.com/BrandonDyer64/f08efbfd4770204d255c03a1e6129a44/raw/build | |
wget -q -O create https://gist.githubusercontent.com/BrandonDyer64/d8d4f8e3a2ee0fa157fda2acca960798/raw/create | |
echo "Setting perms" | |
sudo chmod -x build | |
sudo chmod 775 build | |
sudo chown apache.webadm build | |
sudo chmod -x create | |
sudo chmod 775 create | |
sudo chown apache.webadm create | |
echo "Finished" | |
echo -n "From: $build_script_version to " | |
./build --version | |
echo "Create version: " | |
./create --version | |
exit 0 | |
fi | |
# Help | |
if [ "$1" == "--help" ] | |
then | |
echo "Checks existence of thing config before generating." | |
echo "Place this script into the table_config_files directory of any WM project." | |
echo "build thing [note|document|status|status_update]" | |
exit | |
fi | |
# Remove _config.php from the end of the primary parameter | |
a="${1/_config.php/}" | |
# Build the config file | |
if [ -z "$2" ] | |
# Only if it's the only parameter | |
then | |
cd .. | |
echo "source sql/${a}_tables.sql;" | |
if [ -e "./table_config_files/${a}_config.php" ] | |
then | |
../../bin/create_code_for_one_thing.sh $a >/dev/null | |
else | |
echo "ABORT - FILE NOT FOUND!!!" | |
fi | |
cd table_config_files | |
fi | |
# Build extras | |
if [ -n "$2" ] | |
then | |
b="${a}_${2}_config.php" | |
if [ -e "$b" ] | |
then | |
nodelete="$b" | |
fi | |
if [ "$nodelete" != "$b" ] | |
then | |
if [ "$2" == "note" ] | |
then | |
wget -q -O $b https://gist.githubusercontent.com/BrandonDyer64/54f837392c55952969f93aa44af0a97f/raw/wm_note.php | |
elif [ "$2" == "document" ] | |
then | |
wget -q -O $b https://gist.githubusercontent.com/BrandonDyer64/011c929b8ba81bd899e4ff8e31e1862e/raw/wm_document.php | |
elif [ "$2" == "status" ] | |
then | |
wget -q -O $b https://gist.githubusercontent.com/BrandonDyer64/4ac09e78772b43ffa2d89e9868ed9b6b/raw/wm_status.php | |
elif [ "$2" == "status_update" ] | |
then | |
wget -q -O $b https://gist.githubusercontent.com/BrandonDyer64/820c67405acb32ae4959ce4b3436bc44/raw/wm_status_update.php | |
fi | |
sed -i "1s/^/<?php \$master='${a}'; ?>\n/" $b | |
fi | |
./build $b | |
if [ "$nodelete" != "$b" ] | |
then | |
rm $b | |
fi | |
./build $1 $3 $4 $5 $6 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment