Last active
August 29, 2015 14:05
-
-
Save mshustov/7695c3351f95f44c9759 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Example usage: | |
# ./sgg.sh http://islands-components.incrop.lego-dev.dev.yandex-team.ru/ popup | |
GATHER_URL=${1:-https://lego-staging.dev.yandex-team.ru/islands-components/dev/} | |
BLOCK=$2 | |
DIR_MAIN=gemini/screens | |
DIR_DIFF=gemini-report/diff | |
IMG_DIFF=./current-diff.png | |
HYSTERESIS=0.0005 #TODO parse from .gemini.yml | |
mkdir -p ${DIR_DIFF} | |
rm -rf ${DIR_DIFF}/* | |
if [ -n "$BLOCK" ]; then | |
mv ${DIR_MAIN}/${BLOCK} ${DIR_DIFF} | |
./node_modules/.bin/gemini gather --root-url=${GATHER_URL} gemini/${BLOCK}.gemini.js | |
else | |
mv ${DIR_MAIN}/* ${DIR_DIFF} | |
./node_modules/.bin/gemini gather --root-url=${GATHER_URL} | |
fi | |
pushd ${DIR_MAIN} | |
FILES="$(find . -type f | grep ^./${BLOCK})" | |
popd | |
echo "$FILES" | while read f; do | |
CMP_RESULT=$(gm compare -metric MSE -maximum-error ${HYSTERESIS} -file ${IMG_DIFF} "./$DIR_MAIN/$f" "./$DIR_DIFF/$f" 2>&1) | |
if [ 0 == "$?" ]; then | |
echo " same: $f" | |
mv "./$DIR_DIFF/$f" "./$DIR_MAIN/$f" | |
else | |
echo "different: $f" | |
optipng "./$DIR_MAIN/$f" -silent | |
mv -f ${IMG_DIFF} "./$DIR_DIFF/$f" | |
fi | |
done | |
rm -rf ${IMG_DIFF} | |
find ${DIR_DIFF} -type d -empty -delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
В чём назначение этого скрипта?