Skip to content

Commit

Permalink
last
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasser Fadl committed Jun 28, 2016
1 parent ebd1952 commit 31239f6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
48 changes: 26 additions & 22 deletions scripts/package.sh
Expand Up @@ -13,7 +13,6 @@ DEEPSTREAM_PACKAGE=$PACKAGE_DIR/deepstream.io
GIT_BRANCH=$( git rev-parse --abbrev-ref HEAD )

NODE_SOURCE="nexe_node/node/$NODE_VERSION_WITHOUT_V/node-v$NODE_VERSION_WITHOUT_V"
NODE_DEPS="nexe_node/node/$NODE_VERSION_WITHOUT_V/node-v$NODE_VERSION_WITHOUT_V/deps"

EXTENSION=""
if [ $OS = "win32" ]; then
Expand Down Expand Up @@ -61,8 +60,8 @@ echo "Generating meta.json"
node scripts/details.js META

if [ $OS = "win32" ]; then

echo "Downloading node src"
echo "Windows icon"
echo -e "\tDownloading node src"
mkdir -p nexe_node/node/$NODE_VERSION_WITHOUT_V
cd nexe_node/node/$NODE_VERSION_WITHOUT_V
curl -o node-$NODE_VERSION_WITHOUT_V.tar.gz https://nodejs.org/dist/v$NODE_VERSION_WITHOUT_V/node-v$NODE_VERSION_WITHOUT_V.tar.gz
Expand All @@ -71,30 +70,31 @@ if [ $OS = "win32" ]; then

NAME=$PACKAGE_VERSION

echo "Patch the window executable icon and details"
echo -e "\tPatch the window executable icon and details"
cp scripts/resources/node.rc $NODE_SOURCE/src/res/node.rc
cp scripts/resources/deepstream.ico $NODE_SOURCE/src/res/deepstream.ico

if ! [[ $PACKAGE_VERSION =~ ^[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
echo "Version can't contain characters in MSBuild, so replacing $PACKAGE_VERSION with 0.0.0"
echo -e "\tVersion can't contain characters in MSBuild, so replacing $PACKAGE_VERSION with 0.0.0"
NAME="0.0.0"
fi
sed -i 's/DEEPSTREAM_VERSION/$NAME/' $NODE_SOURCE/src/res/node.rc
sed -i "s/DEEPSTREAM_VERSION/$NAME/" $NODE_SOURCE/src/res/node.rc
fi

# Nexe Patches
echo "Patching winston files for nexe/browserify"
echo "Nexe Patches for Browserify"
echo -e "\tPatching winston files for nexe/browserify"
cp scripts/patch-files/winston-transports.js node_modules/deepstream.io-logger-winston/node_modules/winston/lib/winston/transports.js
echo "module.exports = function() {}" > node_modules/deepstream.io-logger-winston/node_modules/winston/node_modules/pkginfo/lib/pkginfo.js

echo "Adding empty xml2js module for needle"
echo -e "\tAdding empty xml2js module for needle"
mkdir -p node_modules/xml2js && echo "module.exports = function() {}" >> node_modules/xml2js/index.js

echo "Adding empty bufferutil module, since optional install can break and isn't bundled anyway"
echo -e "\tAdding empty bufferutil module, since optional install can break and isn't bundled anyway"
rm -rf node_modules/bufferutil
mkdir -p node_modules/bufferutil && echo "module.exports = function() {}" >> node_modules/bufferutil/index.js

echo "Adding empty utf-8-validate module, since optional install can break and isn't bundled anyway"
echo -e "\tAdding empty utf-8-validate module, since optional install can break and isn't bundled anyway"
rm -rf node_modules/utf-8-validate
mkdir -p node_modules/utf-8-validate && echo "module.exports = function() {}" >> node_modules/utf-8-validate/index.js

Expand All @@ -106,9 +106,9 @@ mkdir $DEEPSTREAM_PACKAGE/lib

if [ -d node_modules/uws ]; then
echo "Adding uws as thirdparty library for performance improvements"
mv -f node_modules/uws $DEEPSTREAM_PACKAGE/lib/uws
mv -f node_modules/uws $DEEPSTREAM_PACKAGE/lib/uws
else
echo "Adding empty uws module"
echo -e "\tAdding empty uws module"
mkdir -p node_modules/uws && echo "module.exports = function() {}" >> node_modules/uws/index.js
fi

Expand All @@ -131,10 +131,12 @@ while kill -0 "$PROC_ID" >/dev/null 2>&1; do
SECONDS=$[SECONDS+1]
done

echo ""

if wait $pid; then
echo "Nexe Build Succeeded"
echo -e "\tNexe Build Succeeded"
else
echo "Nexe Build Failed"
echo -e "\tNexe Build Failed"
exit 1
fi

Expand All @@ -150,7 +152,8 @@ if [ $OS = "win32" ]; then
COMMIT_NAME="deepstream.io-windows-$PACKAGE_VERSION-$COMMIT.zip "
CLEAN_NAME="deepstream.io-windows-$PACKAGE_VERSION.zip"

echo "OS is windows, creating zip deepstream.io-windows-$PACKAGE_VERSION.zip"
echo "OS is windows"
echo -e "\tCreating zip deepstream.io-windows-$PACKAGE_VERSION.zip"
cd $DEEPSTREAM_PACKAGE
7z a ../$COMMIT_NAME . > /dev/null
cp ../$COMMIT_NAME ../../$CLEAN_NAME
Expand All @@ -161,14 +164,15 @@ if [ $OS = "darwin" ]; then
COMMIT_NAME="deepstream.io-mac-$PACKAGE_VERSION-$COMMIT.zip"
CLEAN_NAME="deepstream.io-mac-$PACKAGE_VERSION.zip"

echo "OS is mac, creating $CLEAN_NAME"
echo "OS is mac"
echo -e "\tCreating $CLEAN_NAME"

cd $DEEPSTREAM_PACKAGE
zip -r ../$COMMIT_NAME .
cp ../$COMMIT_NAME ../../$CLEAN_NAME
cd -

echo "Skipping .pkg creation"
echo -e "\tSkipping .pkg creation"
# gem install fpm
# fpm \
# -s dir \
Expand All @@ -187,7 +191,7 @@ if [ $OS = "linux" ]; then
echo "OS is linux"


echo "Creating tar.gz"
echo -e "\tCreating tar.gz"

COMMIT_NAME="deepstream.io-linux-$PACKAGE_VERSION-$COMMIT.tar.gz"
CLEAN_NAME="deepstream.io-linux-$PACKAGE_VERSION.tar.gz"
Expand All @@ -197,14 +201,14 @@ if [ $OS = "linux" ]; then
cp ../$COMMIT_NAME ../../$CLEAN_NAME
cd -

echo "Patching config file for linux distros"
echo -e "\tPatching config file for linux distros..."
sed -i 's@ ../lib@ /var/lib/deepstream@' $DEEPSTREAM_PACKAGE/conf/config.yml
sed -i 's@ ../var@ /var/log/deepstream@' $DEEPSTREAM_PACKAGE/conf/config.yml

echo "Installing FPM"
echo -e "\tInstalling FPM"
gem install fpm > /dev/null

echo "Creating rpm"
echo -e "\t\tCreating rpm"
fpm \
-s dir \
-t rpm \
Expand All @@ -227,7 +231,7 @@ if [ $OS = "linux" ]; then
./build/deepstream=/usr/bin/deepstream \
./scripts/daemon/init-script=/etc/init.d/deepstream

echo "Creating deb"
echo -e "\t\tCreating deb"
fpm \
-s dir \
-t deb \
Expand Down
2 changes: 1 addition & 1 deletion test/bin/cliSpec.js
Expand Up @@ -19,7 +19,7 @@ function stopServer() {
return child_process.spawnSync( 'node', ['bin/deepstream', 'stop'], execOptions );
}

xdescribe('Command Line Interface', function() {
describe('Command Line Interface', function() {
it( 'start, status and stop', function() {
child_process.exec( 'node bin/deepstream start', execOptions );
let output = '';
Expand Down

0 comments on commit 31239f6

Please sign in to comment.