-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·144 lines (113 loc) · 3.03 KB
/
install.sh
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
BLUE="\033[0;36m"
NORMAL="\033[0m"
EMACS_REPO_HTTPS="https://github.com/luismayta/emacs.d.git"
EMACS_REPO_BRANCH="master"
EMACS_ROOT_PATH="${HOME}/.emacs.d"
EMACS_APP_NAME='emacs.d'
EMASC_MESSAGES_BREW_NOT_FOUND="Install brew for next also use github.com/luismayta/zsh-brew"
function message::error {
printf "${RED}%s${NORMAL}\n" "[ERROR]: ${1}"
exit 1
}
function message::info {
printf "${BLUE}%s${NORMAL}\n" "[INFO]: ${1}"
}
function message::warning {
printf "${YELLOW}%s${NORMAL}\n" "[WARNING]: ${1}"
}
function message::success {
printf "${GREEN}%s${NORMAL}\n" "🧉 [SUCCESS]: ${1}"
}
emacs::lua::install() {
if ! type -p brew > /dev/null; then
message::warning "${EMASC_MESSAGES_BREW_NOT_FOUND}"
return
fi
brew install lua
}
emacs::luarocks::install() {
if ! type -p brew > /dev/null; then
message::warning "${EMASC_MESSAGES_BREW_NOT_FOUND}"
return
fi
if ! type -p luarocks > /dev/null; then
brew install luarocks
emacs::luarocks::dependences::install
fi
}
emacs::luarocks::dependences::install() {
hash luarocks >/dev/null 2>&1 || {
luarocks install luacheck
}
}
emacs::repository::clone() {
if [ -d "${EMACS_ROOT_PATH}/.git" ]; then
message::info "The application is installed, please remove the directory ${EMACS_APP_NAME}"
return 1
fi
git clone --recursive -b "${EMACS_REPO_BRANCH}" "${EMACS_REPO_HTTPS}" "${EMACS_ROOT_PATH}"
message_success "Clone success"
}
emacs::install::dependences() {
if ! type -p brew > /dev/null; then
message::warning "${EMASC_MESSAGES_BREW_NOT_FOUND}"
return
fi
hash git >/dev/null 2>&1 || {
brew install git
}
hash curl >/dev/null 2>&1 || {
brew install curl
}
hash wget >/dev/null 2>&1 || {
brew install wget
}
hash hg >/dev/null 2>&1 || {
brew install hg
}
hash the_silver_searcher >/dev/null 2>&1 || {
brew install the_silver_searcher
}
hash editorconfig >/dev/null 2>&1 || {
brew install editorconfig
}
hash aspell >/dev/null 2>&1 || {
brew install aspell
}
hash ispell >/dev/null 2>&1 || {
brew install ispell
}
hash ctags >/dev/null 2>&1 || {
# for the GNU global tag system. Used by ggtags.
brew install --HEAD ctags
brew install global --with-ctags
}
hash graphviz >/dev/null 2>&1 || {
# program used for plantuml
brew install graphviz
}
hash markdown >/dev/null 2>&1 || {
brew install markdown
}
emacs::lua::install
emacs::luarocks::install
}
function emacs::greeting::thanks {
cat <<EOF
---------------------------
Thanks for installing Emacs
---------------------------
EOF
message::info "© $(date +%Y) ${EMACS_APP_NAME}"
}
initialize() {
emacs::install::dependences
emacs::repository::clone
emacs::greeting::thanks
}
initialize