jam-cloud/build

57 lines
1.4 KiB
Plaintext
Raw Normal View History

2012-11-18 08:08:33 +00:00
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# 'target' is the output directory
rm -rf $DIR/target
mkdir $DIR/target
mkdir $DIR/target/deb
# put all dependencies into vendor/bundle
#rm -rf vendor/bundle
2012-11-18 08:08:33 +00:00
echo "updating dependencies"
bundle install --path vendor/bundle
2012-11-18 08:08:33 +00:00
bundle update
if [ -z $SKIP_TESTS ]; then
echo "running rspec tests"
bundle exec rspec
if [ "$?" = "0" ]; then
echo "tests completed"
else
echo "tests failed."
exit 1
fi
2012-11-18 08:08:33 +00:00
fi
if [ -n "$PACKAGE" ]; then
if [ -z "$BUILD_NUMBER" ]; then
echo "BUILD NUMBER is not defined"
exit 1
fi
type -P dpkg-architecture > /dev/null
if [ "$?" = "0" ]; then
ARCH=`dpkg-architecture -qDEB_HOST_ARCH`
else
echo "WARN: unable to determine architecture."
ARCH=`all`
fi
set -e
# cache all gems local, and tell bundle to use local gems only
bundle install --path vendor/bundle --local
# create debian using fpm
bundle exec fpm -s dir -t deb -p target/deb/websocket-gateway_0.1.${BUILD_NUMBER}_${ARCH}.deb -n "websocket-gateway" -v "0.1.$BUILD_NUMBER" --prefix /var/lib/websocket-gateway --after-install $DIR/script/package/post-install.sh --before-install $DIR/script/package/pre-install.sh --before-remove $DIR/script/package/pre-uninstall.sh --after-remove $DIR/script/package/post-uninstall.sh Gemfile lib bin vendor .bundle config script
fi
2012-11-18 08:08:33 +00:00
echo "build complete"