forked from alphagov/government-service-design-manual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·58 lines (46 loc) · 1.88 KB
/
compile.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
56
57
58
#!/bin/bash
set -e
if [ $(find . -name '*.orig' -type f | grep -c .) -ne 0 ]; then
echo "You seem to have some git merge artifacts on the filesystem. Aborting..."
exit 1
fi
echo "Updating submodules to ensure toolkit up to date..."
git submodule update --init
echo "Updated."
DESIGN_PRINCIPLES_ROOT="../design-principles"
DIRECTORY="$DESIGN_PRINCIPLES_ROOT/public"
GUIDANCE_PATH="$DIRECTORY/service-manual"
SEARCH_CONTENT_PATH="$DESIGN_PRINCIPLES_ROOT/db/index/"
if [ ! -d "$DIRECTORY" ]; then
echo "Couldn't find design principles app in $DIRECTORY"
fi
if [ -d $GUIDANCE_PATH ]; then
echo "Emptying existing service-manual folder"
rm -rf $GUIDANCE_PATH
rm -rf ./_site
fi
bundle exec jekyll build
# Jekyll will fail to compile the Sass files if the frontend toolkit isn't checked out
# however Jekyll doesn't exit with a helpful error, so the build doesn't fail.
echo "Checking CSS compiled"
function check_css_compiled {
if [ -f $1 ]; then
echo " OK: Found CSS file $1";
else
echo " ERROR: $1 not compiled, Sass compilation above probably failed.";
exit 1;
fi
}
check_css_compiled ./_site/service-manual/assets/stylesheets/main.css
check_css_compiled ./_site/service-manual/assets/stylesheets/print.css
check_css_compiled ./_site/service-manual/assets/stylesheets/main-ie6.css
check_css_compiled ./_site/service-manual/assets/stylesheets/main-ie7.css
check_css_compiled ./_site/service-manual/assets/stylesheets/main-ie8.css
echo "Copying the compiled manual to $GUIDANCE_PATH"
cp -R ./_site/service-manual $GUIDANCE_PATH
mv ./.search-index.json $SEARCH_CONTENT_PATH/service-manual.json
echo "************************************************"
echo "** design-principles app updated successfully **"
echo "************************************************"
echo "You should now push the design-principles changes to GitHub"
echo "and then schedule a deployment for it"