-
Notifications
You must be signed in to change notification settings - Fork 11
/
dev.sh
executable file
·36 lines (27 loc) · 944 Bytes
/
dev.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
#!/bin/sh
# This script removes the need for having docker to build the site locally.
# You can run it through "./dev.sh"
if [ ! -d ".content" ]
then
echo "No cached '.content' directory found. Fetching the latest data..."
git clone https://github.com/genicsblog/genicsblog.com .content -q
rm -rf .content/.git
fi
DIFF_GEM=$(diff -q Gemfile .content/Gemfile)
DIFF_PACKAGE=$(diff -q package.json .content/package.json)
rsync -r --exclude '.content' . .content/
cd .content
if [ ! -d ".bundle" ]; then bundle config set --local path 'vendor'; fi
[ ! -z "$DIFF_GEM" ] && echo "Gemfile change detected!"
[ ! -z "$DIFF_PACKAGE" ] && echo "package.json change detected!"
if [ ! -d "node_modules" ] || [ ! -z "$DIFF_PACKAGE" ]
then
echo "Installing node dependencies..."
npm i --silent
fi
if [ ! -d "vendor" ] || [ ! -z "$DIFF_GEM" ]
then
echo "Installing gem dependencies..."
bundle install --quiet
fi
bundle exec jekyll serve