-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_machine.sh
executable file
·109 lines (98 loc) · 3.19 KB
/
new_machine.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
#!/bin/bash
# ===========================================================================
# Cleanup
# ===========================================================================
function clean_up() {
# Step 7
local msg="cleanup"
echo "$msg"
source ~/.zshrc
}
# ===========================================================================
# Moves Config Files
# ===========================================================================
function moves_config() {
# Step 6
local msg="moving config files"
echo "$msg"
mv .zshrc ~/.zshrc
mv configfiles/git/.gitconfig ~/.gitconfig
mv configfiles/git/.gitignore ~/.gitignore
mv configfiles/hyper/.hyper.js ~/.hyper.js
mv configfiles/zsh/.zshrc ~/.zshrc
clean_up
}
# ===========================================================================
# Installs Python3 and Pip
# ===========================================================================
function install_python() {
# Step 5
local msg="installing python and pip"
echo "$msg"
brew install python3
pip3 install virtualenv
moves_config
}
# ===========================================================================
# Installs Popular Applications
# ===========================================================================
function install_zsh() {
# Step 4
local msg="installing zsh"
echo "$msg"
if [ -f /bin/zsh -o -f /usr/bin/zsh ]; then
if [[ ! -d $dir/oh-my-zsh/ ]]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
fi
if [[ ! $(echo $SHELL) == $(which zsh) ]]; then
chsh -s $(which zsh)
fi
else
echo "We'll install zsh, then re-run this script!"
brew install zsh
fi
install_python
}
# ===========================================================================
# Installs Popular Applications
# ===========================================================================
function install_apps() {
# Step 3
local msg="installing popular apps"
echo "$msg"
brew install git
brew install node
brew cask install hyper
brew cask install google-chrome
brew cask install visual-studio-code
brew cask install postman
brew cask install slack
install_zsh
}
# ===========================================================================
# Brew Cask Installer
# ===========================================================================
function install_cask() {
# Step 2
if brew ls --versions myformula > /dev/null; then
ruby <(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)
else
brew update
fi
brew upgrade
# Install
brew install caskroom/cask/brew-cask
}
function check_cask() {
# Step 1
local msg="brew cask not installed, installing"
if ! type -P "brew-cask" > /dev/null; then
echo "$msg" && install_cask
fi
install_apps
}
# ===============================================================================
# Entry Point
# ===============================================================================
echo "Welcome to your new machine. This will build your dev environment."
check_cask