atom-beautify/build-package.sh

83 lines
2.6 KiB
Bash
Raw Normal View History

#!/bin/sh
echo "Downloading latest Atom release..."
2016-02-23 00:41:11 -07:00
ATOM_CHANNEL="${ATOM_CHANNEL:=stable}"
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
curl -s -L "https://atom.io/download/mac?channel=$ATOM_CHANNEL" \
-H 'Accept: application/octet-stream' \
-o "atom.zip"
mkdir atom
unzip -q atom.zip -d atom
if [ "$ATOM_CHANNEL" = "stable" ]; then
export ATOM_APP_NAME="Atom.app"
export ATOM_SCRIPT_NAME="atom.sh"
export ATOM_SCRIPT_PATH="./atom/${ATOM_APP_NAME}/Contents/Resources/app/atom.sh"
else
export ATOM_APP_NAME="Atom ${ATOM_CHANNEL}.app"
export ATOM_SCRIPT_NAME="atom-${ATOM_CHANNEL}"
export ATOM_SCRIPT_PATH="./atom-${ATOM_CHANNEL}"
ln -s "./atom/${ATOM_APP_NAME}/Contents/Resources/app/atom.sh" "${ATOM_SCRIPT_PATH}"
fi
export PATH="$PWD/atom/${ATOM_APP_NAME}/Contents/Resources/app/apm/bin:$PATH"
export ATOM_PATH="./atom"
export APM_SCRIPT_PATH="./atom/${ATOM_APP_NAME}/Contents/Resources/app/apm/node_modules/.bin/apm"
else
curl -s -L "https://atom.io/download/deb?channel=$ATOM_CHANNEL" \
-H 'Accept: application/octet-stream' \
-o "atom.deb"
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16
export DISPLAY=":99"
dpkg-deb -x atom.deb "$HOME/atom"
if [ "$ATOM_CHANNEL" = "stable" ]; then
export ATOM_SCRIPT_NAME="atom"
export APM_SCRIPT_NAME="apm"
else
export ATOM_SCRIPT_NAME="atom-$ATOM_CHANNEL"
export APM_SCRIPT_NAME="apm-$ATOM_CHANNEL"
fi
export ATOM_SCRIPT_PATH="$HOME/atom/usr/bin/$ATOM_SCRIPT_NAME"
export APM_SCRIPT_PATH="$HOME/atom/usr/bin/$APM_SCRIPT_NAME"
fi
echo "Using Atom version:"
2016-02-23 00:41:11 -07:00
"$ATOM_SCRIPT_PATH" -v
echo "Using APM version:"
"$APM_SCRIPT_PATH" -v
echo "Downloading package dependencies..."
2016-02-23 00:41:11 -07:00
"$APM_SCRIPT_PATH" clean
"$APM_SCRIPT_PATH" install
2015-02-08 19:10:46 -07:00
TEST_PACKAGES="${APM_TEST_PACKAGES:=none}"
if [ "$TEST_PACKAGES" != "none" ]; then
echo "Installing atom package dependencies..."
for pack in $TEST_PACKAGES ; do
2016-02-23 00:41:11 -07:00
"$APM_SCRIPT_PATH" install $pack
2015-02-08 19:10:46 -07:00
done
fi
if [ -f ./node_modules/.bin/coffeelint ]; then
2016-02-23 03:30:49 -07:00
if [ -d ./src ]; then
2015-02-08 19:10:46 -07:00
echo "Linting package..."
2016-02-23 03:30:49 -07:00
./node_modules/.bin/coffeelint src
2016-02-23 00:41:11 -07:00
rc=$?; if [ $rc -ne 0 ]; then exit $rc; fi
2015-02-08 19:10:46 -07:00
fi
if [ -d ./spec ]; then
echo "Linting package specs..."
./node_modules/.bin/coffeelint spec
2016-02-23 00:41:11 -07:00
rc=$?; if [ $rc -ne 0 ]; then exit $rc; fi
2015-02-08 19:10:46 -07:00
fi
fi
2016-02-23 00:41:11 -07:00
if [ -d ./spec ]; then
echo "Running specs..."
"$ATOM_SCRIPT_PATH" --test spec
else
echo "Missing spec folder! Please consider adding a test suite in `./spec`"
exit 1
fi
exit