diff --git a/.travis.yml b/.travis.yml index 4f3a3bc7e..3fda78932 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,21 @@ language: node_js node_js: - - "4.2" + - "4" sudo: false before_install: - - export WAPPALYZER_ROOT=$TRAVIS_BUILD_DIR - - export WAPPALYZER_NODE_PATH=$TRAVIS_BUILD_DIR - - export PATH=$PATH:$TRAVIS_BUILD_DIR/bin -install: - - npm install jsonlint jpm imagemin-cli svgo -g - - ln -s docker/node/package.json package.json && npm install - - mkdir phantomjs && curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 | tar xvjC phantomjs && ln -s $WAPPALYZER_ROOT/phantomjs/phantomjs-*-linux-x86_64/bin/phantomjs bin/phantomjs -script: wappalyzer build + - export WAPPALYZER_ROOT=$TRAVIS_BUILD_DIR + - export WAPPALYZER_NODE_PATH=$TRAVIS_BUILD_DIR + - export PATH=$PATH:$TRAVIS_BUILD_DIR/bin + - ln -s docker/node/package.json package.json after_script: ls -l --block-size=kB build +cache: + directories: + - node_modules +env: + - CXX=g++-4.8 +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 diff --git a/bin/wappalyzer-build b/bin/wappalyzer-build index 8eb689945..0d48405a1 100755 --- a/bin/wappalyzer-build +++ b/bin/wappalyzer-build @@ -7,21 +7,28 @@ then exit 1 fi +if [ -z $WAPPALYZER_NODE_PATH ] +then + echo "\$WAPPALYZER_NODE_PATH not set" + + exit 1 +fi + set -eu wappalyzer validate echo "Prettifying apps.json..." -jsonlint -ist $'\t' $WAPPALYZER_ROOT/src/apps.json +node $WAPPALYZER_NODE_PATH/node_modules/jsonlint/lib/cli.js -ist $'\t' $WAPPALYZER_ROOT/src/apps.json echo "Compressing PNG icons..." -imagemin $WAPPALYZER_ROOT/src/icons $WAPPALYZER_ROOT/src/icons -o 7 +node $WAPPALYZER_NODE_PATH/node_modules/imagemin-cli/cli.js $WAPPALYZER_ROOT/src/icons $WAPPALYZER_ROOT/src/icons -o 7 echo "Compressing SVG icons..." -svgo -q -f $WAPPALYZER_ROOT/src/icons $WAPPALYZER_ROOT/src/icons +node $WAPPALYZER_NODE_PATH/node_modules/svgo/bin/svgo -q -f $WAPPALYZER_ROOT/src/icons $WAPPALYZER_ROOT/src/icons wappalyzer links @@ -34,7 +41,7 @@ echo "Building Firefox driver..." pushd $WAPPALYZER_ROOT/src/drivers/firefox > /dev/null -jpm xpi && mv *.xpi $WAPPALYZER_ROOT/build/wappalyzer_firefox.xpi +node $WAPPALYZER_NODE_PATH/node_modules/jpm/bin/jpm xpi && mv *.xpi $WAPPALYZER_ROOT/build/wappalyzer_firefox.xpi popd > /dev/null diff --git a/bin/wappalyzer-validate b/bin/wappalyzer-validate index a6e8c691e..d9d09a617 100755 --- a/bin/wappalyzer-validate +++ b/bin/wappalyzer-validate @@ -27,7 +27,7 @@ path="$path/src" echo "Validating apps.json..." -jsonlint --quiet -V $WAPPALYZER_ROOT/schema.json $path/apps.json +node $WAPPALYZER_NODE_PATH/node_modules/jsonlint/lib/cli.js --quiet -V $WAPPALYZER_ROOT/schema.json $path/apps.json echo "Validating regular expressions..." diff --git a/bin/wappalyzer-validate-icons b/bin/wappalyzer-validate-icons index 38a8cb2bf..3ec796ac6 100755 --- a/bin/wappalyzer-validate-icons +++ b/bin/wappalyzer-validate-icons @@ -31,7 +31,11 @@ for (app in json.apps) { if (exists) { if (type === "PNG") { var buffer = fileType(readChunk.sync(path, 0, 262)); - if (buffer.mime !== 'image/png') { + if (buffer === null) { + var err = new Error('Unknown mimetype or bad file for "' + app + '": src/icons/' + iconPath); + throw err; + } + else if (buffer.mime !== 'image/png') { var err = new Error('Incorrect mimetype "' + buffer.mime + '" when expected PNG for app "' + app + '": src/icons/' + iconPath); throw err; } diff --git a/docker/Dockerfile b/docker/Dockerfile index 857cf65a6..625b6bf14 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -32,7 +32,7 @@ RUN su wappalyzer -c "mkdir $WAPPALYZER_NODE_PATH" ADD node/package.json $WAPPALYZER_NODE_PATH/package.json -RUN npm install jsonlint jpm imagemin-cli svgo -g && su wappalyzer -c "cd $WAPPALYZER_NODE_PATH && npm install" +RUN su wappalyzer -c "cd $WAPPALYZER_NODE_PATH && npm i" # PhantomJS diff --git a/docker/node/package.json b/docker/node/package.json index 9855b7b74..b75954434 100644 --- a/docker/node/package.json +++ b/docker/node/package.json @@ -1,7 +1,26 @@ { + "name": "wappalyzer-test", + "private": true, + "license": "GPLv3", + "bugs": { + "url": "https://github.com/AliasIO/Wappalyzer/issues" + }, + "homepage": "https://github.com/AliasIO/Wappalyzer", + "description": "Build test for Wappalyzer", + "repository": "AliasIO/Wappalyzer", + "scripts": { + "test": "./bin/wappalyzer build" + }, "devDependencies": { - "file-type": "3.3.*", + "file-type": "3.4.*", "is-svg": "1.1.*", - "read-chunk": "1.0.*" + "read-chunk": "1.0.*", + "jsonlint": "*", + "jpm": "*", + "imagemin-cli": "*", + "svgo": "*" + }, + "engines": { + "node": ">= 4" } } diff --git a/src/icons/anchorCache.png b/src/icons/anchorCache.png index 8b1378917..9e160bce5 100644 Binary files a/src/icons/anchorCache.png and b/src/icons/anchorCache.png differ