-
Notifications
You must be signed in to change notification settings - Fork 0
/
create
executable file
·36 lines (31 loc) · 1.21 KB
/
create
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# @fileoverview
# Creates a new project automatically:
# - Uses the expected folder structure
# - Avoids having to remember the correct subtree command every time
# - Squashes the template's history automatically. This simulates creating the project from a GitHub.Template
#_______________________________________
# @section Error check
#_____________________________
Prefix="create-tutorial: "
info(){ echo $Prefix $@; }
fail(){ info $@; exit; }
[[ $1 = "" ]] && fail "The given project name cannot be empty"
[[ $1 = *" "* ]] && fail "The given project name cannot contain spaces. The name passed was `$1`"
#_______________________________________
# @section Process
#_____________________________
# Setup the variables
name=$1
branch="dev"
case $2 in
"static") template="[email protected]:EtherealEngine/ee-static-build-template.git" ;;
*) template="[email protected]:EtherealEngine/ee-template.git" ;;
esac
#_____________________________
# Run the command
[[ $template = *"static"* ]] &&
info "Creating a new project from the static-build template." ||
info "Creating a new project from the standard template."
#___________________
git subtree add --prefix src/$name $template $branch --squash