-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bundle.sh
executable file
·73 lines (58 loc) · 1.58 KB
/
.bundle.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
#!/bin/bash
(cd ~ || exit; git fetch)
if ! [[ $BREWFILE ]]; then
export BREWFILE=~/.Brewfile
fi
echo "Using $BREWFILE for Homebrew"
# "Edit" command
if [[ $1 = 'e' ]] || [[ $1 = 'edit' ]]; then
echo "Opening $BREWFILE..."
if [ -x "$(command -v zed)" ]; then
zed "$BREWFILE"
else
vi "$BREWFILE"
fi
exit 0
fi
if [[ $1 = 's' ]] || [[ $1 = 'search' ]]; then
echo "Opening Homebrew search..."
open "https://formulae.brew.sh/formula/"
exit 0
fi
printf "Checking for Mac update...\n"
softwareupdate -l
# Install Oh My Zsh
if ! [[ $SHELL = '/bin/zsh' ]]; then
printf "Installing Oh My Zsh...\n"
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
# Install Homebrew
if ! [[ -x "$(command -v brew)" ]]; then
printf "Installing Homebrew...\n"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
printf "\n"
printf "Updating Homebrew...\n"
brew update --verbose
printf "\n"
printf "Installing Homebrew apps...\n"
brew bundle --verbose --cleanup --file "$BREWFILE"
printf "\n"
printf "Installing Go tools...\n"
./.go-install-tools.sh
if [[ $1 = 'u' ]] || [[ $1 = 'upgrade' ]]; then
printf "\n"
printf "Upgrading Homebrew apps...\n"
brew upgrade --verbose
fi
if [[ -f "~/Projects" ]]; then
printf "\n"
echo "Setting up Projects directory...\n"
mkdir ~/Projects
fi
if ! [[ -z "$(cd ~; git status --porcelain)" ]]; then
printf "\n"
(cd ~ || exit; git status)
printf "\n"
echo "Warning: You need to sync your home directory!"
fi