Skip to content

Commit 3fae9d5

Browse files
Refactor scripts
1 parent ec19a0f commit 3fae9d5

13 files changed

+212
-219
lines changed

android-development.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,29 @@
55
# Exit immediately if a command exits with a non-zero status
66
set -e
77

8-
# Update the user's cached credentials, authenticating the user if necessary
9-
sudo -v
8+
# Store a local variable of the scripts current directory
9+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1010

11-
if ! command -v 'brew' >/dev/null 2>&1 ; then
12-
echo '==> Homebrew not found. Installing now...'
13-
./brew.sh
11+
if ! command -v "brew" > /dev/null 2>&1; then
12+
echo "==> Homebrew not found. Installing now..."
13+
${DIR}/brew.sh
1414
fi
1515

16-
if command -v 'brew' >/dev/null 2>&1 ; then
17-
echo '==> Installing Android development environment...'
16+
if command -v "brew" > /dev/null 2>&1; then
17+
echo "==> Installing Android development environment..."
18+
1819
brew cask install android-studio
1920

20-
echo 'export PATH=$PATH:$HOME/Library/Android/sdk/platform-tools/' >> ~/.bash_profile
21-
echo 'export PATH=$PATH:$HOME/Library/Android/sdk/tools/' >> ~/.bash_profile
21+
echo "export PATH=$PATH:$HOME/Library/Android/sdk/platform-tools/" >> ~/.bash_profile
22+
echo "export PATH=$PATH:$HOME/Library/Android/sdk/tools/" >> ~/.bash_profile
23+
echo "\n" >> ~/.bash_profile
24+
25+
echo "export PATH=$PATH:$HOME/Library/Android/sdk/platform-tools/" >> ~/.zlogin
26+
echo "export PATH=$PATH:$HOME/Library/Android/sdk/tools/" >> ~/.zlogin
27+
echo "\n" >> ~/.zlogin
28+
29+
echo "==> Android development environment installed."
2230
else
23-
echo '==> Homebrew not found. Aborting...'
31+
echo "==> Homebrew not found. Aborting..."
2432
exit 1
2533
fi

angular.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
# Exit immediately if a command exits with a non-zero status
66
set -e
77

8-
# Update the user's cached credentials, authenticating the user if necessary
9-
sudo -v
8+
# Store a local variable of the scripts current directory
9+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1010

11-
if ! command -v 'npm' >/dev/null 2>&1 ; then
12-
echo '==> NPM not installed. Installing Node.js now...'
13-
./nodejs.sh
11+
if ! command -v "npm" > /dev/null 2>&1; then
12+
echo "==> NPM not installed. Installing Node.js now..."
13+
${DIR}/nodejs.sh
1414
fi
1515

16-
if command -v 'npm' >/dev/null 2>&1 ; then
17-
echo '==> Installing Angular CLI...'
16+
if command -v "npm" > /dev/null 2>&1; then
17+
echo "==> Installing Angular CLI..."
1818
npm install -g @angular/cli
19+
echo "==> Angular CLI installed."
1920
else
20-
echo '==> NPM not installed. Aborting...'
21+
echo "==> NPM not installed. Aborting..."
2122
exit 1
2223
fi

bootstrap.sh

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,40 @@ set -e
88
# Update the user's cached credentials, authenticating the user if necessary
99
sudo -v
1010

11-
echo '==> Install macOS updates? (Y/n)'
11+
# Store a local variable of the scripts current directory
12+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
13+
14+
echo "==> Install macOS updates? (Y/n)"
1215
read USER_PROMPT
13-
if [ "$USER_PROMPT" == 'y' ] || [ "$USER_PROMPT" == '' ]; then
16+
if [[ "$USER_PROMPT" == 'y' ]] || [[ "$USER_PROMPT" == '' ]]; then
1417
echo "==> Updating macOS..."
1518
softwareupdate -l
1619
softwareupdate -i -a
20+
echo "==> macOS updated installed."
1721
else
18-
echo '==> Skipping macOS updates'
22+
echo "==> Skipping macOS updates."
1923
fi
2024

21-
echo '==> Install macOS tweaks? (Y/n)'
25+
echo "==> Install macOS tweaks? (Y/n)"
2226
read USER_PROMPT
23-
if [ "$USER_PROMPT" == 'y' ] || [ "$USER_PROMPT" == '' ]; then
24-
./macos-tweaks.sh
27+
if [[ "$USER_PROMPT" == 'y' ]] || [[ "$USER_PROMPT" == '' ]]; then
28+
${DIR}/macos-tweaks.sh
2529
else
26-
echo '==> Skipping macOS tweaks'
30+
echo "==> Skipping macOS tweaks."
2731
fi
2832

29-
echo '==> Install user applications? (Y/n)'
33+
echo "==> Install user applications? (Y/n)"
3034
read USER_PROMPT
31-
if [ "$USER_PROMPT" == 'y' ] || [ "$USER_PROMPT" == '' ]; then
32-
./gui-applications.sh
35+
if [[ "$USER_PROMPT" == 'y' ]] || [[ "$USER_PROMPT" == '' ]]; then
36+
${DIR}/gui-applications.sh
3337
else
34-
echo '==> Skipping user applications'
38+
echo "==> Skipping user applications."
3539
fi
3640

37-
echo '==> Install development utilities? (Y/n)'
41+
echo "==> Install development utilities? (Y/n)"
3842
read USER_PROMPT
39-
if [ "$USER_PROMPT" == 'y' ] || [ "$USER_PROMPT" == '' ]; then
40-
./development-utils.sh
43+
if [[ "$USER_PROMPT" == 'y' ]] || [[ "$USER_PROMPT" == '' ]]; then
44+
${DIR}/development-utils.sh
4145
else
42-
echo '==> Skipping development utilities'
46+
echo "==> Skipping development utilities."
4347
fi

brew.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
# Exit immediately if a command exits with a non-zero status
66
set -e
77

8-
# Update the user's cached credentials, authenticating the user if necessary
9-
sudo -v
10-
11-
echo '==> Installing Homebrew...'
8+
echo "==> Installing Homebrew..."
129
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
10+
echo "==> Homebrew installed."

development-utils.sh

Lines changed: 86 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -8,127 +8,136 @@ set -e
88
# Update the user's cached credentials, authenticating the user if necessary
99
sudo -v
1010

11-
echo '==> Install Xcode command line tools? (Y/n)'
11+
# Store a local variable of the scripts current directory
12+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
13+
14+
echo "==> Install Xcode command line tools? (Y/n)"
1215
read USER_PROMPT
13-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
14-
echo '==> Installing Xcode command line tools...'
16+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
17+
echo "==> Installing Xcode command line tools..."
1518
xcode-select --install
1619
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
20+
echo "==> Xcode command line tools installed."
1721
else
18-
echo '==> Skipping Xcode command line tools'
22+
echo "==> Skip installing Xcode command line tools."
1923
fi
2024

21-
echo '==> Install CocoaPods? (Y/n)'
25+
echo "==> Install CocoaPods? (Y/n)"
2226
read USER_PROMPT
23-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
24-
echo '==> Installing CocoaPods...'
27+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
28+
echo "==> Installing CocoaPods..."
2529
sudo gem install cocoapods
30+
echo "==> CocoaPods installed."
2631
else
27-
echo '==> Skipping CocoaPods'
32+
echo "==> Skipping CocoaPods."
2833
fi
2934

30-
if ! command -v 'brew' >/dev/null 2>&1 ; then
31-
echo '==> Install Homebrew? (Y/n)'
35+
if ! command -v "brew" > /dev/null 2>&1; then
36+
echo "==> Install Homebrew? (Y/n)"
3237
read USER_PROMPT
33-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
34-
./brew.sh
38+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
39+
${DIV}/brew.sh
3540
else
36-
echo '==> Skipping Homebrew'
41+
echo "==> Skipping Homebrew."
3742
fi
3843
fi
3944

40-
echo '==> Tap Homebrew Caskroom? (Y/n)'
41-
read USER_PROMPT
42-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
43-
echo '==> Tapping Homebrew Caskroom...'
44-
45-
brew tap caskroom/cask
46-
brew tap caskroom/versions
47-
else
48-
echo '==> Skipping Homebrew Cask'
49-
fi
50-
51-
echo '==> Install updated GNU utilities? (Y/n)'
45+
echo "==> Install updated GNU utilities? (Y/n)"
5246
read USER_PROMPT
53-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
54-
./gnu-utils.sh
47+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
48+
${DIV}/gnu-utils.sh
5549
else
56-
echo '==> Skipping updated GNU utilities'
50+
echo "==> Skipping updated GNU utilities."
5751
fi
5852

59-
echo '==> Install development applications? (Y/n)'
53+
echo "==> Install development applications? (Y/n)"
6054
read USER_PROMPT
61-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
62-
echo '==> Installing development applications...'
55+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
56+
echo "==> Installing development applications..."
6357
brew install git
64-
brew cask install docker gitkraken intellij-idea iterm2 postman visual-studio-code
65-
else
66-
echo '==> Skipping development applications'
67-
fi
6858

69-
echo '==> Install Node.js? (Y/n)'
70-
read USER_PROMPT
71-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
72-
./nodejs.sh
59+
brew cask install \
60+
docker \
61+
gitkraken \
62+
intellij-idea \
63+
iterm2 \
64+
postman \
65+
visual-studio-code
7366
else
74-
echo '==> Skipping Node.js'
67+
echo "==> Skipping development applications."
7568
fi
7669

77-
echo '==> Install Ionic? (Y/n)'
78-
read USER_PROMPT
79-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
80-
./ionic.sh
70+
if ! command -v "node" > /dev/null 2>&1; then
71+
echo "==> Install Node.js? (Y/n)"
72+
read USER_PROMPT
73+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
74+
${DIV}/nodejs.sh
75+
else
76+
echo "==> Skipping Node.js."
77+
fi
78+
fi
8179

82-
echo '==> Clone Ionic projects? (Y/n)'
80+
if ! command -v "ionic" > /dev/null 2>&1; then
81+
echo "==> Install Ionic? (Y/n)"
8382
read USER_PROMPT
84-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
85-
./ionic-projects.sh
83+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
84+
${DIV}/ionic.sh
85+
86+
echo "==> Clone Ionic projects? (Y/n)"
87+
read USER_PROMPT
88+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
89+
${DIV}/ionic-projects.sh
90+
else
91+
echo "==> Skip cloning Ionic projects."
92+
fi
8693
else
87-
echo '==> Skipping Ionic projects'
94+
echo "==> Skipping Ionic."
8895
fi
89-
else
90-
echo '==> Skipping Ionic'
9196
fi
9297

93-
echo '==> Install Angular? (Y/n)'
94-
read USER_PROMPT
95-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
96-
./angular.sh
97-
98-
# echo '==> Clone Angular projects? (Y/n)'
99-
# read USER_PROMPT
100-
# if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
101-
# ./angular-projects.sh
102-
# else
103-
# echo '==> Skipping Angular projects'
104-
# fi
105-
else
106-
echo '==> Skipping Angular'
98+
if ! command -v "ng" > /dev/null 2>&1; then
99+
echo "==> Install Angular? (Y/n)"
100+
read USER_PROMPT
101+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
102+
${DIV}/angular.sh
103+
104+
# echo "==> Clone Angular projects? (Y/n)"
105+
# read USER_PROMPT
106+
# if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
107+
# ${DIV}/angular-projects.sh
108+
# else
109+
# echo "==> Skip cloning Angular projects."
110+
# fi
111+
else
112+
echo "==> Skipping Angular."
113+
fi
107114
fi
108115

109-
echo '==> Install Java 8? (Y/n)'
116+
echo "==> Install Java 8? (Y/n)"
110117
read USER_PROMPT
111-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = 'yes' ] || [ "$USER_PROMPT" = '' ]; then
112-
if ! command -v 'brew' >/dev/null 2>&1 ; then
113-
echo '==> Homebrew not found. Installing now...'
114-
./brew.sh
118+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = 'yes' ]] || [[ "$USER_PROMPT" = '' ]]; then
119+
if ! command -v "brew" > /dev/null 2>&1; then
120+
echo "==> Homebrew not found. Installing now..."
121+
${DIV}/brew.sh
115122
fi
116123

117-
if command -v 'brew' >/dev/null 2>&1 ; then
118-
echo '==> Installing Java 8...'
124+
if command -v "brew" > /dev/null 2>&1; then
125+
echo "==> Installing Java 8..."
119126
brew cask install java8
120127
else
121-
echo '==> Homebrew not found. Aborting...'
128+
echo "==> Homebrew not found. Aborting..."
122129
exit 1
123130
fi
124131
else
125-
echo '==> Skipping Java 8'
132+
echo "==> Skipping Java 8."
126133
fi
127134

128-
echo '==> Install Android development environment? (Y/n)'
135+
echo "==> Install Android development environment? (Y/n)"
129136
read USER_PROMPT
130-
if [ "$USER_PROMPT" = 'y' ] || [ "$USER_PROMPT" = '' ]; then
131-
./android-development.sh
137+
if [[ "$USER_PROMPT" = 'y' ]] || [[ "$USER_PROMPT" = '' ]]; then
138+
${DIV}/android-development.sh
132139
else
133-
echo '==> Skipping Android development environment'
140+
echo "==> Skipping Android development environment."
134141
fi
142+
143+
echo "==> Development utilities installed."

fts/bootstrap.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)