-
Notifications
You must be signed in to change notification settings - Fork 1
/
init
executable file
·74 lines (60 loc) · 1.88 KB
/
init
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
# Created by paincompiler on 2017/08/23
# © 2017 PAINCOMPILER All RIGHTS RESERVED.
##########settings##########
# set -o errexit
set -o errtrace
# set -o nounset
set -o pipefail
# set -o xtrace
##########settings##########
pushd `dirname $0` > /dev/null
this_script=`pwd -P`
popd > /dev/null
lang=$(locale | grep LANG | cut -d\" -f2 | cut -d= -f2 | cut -d_ -f1)
function set_git_working_email {
read -p "Enter your working email ($(git config --global user.email)): " email
if [[ ${email} = "" ]] ; then
email=$(git config --global user.email)
fi
git config user.email ${email}
}
function set_git_message_template {
git config commit.template /usr/local/etc/gitmatic/templates/gitmessage-${lang}-full
}
function set_github_templates {
echo "set github templates"
}
function install_gitflow {
unameOut="$(uname -s)"
case "${unameOut}" in
Linux* | Darwin*)
curl -OL https://raw.github.com/nvie/gitflow/develop/contrib/gitflow-installer.sh
chmod +x gitflow-installer.sh
echo "sudo required for the installation"
sudo ./gitflow-installer.sh
echo "The gitflow has been installed on your ${unameOut}"
sudo rm -rf ./gitflow-installer.sh ./gitflow
;;
*)
machine="${unameOut}"
echo "Emmm, you are in a ${machine}, please go to https://github.com/nvie/gitflow/wiki/Installation see more install options"
esac
}
# script here
# set working email for lcoal repository
set_git_working_email
# set git message and github PR/Issues templates
set_git_message_template
# set_github_templates
# git flow
echo -n "Do you want to install gitflow extensions? (more about gitflow: https://github.com/nvie/gitflow)"
read -p "(Y/N): " reply
if [[ $reply =~ ^[Yy]$ ]]; then
install_gitflow
echo -n "Do you want to initialize git flow in current repository?"
read -p "(Y/N): " reply
if [[ $reply =~ ^[Yy]$ ]]; then
git flow init
fi
fi