Improve installation feedback as we did in Windshaft

This commit is contained in:
Raul Ochoa 2015-02-23 12:08:08 +01:00
parent 65702de64d
commit 62e435fd9e
4 changed files with 38 additions and 17 deletions

View File

@ -1,7 +1,5 @@
srcdir=$(shell pwd)
all:
npm install
@sh ./scripts/install.sh
clean:
rm -rf node_modules/*
@ -15,7 +13,8 @@ config.status--test:
config/environments/test.js: config.status--test
./config.status--test
check-local: config/environments/test.js
test: config/environments/test.js
@echo "***tests***"
./run_tests.sh ${RUNTESTFLAGS} \
test/unit/cartodb/*.js \
test/unit/cartodb/cache/model/*.js \
@ -23,16 +22,6 @@ check-local: config/environments/test.js
test/acceptance/*.js \
test/acceptance/cache/*.js
check-submodules:
PATH="$$PATH:$(srcdir)/node_modules/.bin/"; \
for sub in windshaft grainstore node-varnish mapnik; do \
if test -e node_modules/$${sub}; then \
echo "Testing submodule $${sub}"; \
make -C node_modules/$${sub} check || exit 1; \
fi; \
done
check-full: check-local check-submodules
check: check-local
check: test
.PHONY: test

View File

@ -43,7 +43,8 @@
"semver": "~1.1.4"
},
"scripts": {
"test": "make check"
"preinstall": "sh ./scripts/check-node-canvas.sh",
"test": "make test"
},
"engines": {
"node": ">=0.8 <0.11",

View File

@ -0,0 +1,24 @@
#!/bin/sh
if [[ "$OSTYPE" == "darwin"* ]]; then
CAIRO_PKG_CONFIG=`pkg-config cairo --cflags-only-I 2> /dev/null`
RESULT=$?
if [[ ${RESULT} -ne 0 ]]; then
echo "###################################################################################"
echo "# PREINSTALL HOOK ERROR #"
echo "#---------------------------------------------------------------------------------#"
echo "# #"
echo "# node-canvas install error: some packages required by 'cairo' are not found #"
echo "# #"
echo "# Use '\033[1mmake all\033[0m', it will take care of common/known issues #"
echo "# #"
echo "# As an alternative try: #"
echo "# Try to 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig' #"
echo "# #"
echo "# If problems persist visit: https://github.com/Automattic/node-canvas/wiki #"
echo "# #"
echo "###################################################################################"
exit 1
fi
fi

7
scripts/install.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
if [[ "$OSTYPE" == "darwin"* ]]; then
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig
fi
npm install