-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.sh
executable file
·123 lines (100 loc) · 2.94 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
if [[ `uname -m` == 'arm64' ]]; then
HOMEBREW_DIR="/opt/homebrew"
else
HOMEBREW_DIR="/usr/local"
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR
set -ex
# Homebrew packages
brew bundle
brew services restart postgresql@14
brew services restart redis
brew services restart logrotate
# Install oh my zsh
if [ ! -d ~/.oh-my-zsh ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
fi
if [ ! -d ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
fi
# scripts
ln -sf $DIR/update.sh $HOMEBREW_DIR/bin/workstation-update
# ruby
rbenv install --skip-existing 3.1.3
rbenv install --skip-existing 3.2.0
rbenv install --skip-existing 3.2.1
rbenv global 3.2.1
eval "$(rbenv init -)"
gem install bundler
# vim
if [ ! -d ~/.vim ]; then
git clone https://github.com/buildgroundwork/vim-config.git ~/.vim
pushd ~/.vim
./install
popd
fi
pushd ~/.vim
git pull
git submodule update --init
popd
# rails
if [ ! -d ~/.rails ]; then
git clone https://github.com/buildgroundwork/rails-config.git ~/.rails
else
pushd ~/.rails
git checkout master
git fetch
git merge --ff-only origin/master
popd
fi
# Netlify
npm list --global netlify-cli
if [ $? -eq 0 ]; then
npm upgrade --global netlify-cli
else
npm install --global netlify-cli
fi
# tmux
export TMUX_PLUGIN_MANAGER_PATH=~/.tmux/plugins/
ln -sf $DIR/tmux.conf ~/.tmux.conf
if [ ! -d ~/.tmux/plugins/tpm ]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
~/.tmux/plugins/tpm/bin/install_plugins
~/.tmux/plugins/tpm/bin/update_plugins all
# create directories
mkdir -p ~/projects
# preserve git author
GIT_USER_EMAIL=$(git config --get --global user.email)
GIT_USER_NAME=$(git config --get --global user.name)
# dotfiles
ln -sf $DIR/zshrc ~/.zshrc
ln -sf $DIR/gemrc ~/.gemrc
rm -f ~/.gitconfig
cp -f $DIR/gitconfig ~/.gitconfig
ln -sf $DIR/.git-together ~/.git-together
ln -sf $DIR/.gitignore_global ~/.gitignore_global
ln -sf $DIR/vimrc.local ~/.vimrc.local
ln -sf ~/.rails/railsrc ~/.railsrc
mkdir -p ~/.config/bat
ln -sf $DIR/batconfig ~/.config/bat/config
ln -sf $DIR/authorized_keys ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
ln -sf $DIR/default-gems $(rbenv root)/default-gems
ln -sF $DIR/tmuxinator ~/.config
# iTerm2 profile preferences
defaults import -app iTerm iterm-profile.plist
# git-together
touch ~/.git-author-template
git config --global commit.template ~/.git-author-template
# heroku cli
heroku plugins:install api heroku-builds
# restore git author
git config --global user.name "$GIT_USER_NAME"
git config --global user.email $GIT_USER_EMAIL
# ccmenu
# defaults import net.sourceforge.cruisecontrol.CCMenu ccmenu.plist
# logrotate
ln -sf $DIR/logrotate.d/*.conf $HOMEBREW_DIR/etc/logrotate.d/