forked from canonical/vanilla-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.install_dependencies.sh
executable file
·52 lines (46 loc) · 1.53 KB
/
.install_dependencies.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
#! /usr/bin/env bash
set -e
# Use 'sudo' for development setup, but simply '/usr/bin/env' in other environments
COMMAND_PREFIX="sudo /usr/bin/env"
GULP="/usr/bin/gulp"
if [[ "${DEBIAN_FRONTEND}" == "noninteractive" ]] || [[ "$(whoami)" == "root" ]]; then
COMMAND_PREFIX="/usr/bin/env"
GULP="/usr/bin/env gulp"
fi
echo "Project dependencies:"
# Test for gulp, install if not found
all_versions=$(${GULP} --version 2> /dev/null) || error=$?
if [[ ${error} -eq 0 ]]; then
echo "Found gulp ($(echo ${all_versions}))"
elif [[ ${error} == 127 ]]; then
echo "gulp not found: installing gulp"
${COMMAND_PREFIX} npm install -g gulp
echo "Installed gulp"
else
echo "Unexpected error when running gulp"
exit 1
fi
# Test for gem, install if not found
version=$(/usr/bin/env gem --version 2> /dev/null) || error=$?
if [[ ${error} -eq 0 ]]; then
echo "Found gem (${version})"
elif [[ ${error} == 127 ]]; then
echo "gem not found: installing ruby-dev"
${COMMAND_PREFIX} apt install ruby-dev
echo "Installed ruby-dev"
else
echo "Unexpected error when running gem"
exit 1
fi
# Test for scss-lint, install if not found
version=$(/usr/bin/env scss-lint --version 2> /dev/null) || error=$?
if [[ ${error} -eq 0 ]]; then
echo "Found scss-lint (${version})"
elif [[ ${error} == 127 ]] || [[ ${version} < 0.34 ]]; then
echo "scss-lint not found: installing scss-lint"
${COMMAND_PREFIX} gem install scss-lint
echo "Installed scss-lint"
else
echo "Unexpected error when running scss-lint"
exit 1
fi