Skip to content

Instantly share code, notes, and snippets.

@lupomontero
Last active October 11, 2015 03:38
Show Gist options
  • Save lupomontero/3797411 to your computer and use it in GitHub Desktop.
Save lupomontero/3797411 to your computer and use it in GitHub Desktop.
Get nave if not present and install app's dependencies (.openshift/action_hooks/pre_build)
#!/bin/bash
# This is a simple script and will be executed on your CI system if
# available. Otherwise it will execute while your application is stopped
# before the build step. This script gets executed directly, so it
# could be python, php, ruby, etc.
NAVE=$OPENSHIFT_DATA_DIR/nave/nave.sh
# If `nave` doesn't exist we get it from GitHub.
if [ ! -f $NAVE ]; then
echo 'Downloading isaacs/nave from GitHub...'
git clone git://github.com/isaacs/nave.git $OPENSHIFT_DATA_DIR/nave
fi
# We go into the repo where the app lives so we can run `npm install` in there.
cd $OPENSHIFT_REPO_DIR
# Use `nave` to make sure we use the right `node` and `npm` versions.
# We set the `$HOME` environment variable to data dir as this is the only place
# where we can write and `npm` will need to do so in home.
HOME=$OPENSHIFT_DATA_DIR $NAVE use 0.10.33 npm install --production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment