install_client_deps.sh 1.07 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
#!/bin/bash

#
# This script downloads browser client libraries.
# Currently all scripts are downloaded from GitHub.
#
# Versions used may be changed by altering the lines
# starting with 'downloadFromGithub' at the bottom.
# The last argument is expected to be a git ref (ie
# a branch name, tag or commit-ish).
11
#
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

set -e

DEST=$(dirname $(dirname $0))/static/libs

# Github download helper
#   $1	destination directory name under static/libs
#   $2  github repo name (user-or-org/repo)
#   $3  ref to use (branch or tag or commit)
function downloadFromGithub()
{
	local dest=$DEST/$1
	local repo=$2
	local ref=$3

Jamesie Pic's avatar
Jamesie Pic committed
27
28
29
30
	if [ -d $dest ]; then
		echo "* $repo ($ref) already downloaded, skipping"
		return
	fi
31
	echo "* Downloading $repo ($ref) from Github..."
32
	wget -O temp.zip -q https://github.com/${repo}/archive/${ref}.zip
33
34
35
36
37
38
39
	unzip -q temp.zip
	mv $(basename ${repo})* ${dest}
	rm temp.zip
}

set -e

Jamesie Pic's avatar
Jamesie Pic committed
40
41
42
if [ -z ${CI-} ]; then
	[ -d ${DEST} ] && rm -r ${DEST}
fi
43
44
45
46
47
48
mkdir -p ${DEST}

downloadFromGithub jquery jquery/jquery 2.1.4
downloadFromGithub flag-icon-css lipis/flag-icon-css 0.7.1

echo "* Done."