-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·131 lines (99 loc) · 2.76 KB
/
install
File metadata and controls
executable file
·131 lines (99 loc) · 2.76 KB
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
#!/bin/bash
function install_program {
local program=$1
if ! hash ${program} 2>/dev/null; then
read -p "$program is not installed, would you like to install it? (y/n) " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo
sudo apt-get -y install ${program}
else
exit 1
fi
fi
}
function delete_existing_file {
local file=$1
if [ -f ~/.bashrc ]; then
read -p "Delete previously existing file?: $file (y/n) " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo
rm ${file}
else
exit 1
fi
fi
}
function setup_bash {
delete_existing_file ~/.bashrc
stow -v bash
}
function setup_vim {
install_program vim
stow -v vim
# install vundle
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
vim +BundleInstall! +BundleClean +q +q # quit twice cause it opens in a split?
}
function setup_nvim {
install_program software-properties-common
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt-get update
sudo apt-get install python-dev python-pip python3-dev python3-pip
install_program neovim
sudo pip3 install --upgrade neovim
stow -v nvim
# install vim-plugged
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
nvim +PlugInstall +q
}
function setup_tmux {
install_program tmux
stow -v tmux
}
function install_base {
install_program stow
setup_bash
setup_nvim
setup_tmux
echo "Done!"
echo "Remember to source ~/.bashrc"
}
function install_standard {
install_base
}
function install_development {
echo "Installing Python Development Tools"
install_program python3-pip
pip3 install -r dev-python-requirments.txt
echo "Installing Javascript Development Tools"
install_program nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node # fix ubuntu being dumb
install_program npm
sudo npm install -g eslint
sudo npm install -g babel-eslint
sudo npm install -g eslint-plugin-vue@beta
echo "Installing Generic Development Tools"
install_program exuberant-ctags
stow -v ctags
stow -v git
install_base
}
function install_production {
# TODO: setup bash prompt to be red
install_base
}
title="Select type of environment"
prompt="choice: "
options=("Standard" "Development" "Production")
echo -e "$title\n"
PS3="$prompt"
select opt in "${options[@]}" "Quit"; do
case "$REPLY" in
1 ) install_standard;;
2 ) install_development;;
3 ) install_production;;
$(( ${#options[@]}+1 )) ) echo "Quit"; break;;
* ) echo invalid option; continue;;
esac
done