Fomafix has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374785 )

Change subject: Make shell script robust against spaces in file names
......................................................................

Make shell script robust against spaces in file names

Also
* Simplify wc.
* Add period at end of sentences.
* Use tabs instead of spaces for indenting.
* Add newline at end of file.

Change-Id: I50a9d31acecc32bcf693cba5022152aa9abcbaab
---
M dev-scripts/svg_check.sh
1 file changed, 12 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/MinervaNeue 
refs/changes/85/374785/1

diff --git a/dev-scripts/svg_check.sh b/dev-scripts/svg_check.sh
index 3c7ef64..963b7e5 100755
--- a/dev-scripts/svg_check.sh
+++ b/dev-scripts/svg_check.sh
@@ -1,17 +1,18 @@
 #!/usr/bin/env bash
 found=0
 
-for svgfile in `find resources -type f -name "*.svg"`; do
-  outfile="$svgfile.tmp"
-  node_modules/.bin/svgo --config .svgo.yml -i $svgfile -o $outfile -q
-  if [ $(wc -c $svgfile | awk '{print $1}') -gt $(wc -c $outfile | awk '{print 
$1}') ]; then
-    echo "File $svgfile is not compressed"
-    found=$((found + 1))
-  fi
-  rm $outfile
+find resources -type f -name '*.svg' |
+while read svgfile; do
+       outfile="$svgfile.tmp"
+       node_modules/.bin/svgo --config .svgo.yml -i "$svgfile" -o "$outfile" -q
+       if [ $(wc -c < "$svgfile") -gt $(wc -c < "$outfile") ]; then
+               echo "File $svgfile is not compressed."
+               found=$((found + 1))
+       fi
+       rm "$outfile"
 done
 
 if [ $found -gt 0 ]; then
-  echo "Found $found uncompressed SVG files. Please compress the files and 
re-submit the patch"
-  exit 1
-fi
\ No newline at end of file
+       echo "Found $found uncompressed SVG files. Please compress the files 
and re-submit the patch."
+       exit 1
+fi

-- 
To view, visit https://gerrit.wikimedia.org/r/374785
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I50a9d31acecc32bcf693cba5022152aa9abcbaab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/MinervaNeue
Gerrit-Branch: master
Gerrit-Owner: Fomafix <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to