-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathinstall.sh
More file actions
145 lines (112 loc) · 4.14 KB
/
install.sh
File metadata and controls
145 lines (112 loc) · 4.14 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
set -e
# Welcome!!
# Setup your MacOS for web development at ease.
# Source: https://github.com/gokulkrishh/dotfiles
## Custom color codes & utility functions
source helper/utility.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
git config --global core.excludesfile "${HOME}/.gitignore_global"
git config --global help.autocorrect 1
git config --global init.defaultBranch main
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 -fsSL https://install.ohmyz.sh | sh
e_header "Copying ZSH themes & aliases..."
e_note "Check .aliases file for more details."
cp oh-my-zsh/aliases ~/.aliases
cp oh-my-zsh/zshrc ~/.zshrc
cp oh-my-zsh/z.sh ~/z.sh
git clone https://github.com/peterhurford/git-it-on.zsh ~/.oh-my-zsh/custom/plugins/git-it-on
fi
## Create codelabs & workspace directory
mkdir -p "$HOME/codelabs"
mkdir -p "$HOME/workspace"
# 3. Install Homebrew
if test ! $(which brew); then
e_header "Installing Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
e_warning "Homebrew is already installed. Skipping.."
fi
# 4. Install ZSH NVM
if [ ! -d "$HOME/.oh-my-zsh/custom/plugins/zsh-nvm" ]; then
e_header "Installing zsh-nvm.."
git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm
cp npmrc ~/.npmrc
mkdir -p "${HOME}/.npm-packages"
sudo chown -R "$(whoami)" "$(npm config get prefix)"/{lib/node_modules,bin,share}
npm config set init-author-name "$fullName"
npm config set init-author-email "$emailId"
else
e_warning "NVM is already installed. Skipping.."
fi
# 5. Install apps & tools via Homebrew
brew install --cask \
thebrowsercompany-dia \
iterm2 \
visual-studio-code \
1password
brew install \
wget \
git \
duti \
trash
# 6. Apply macOS system defaults
e_header "Applying macOS system defaults..."
source osx/screen.sh
source osx/dock.sh
source osx/system.sh
# 7. Generate SSH key for GitHub
e_header "Generating an Ed25519 SSH key for GitHub"
ssh-keygen -t ed25519 -C "$emailId"
printf "Host *\n AddKeysToAgent yes\n UseKeychain yes\n IdentityFile ~/.ssh/id_ed25519\n" | tee ~/.ssh/config
eval "$(ssh-agent -s)"
echo "run 'pbcopy < ~/.ssh/id_ed25519.pub' and paste that into GitHub"
## Remove cloned dotfiles from system
if [ -d ~/dotfiles ]; then
e_warning "Removing ~/dotfiles directory..."
rm -rf ~/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