Skip to content

Instantly share code, notes, and snippets.

@azirbel
Created June 19, 2016 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azirbel/22c08a5b32142edaf9010e4826499969 to your computer and use it in GitHub Desktop.
Save azirbel/22c08a5b32142edaf9010e4826499969 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
# This script is run in the VM each time you run `vagrant-spk dev`. This is
# the ideal place to invoke anything which is normally part of your app's build
# process - transforming the code in your repository into the collection of files
# which can actually run the service in production.
export SANDSTORM=1
###############################################################################
# BUILD API
echo "[build-api] Starting..."
cd /opt/app
# Install gems in /opt/ruby so that they are not synced with the host
# (courtesy dwrensha)
echo "[build-api] set environment variables..."
export RBENV_ROOT=/usr/local/rbenv
export RAILS_ENV=production
export DEVISE_SECRET=`base64 /dev/urandom | head -c 30`
export PATH="$RBENV_ROOT/bin:$PATH"
echo "[build-api] rbenv init..."
echo `pwd`
echo `which rbenv`
eval "$(rbenv init -)"
echo "[build-api] bundle install..."
cd /opt/app/api
bundle install --path /usr/local/lib/bundle --without test development
echo "[build-api] rake db:setup..."
rake db:setup
echo "[build-api] Done."
###############################################################################
# BUILD CLIENT
echo "[build-client] Starting..."
cd client
echo "[build-client] npm install..."
npm install
echo "[build-client] bower install..."
bower install
# TODO(azirbel): HACK - I get "wrong version of node" errors without this
echo "[build-client] rebuilding node-sass (hack)..."
npm rebuild node-sass
echo "[build-client] ember build..."
ember build
cd ..
echo "[build-client] Done."
echo `which ruby`
echo `which rbenv`
echo `which bundle`
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment