2012-11-18 08:08:33 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2013-01-03 07:01:48 +00:00
|
|
|
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"
|
2013-01-03 07:01:48 +00:00
|
|
|
|
|
|
|
|
bundle install --path vendor/bundle
|
2012-11-18 08:08:33 +00:00
|
|
|
bundle update
|
2013-01-03 07:01:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2013-01-03 07:01:48 +00:00
|
|
|
if [ -n "$PACKAGE" ]; then
|
|
|
|
|
if [ -z "$BUILD_NUMBER" ]; then
|
|
|
|
|
echo "BUILD NUMBER is not defined"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2013-01-05 08:34:58 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2013-01-03 07:01:48 +00:00
|
|
|
set -e
|
|
|
|
|
# cache all gems local, and tell bundle to use local gems only
|
|
|
|
|
bundle install --path vendor/bundle --local
|
|
|
|
|
|
|
|
|
|
# create debian using fpm
|
2013-01-05 08:34:58 +00:00
|
|
|
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 --exclude $DIR/.git .
|
2013-01-03 07:01:48 +00:00
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
2012-11-18 08:08:33 +00:00
|
|
|
echo "build complete"
|
|
|
|
|
|