Skip to content

Instantly share code, notes, and snippets.

@mlms13
Created May 8, 2017 14:55
Show Gist options
  • Save mlms13/eaed3b4704bb2bb7d91fd802d6a44262 to your computer and use it in GitHub Desktop.
Save mlms13/eaed3b4704bb2bb7d91fd802d6a44262 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
color_black='\033[0;30m'
color_red='\033[0;31m'
color_green='\033[0;32m'
color_yellow='\033[0;33m'
color_blue='\033[0;34m'
color_purple='\033[0;35m'
color_cyan='\033[0;36m'
color_gray='\033[0;37m'
color_none='\033[0m'
echo_red() {
echo -e "${color_red}${1:-}${color_none}"
}
echo_green() {
echo -e "${color_green}${1:-}${color_none}"
}
echo_yellow() {
echo -e "${color_yellow}${1:-}${color_none}"
}
echo_blue() {
echo -e "${color_blue}${1:-}${color_none}"
}
echo_purple() {
echo -e "${color_purple}${1:-}${color_none}"
}
echo_cyan() {
echo -e "${color_cyan}${1:-}${color_none}"
}
banner() {
local msg="$1"
echo_blue "--------------------------------------------------------------------------------"
echo_cyan "${msg}"
echo_blue "--------------------------------------------------------------------------------"
}
################################
# KHA INIT SCRIPT
################################
orig_dir="$(pwd)"
project="$1"
tab=" "
opts="{ title: \"$project\", width: 800, height: 600 }"
banner "Initializing directory '$project' in $orig_dir"
mkdir "$project"
cd "$project"
git init --quiet
echo_green "Created directory"
mkdir Sources
echo -e "let project = new Project('$project');\nproject.addSources('Sources');\nresolve(project);" >> ./khafile.js
echo -e "\nimport kha.System;\n\nclass Main {\n${tab}public static function main() {\n${tab}${tab}System.init($opts, function () {});\n$tab}\n}" >> ./Sources/Main.hx
echo_green "Created project files"
echo_yellow "Initializing submodules..."
git submodule --quiet add https://github.com/KTXSoftware/Kha
git submodule --quiet update --init --recursive
echo_green "Done"
echo_yellow "Updating dependencies..."
git submodule --quiet foreach --recursive git pull --quiet origin master
echo_green "Done"
./Kha/make.sh
echo_green "Initial build complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment