forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_assets.sh
executable file
·55 lines (48 loc) · 1.38 KB
/
install_assets.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
#!/bin/bash
set -o nounset -o errexit -o errtrace
function bundle_config_and_install() {
# set up bundle config options \
echo "Running bundle config and bundle install..."
bundle config --global build.nokogiri --use-system-libraries &&
bundle config --global build.ffi --enable-system-libffi &&
mkdir -p /home/docker/.bundle &&
bundle install --jobs $(nproc)
}
function yarn_install() {
echo "Running yarn install..."
yarn install --ignore-optional --pure-lockfile || yarn install --ignore-optional --pure-lockfile --network-concurrency 1
}
function compile_assets() {
echo "Running compile assets dev (css and js only, no docs or styleguide)..."
bundle exec rails canvas:compile_assets_dev
}
ALL_COMMANDS='y'
while getopts ":c:" opt; do
case ${opt} in
c )
command=${OPTARG}
if [ "$command" = "bundle" ]
then
BUNDLE_CONFIG='y'
ALL_COMMANDS='n'
elif [ "$command" = "yarn" ]
then
YARN_INSTALL='y'
ALL_COMMANDS='n'
elif [ "$command" = "compile" ]
then
COMPILE='y'
ALL_COMMANDS='n'
fi
;;
esac
done
if [[ ${BUNDLE_CONFIG-n} = 'y' ]] || [[ ${ALL_COMMANDS-n} = 'y' ]]; then
bundle_config_and_install
fi
if [[ ${YARN_INSTALL-n} = 'y' ]] || [[ ${ALL_COMMANDS-n} = 'y' ]]; then
yarn_install
fi
if [[ ${COMPILE-n} = 'y' ]] || [[ ${ALL_COMMANDS-n} = 'y' ]]; then
compile_assets
fi