Skip to content

Commit

Permalink
Split up install and run for usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
envygeeks committed Jun 15, 2017
1 parent 3a0dfd6 commit bcff7ad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
23 changes: 23 additions & 0 deletions repos/jekyll/copy/all/usr/local/bin/install-depends
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
[ "$JEKYLL_DEBUG" = "true" ] && set -x
set -e

if [ ! -f /updated ]; then
apk update
apk add build-base ruby-dev
touch /updated

if [ -f ".apk" ] && [ "$CONNECTED" = "true" ]
then apk --update add $(
cat .apk
)
fi
fi

BUNDLE_ARGS="--jobs=1"
if [ -f Gemfile ]; then
[ "$BUNDLE_CACHE" = "true" ] && BUNDLE_ARGS="--jobs=1 --path=vendor/bundle"
bundle check > /dev/null 2>&1 || sudo -EHu jekyll bundle install $BUNDLE_ARGS
cp -a Gemfile.lock /tmp/Gemfile.lock.offline
cp -a Gemfile /tmp/Gemfile.offline
fi
24 changes: 3 additions & 21 deletions repos/jekyll/copy/all/usr/local/bin/jekyll
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
set -e

if [ -z "$CONNECTED" ]; then
CONNECTED=true
export CONNECTED=true
wget -qs https://google.com >/dev/null || \
CONNECTED=false
export CONNECTED=false
fi

finish() {
Expand Down Expand Up @@ -39,25 +39,7 @@ rm -rf .bundle
status=0

if [ "$CONNECTED" = "true" ]; then
if [ ! -f /updated ]; then
apk update
apk add build-base ruby-dev
touch /updated

if [ -f ".apk" ] && [ "$CONNECTED" = "true" ]
then apk --update add $(
cat .apk
)
fi
fi

BUNDLE_ARGS="--jobs=1"
if [ -f Gemfile ]; then
[ "$BUNDLE_CACHE" = "true" ] && BUNDLE_ARGS="--jobs=1 --path=vendor/bundle"
bundle check > /dev/null 2>&1 || sudo -EHu jekyll bundle install $BUNDLE_ARGS
cp -a Gemfile.lock /tmp/Gemfile.lock.offline
cp -a Gemfile /tmp/Gemfile.offline
fi
/usr/local/bin/install-depends
else
if [ -f "/tmp/Gemfile.offline" ]; then
cp -a /tmp/Gemfile.offline Gemfile
Expand Down

0 comments on commit bcff7ad

Please sign in to comment.