-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
108 lines (96 loc) · 3.03 KB
/
setup.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
#!/bin/bash
set -euo pipefail
source lib/echos.sh
function command_exists() {
type "$1" &> /dev/null ;
}
function install_powerline() {
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
cd ..
rm -rf fonts
}
info "==============install brew================"
: "install brew" && {
if ! command_exists brew; then
info "installing brew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
warn "brew is already installed"
fi
}
info "==============install zsh by brew================"
: "install zsh by brew" && {
if ! command_exists zsh; then
info "installing zsh..."
brew install zsh zsh-completions
sudo sh -c 'echo $(brew --prefix)/bin/zsh >> /etc/shells'
chsh -s $(brew --prefix)/bin/zsh
else
warn "zsh is already installed"
fi
rm -rf ~/.zsh.d ~/.zshrc
ln -s ~/dotfiles/.zsh.d ~/.zsh.d
ln -s ~/dotfiles/.zshrc ~/.zshrc
}
info "==============install other packages by brew================"
: "install other packages by brew" && {
packages=( node jq tree wget direnv vim git pyenv pyenv-virtualenv mysql docker yarn nodebew fvm cask starship fzf )
for package in ${packages[@]}; do
if ! brew list | grep $package &> /dev/null; then
info "installing ${package}..."
if [ ${package} -eq fvm ]; then
info "installing leoafarias/fvm..."
brew tap leoafarias/fvm
fi
brew install ${package}
else
warn "${package} is already installed"
fi
done
brew cleanup
}
info "==============setup node================"
: "install node by nodebrew" && {
if ! command_exists nodebrew; then
info "installing nodebrew..."
brew install nodebrew
else
info "install node latest version"
nodebrew install-binary stable
fi
}
info "==============install brew cask================"
: "install brew cask" && {
packages=( google-chrome alfred iterm2 google-japanese-ime slack \
visual-studio-code flux karabiner-elements clipy docker android-studio font-hack-nerd-font )
for package in ${packages[@]}; do
if ! brew list --cask | grep $package &> /dev/null; then
if [ ${package} -eq font-hack-nerd-font ]; then
# ref: https://yiskw713.hatenablog.com/entry/2021/06/20/143130
info "installing font-hack-nerd-font..."
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
install_powerline
fi
info "installing ${package}..."
brew install --cask ${package}
else
warn "${package} is already installed"
fi
done
}
info "==============setting vscode================"
: "setting vscode" && {
info "create symbolic..."
SCRIPT_DIR=$(cd $(dirname $0) && pwd)
while read extension_name
do
echo `code --force --install-extension $extension_name`
done < "./vscode/extensions.txt"
VSCODE_SETTING_DIR=~/Library/Application\ Support/Code/User
rm -rf "$VSCODE_SETTING_DIR/settings.json"
ln -s "$SCRIPT_DIR/vscode/settings.json" "${VSCODE_SETTING_DIR}/settings.json"
}
ok "Complete!"