jam-cloud/websocket-gateway/build

77 lines
2.2 KiB
Plaintext
Raw Permalink 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
# default build number to 1 if not found
if [ -z "$BUILD_NUMBER" ]; then
BUILD_NUMBER="1"
fi
GEM_VERSION="0.1.${BUILD_NUMBER}"
# by putting these gems in vendor/cache, bundle will see them when running 'bundle install'
mkdir -p vendor/cache
#cp ../db/target/ruby_package/jam_db-${GEM_VERSION}.gem vendor/cache/ || { echo "unable to copy jam-db gem"; exit 1; }
2013-09-16 02:36:21 +00:00
cp ../pb/target/ruby/jampb/jampb-${GEM_VERSION}.gem vendor/cache/ || { echo "unable to copy jam-pb gem"; exit 1; }
cp ../ruby/jam_ruby-${GEM_VERSION}.gem vendor/cache/ || { echo "unable to copy jam-ruby gem"; exit 1; }
2021-04-02 18:26:01 +00:00
ls -la ../pb/target/ruby/jampb
ls -la vendor/cache
2021-04-02 22:05:48 +00:00
gem env
bundle list
2021-04-02 18:26:01 +00:00
# put all dependencies into vendor/bundle
#rm -rf vendor/bundle -- let checkins config 'wipe workspace' decide this
2012-11-18 08:08:33 +00:00
echo "updating dependencies"
bundle install --path vendor/bundle
2014-02-02 20:03:31 +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
echo "$BUILD_NUMBER" > BUILD_NUMBER
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
2014-02-02 20:03:31 +00:00
#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 BUILD_NUMBER
fi
2012-11-18 08:08:33 +00:00
echo "build complete"