Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit 9a4d96f

Browse files
committed
Tidy up bash scripts
Use the inline syntax for `if; then`. It makes the script more readable.
1 parent f52e179 commit 9a4d96f

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

install_travis_dependencies.sh

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
#!/bin/bash
22

3-
if [ -n "$SNIPPET_LANGUAGE" ]
4-
then
3+
languages=""
4+
5+
if [ -n "$SNIPPET_LANGUAGE" ]; then
56
echo "Installing dependencies for: ${SNIPPET_LANGUAGE//:/,}"
67
languages="$SNIPPET_LANGUAGE"
7-
else
8-
languages=""
98
fi
109

1110
# Install common dependencies
1211
jdk_switcher use oraclejdk8
1312
sudo apt-get install -y --force-yes build-essential ca-certificates git curl
1413

15-
if [[ $languages == *"java"* ]]
16-
then
14+
if [[ $languages == *"java"* ]]; then
1715
sudo add-apt-repository ppa:cwchien/gradle -y
1816
sudo apt-get update
1917
sudo apt-get install -y --force-yes gradle
2018
fi
2119

22-
if [[ $languages == *"node"* ]]
23-
then
20+
if [[ $languages == *"node"* ]]; then
2421
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
2522
sudo apt-get install -y --force-yes nodejs
2623
sudo npm install -g n
@@ -30,14 +27,13 @@ then
3027
nvm use stable
3128
fi
3229

33-
if [[ $languages == *"python"* ]]
34-
then
30+
if [[ $languages == *"python"* ]]; then
3531
sudo apt-get install -y --force-yes python-dev python-pip
3632
sudo pip install --upgrade pip wheel --quiet
3733
fi
3834

39-
if [[ $languages == *"php"* ]]
40-
then
35+
if [[ $languages == *"php"* ]]; then
4136
sudo apt-get install -y --force-yes php5-cli git php5-curl
4237
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
4338
fi
39+

run_twilio_api_faker.sh

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#!/bin/bash
22

3-
if [ -n "$SNIPPET_LANGUAGE" ]
4-
then
3+
languages=""
4+
5+
if [ -n "$SNIPPET_LANGUAGE" ]; then
56
echo "Installing dependencies for: ${SNIPPET_LANGUAGE//:/,}"
67
languages=$SNIPPET_LANGUAGE
7-
else
8-
languages=""
98
fi
109

11-
if [[ $languages == *"python"* ]] || [[ $languages == *"node"* ]] || [[ $languages == *"ruby"* ]] || [[ $languages == *"curl"* ]] || [[ $languages == *"php"* ]]
12-
then
10+
if [[ $languages == *"python"* ]] || [[ $languages == *"node"* ]] || [[ $languages == *"ruby"* ]] || [[ $languages == *"curl"* ]] || [[ $languages == *"php"* ]]; then
1311
cd twilio-api-faker
1412
sudo gradle run </dev/null &>/dev/null &
1513
cd ..
1614
sleep 25
1715
fi
16+

0 commit comments

Comments
 (0)