forked from gokulkrishh/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
135 lines (106 loc) · 4.47 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
#!/bin/bash
# Welcome!!
# Custom dotfiles to get you started with OS X machine for development.
# Author: https://github.com/gokulkrishh
# Source: https://github.com/gokulkrishh/dotfiles
## Custom color codes & utility functions
source helper/utility.sh
## Terminal & Dock setup
source osx/screen.sh
source osx/dock.sh
source osx/system.sh
source osx/terminal.sh
# Welcome msg
e_bold "${tan}┌──────────────────────────────────────────────────────────────┐
| |
| Welcome!! |
| |
| Setup your OS X machine for web development at ease. |
| |
| Author: https://github.com/gokulkrishh |
| |
└──────────────────────────────────────────────────────────────┘"
# 1. Git configuration
e_header "Setup git config (global)"
cp gitignore ~/.gitignore_global ## Adding .gitignore global
git config --global core.excludesfile "${HOME}/.gitignore_global"
ask "${blue} (Option) Enter Your Github Email: "
read -r emailId
if is_empty $emailId; then
git config --global user.email "$emailId" ## Git Email Id
e_success "Email is set"
else
e_error "Not set"
fi
ask "${blue} (Option) Enter Your Github Username: "
read -r userName
if is_empty $userName; then
git config --global user.name "$userName" ## Git Username
e_success "Username is set"
else
e_error "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/dracula.zsh-theme ~/.oh-my-zsh/themes/dracula.zsh-theme ## Copy custom dracula 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
# 3.5 Install software using Homebrew
source software/software.sh
# 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 "Christian Nyvoll" ## Replace it with your name
npm config set init.author.email "[email protected]" ## Replace it with your email id
else
e_warning "NVM is already installed. Skipping.."
fi
## Yarn install
if ! type yarn > /dev/null
then
e_header "Install yarn.."
brew install yarn
fi
## Print installed node, npm version
echo "node --version: $(node --version)"
echo "npm --version: $(npm --version)"
echo "Generating an RSA token for GitHub"
ssh-keygen -t rsa -b 4096 -C "[email protected]" ## Replace it with your email id
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 a logout/restart to take effect."
# END