-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
install.sh
148 lines (118 loc) · 4.65 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
145
146
147
148
#!/bin/bash
# Welcome!!
# Setup your MacOS for web development at ease.
# Source: https://github.com/gokulkrishh/dotfiles
## Custom color codes & utility functions
source helper/utility.sh
## Screen, Dock & System setup
source osx/screen.sh
source osx/dock.sh
source osx/system.sh
# Welcome message
e_bold "${tan}┌──────────────────────────────────────────────────────────────┐
| |
| Welcome!! |
| |
| Setup your MacOS for web development at ease. |
| |
| Author: https://github.com/gokulkrishh |
| |
└──────────────────────────────────────────────────────────────┘"
# 1. Git configuration
e_header "To setup git/npm/ssh configs"
cp gitignore ~/.gitignore_global ## Adding .gitignore global
git config --global core.excludesfile "${HOME}/.gitignore_global"
git config --global help.autocorrect 1 ## Git autocorrections
git config --global init.defaultBranch main ## Git main branch as default
ask "${blue} (Required) Enter Your Fullname: "
read -r fullName
if is_empty $fullName; then
e_success "Captured the Fullname"
else
e_error "Fullname not set"
fi
ask "${blue} (Required) Enter Your Email (For Github, NPM config): "
read -r emailId
if is_empty $emailId; then
git config --global user.email "$emailId"
e_success "Captured the Email Id"
else
e_error "Not set"
fi
ask "${blue} (Required) Enter Your Github Username: "
read -r userName
if is_empty $userName; then
git config --global user.name "$userName"
e_success "Captured the Username"
else
e_error "Username not set"
fi
# 2. Install Oh-My-Zsh & custom aliases
ZSH=~/.oh-my-zsh
if [ -d "$ZSH" ]; then
e_warning "Oh My Zsh is already installed. Skipping.."
else
e_header "Installing Oh My Zsh..."
curl -L http://install.ohmyz.sh | sh
## To install ZSH themes & aliases
e_header "Copying ZSH themes & aliases..."
e_note "Check .aliases file for more details."
cp oh-my-zsh/aliases ~/.aliases ## Copy aliases
cp oh-my-zsh/zshrc ~/.zshrc ## Copy zshrc configs
cp oh-my-zsh/bullet-train.zsh-theme ~/.oh-my-zsh/themes/bullet-train.zsh-theme ## Copy zsh theme
cp oh-my-zsh/z.sh ~/z.sh ## Copy z.sh autocompletion file
git clone https://github.com/peterhurford/git-it-on.zsh ~/.oh-my-zsh/custom/plugins/git-it-on ## Copy git it on utilities plugin
fi
## Create codelabs & workspace directory
mkdir codelabs
mkdir workspace
# 3. Install Homebrew
if test ! $(which brew); then
e_header "Installing Homebrew"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
e_warning "Homebrew is already installed. Skipping.."
fi
# 4. Install ZSH NVM
if test ! $(which nvm); then
e_header "Installing zsh-nvm.."
git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm
## To setup npm install/update -g without sudo
cp npmrc ~/.npmrc
mkdir "${HOME}/.npm-packages"
export PATH="$HOME/.node/bin:$PATH"
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
## Set npm global config
npm config set init-author-name "$fullName"
npm config set init-author-email "$emailId"
npm config set init-author-url "$siteName"
else
e_warning "NVM is already installed. Skipping.."
fi
# 5. Print installed node, npm version
echo "node --version: $(node --version)"
echo "npm --version: $(npm --version)"
## Install useful mac apps
brew install --cask \
arc \
iterm2 \
visual-studio-code \
1password \
spotify \
## Install terminal apps
brew install \
wget \
git
# 6. Generate RSA Token for github
echo "Generating an RSA token for GitHub"
ssh-keygen -t rsa -b 4096 -C "$emailId"
echo "Host *\n AddKeysToAgent yes\n UseKeychain yes\n IdentityFile ~/.ssh/id_rsa" | tee ~/.ssh/config
eval "$(ssh-agent -s)"
echo "run 'pbcopy < ~/.ssh/id_rsa.pub' and paste that into GitHub"
## Remove cloned dotfiles from system
if [ -d ~/dotfiles ]; then
sudo rm -R ~/dotfiles
fi
e_thanks "Author: https://github.com/gokulkrishh \n"
echo "🍺 Thats all, Done. Note that some of these changes require logout/restart to take effect."
# END