-
Notifications
You must be signed in to change notification settings - Fork 2
/
install
executable file
·55 lines (40 loc) · 1.42 KB
/
install
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
{ # this ensures the entire script is downloaded #
set -o errtrace
set -o errexit
COLOR_GREEN="\033[32m"
COLOR_BLUE="\033[34m"
COLOR_DARK_GRAY="\033[38m"
COLOR_NORMAL="\033[39m"
# Get the latest version
GITHUB_URL="https://api.github.com/repos/bromanko/dot-slash-go/releases/latest"
RELEASE_VERSION=`curl --silent ${GITHUB_URL} \
| grep '"tag_name":' \
| sed -E 's/.*"([^"]+)".*/\1/'`
RELEASE_URL=`curl --silent ${GITHUB_URL} \
| grep '"browser_download_url":' \
| sed -E 's/.*"([^"]+)".*/\1/'`
echo -e "${COLOR_BLUE}Installing dot-slash-go ${RELEASE_VERSION}${COLOR_NORMAL}"
echo -e "${COLOR_DARK_GRAY}${RELEASE_URL}${COLOR_NORMAL}"
# Install
curl -sL ${RELEASE_URL} | tar xz
# Customize
DEFAULT="$(cat ".go/.name" 2>/dev/null)"
DEFAULT=${DEFAULT:-"Your App Name Here"}
read -p "Name of the app [${DEFAULT}]: " NAME
NAME=${NAME:-${DEFAULT}}
DEFAULT="$(cat ".go/.author" 2>/dev/null)"
DEFAULT=${DEFAULT:-"Your Name Here"}
read -p "Author of the app [${DEFAULT}]: " AUTHOR
AUTHOR=${AUTHOR:-${DEFAULT}}
DEFAULT="$(cat ".go/.version" 2>/dev/null)"
DEFAULT=${DEFAULT:-"v1.0.0"}
read -p "Version of the app [${DEFAULT}]: " VERSION
VERSION=${VERSION:-${DEFAULT}}
echo ${NAME} > .go/.name
echo ${AUTHOR} > .go/.author
echo ${VERSION} > .go/.version
echo -e ""
echo -e "Great! You're all set."
echo -e "Check things out by running ${COLOR_GREEN}./go${COLOR_NORMAL}"
} # this ensures the entire script is downloaded #