-
Notifications
You must be signed in to change notification settings - Fork 1
/
install
114 lines (93 loc) · 2.79 KB
/
install
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
#!/bin/sh
ruby_version="2.7.0"
python_version="3.8.1"
elixir_version="1.10.0"
nodenv_version="13.7.0"
if ! command -v brew >/dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
else
echo "Homebrew already installed"
fi
echo "Updating Homebrew formulae..."
brew update --force
echo "Installing prerequisites..."
if ! brew list -1 | grep -q "git"; then
brew install git
fi
if [ ! -d "$HOME/.dotfiles" ]; then
echo "Cloning dotfiles..."
git clone "https://github.com/linkyndy/.dotfiles.git" "$HOME/.dotfiles"
else
echo "Dotfiles already cloned"
fi
echo "Symlinking dotfiles..."
ln -sf "$HOME/.dotfiles/.zshrc" "$HOME"
ln -sf "$HOME/.dotfiles/.gemrc" "$HOME"
ln -sf "$HOME/.dotfiles/.gitconfig" "$HOME"
ln -sf "$HOME/.dotfiles/.Brewfile" "$HOME"
ln -sfF "$HOME/.dotfiles/.atom" "$HOME"
echo "Configuring macOS..."
. "$HOME/.dotfiles/macos"
echo "Installing Homebrew Bundle formulae..."
brew bundle --global
if [ ! $(apm list --installed --bare | sed '/^$/d' | wc -l) -eq $(cat "$HOME/.dotfiles/.atom/packages.txt" | wc -l) ]; then
echo "Installing Atom packages..."
apm install --packages-file "$HOME/.dotfiles/.atom/packages.txt"
else
echo "Atom packages already installed"
fi
if ! rbenv versions | grep -q "$ruby_version"; then
echo "Installing Ruby $ruby_version..."
rbenv install -s "$ruby_version"
else
echo "Ruby $ruby_version already installed"
fi
echo "Setting default Ruby..."
rbenv global "$ruby_version"
echo "Updating RubyGems..."
gem update --system
if ! gem list | grep -q "bundler"; then
echo "Installing Bundler..."
gem install bundler
else
echo "Updating Bundler..."
gem update bundler
fi
if ! pyenv versions | grep -q "$python_version"; then
echo "Installing Python $python_version..."
pyenv install -s "$python_version"
else
echo "Python $python_version already installed"
fi
echo "Setting default Python..."
pyenv global "$python_version"
if ! exenv versions | grep -q "$elixir_version"; then
echo "Installing Elixir $elixir_version..."
exenv install "$elixir_version"
else
echo "Elixir $elixir_version already installed"
fi
echo "Setting default Elixir..."
exenv global "$elixir_version"
if ! nodenv versions | grep -q "$nodenv_version"; then
echo "Installing Node $nodenv_version..."
nodenv install "$nodenv_version"
else
echo "Node $nodenv_version already installed"
fi
echo "Setting default Node..."
nodenv global "$nodenv_version"
case "$SHELL" in
*/zsh) : ;;
*)
echo "Changing the shell to zsh..."
shell_path="$(which zsh)"
if ! grep "$shell_path" /etc/shells > /dev/null 2>&1; then
sudo sh -c "echo $shell_path >> /etc/shells"
fi
sudo chsh -s "$shell_path" "$USER"
;;
esac
cowsay 'Mac is set up!'