From 81fa7a63f9d6676f2574b62de59c3e2a92f33acb Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Sat, 15 Aug 2015 18:01:55 -0700 Subject: [PATCH] Some scripts --- .gitignore | 8 +++----- tools/pre_commit_bom_check | 11 +++++++++++ tools/remove_bom.sh | 1 + tools/update.bat | 2 ++ 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 tools/pre_commit_bom_check create mode 100644 tools/remove_bom.sh create mode 100644 tools/update.bat diff --git a/.gitignore b/.gitignore index 4e902e5..1852549 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ *.pyc -*sln -breakpoints* -update.bat -doit.sh - +*.sln +breakpoints.xml +icons/Thumbs.db diff --git a/tools/pre_commit_bom_check b/tools/pre_commit_bom_check new file mode 100644 index 0000000..49e5080 --- /dev/null +++ b/tools/pre_commit_bom_check @@ -0,0 +1,11 @@ +#! /bin/sh +# move to .git/hooks/pre-commit + +git diff --cached --no-renames --diff-filter=AM --name-only -- '*.py' | +(status=0; while read path; do + if git show ":$path" | head -1 | grep $'^\xEF\xBB\xBF' >/dev/null; then + echo "Error: file '$path' starts with Unicode BOM. Run 'remove_bom.sh $path" then try commit again." + status=1 + fi +done +exit $status) \ No newline at end of file diff --git a/tools/remove_bom.sh b/tools/remove_bom.sh new file mode 100644 index 0000000..e5c7ff7 --- /dev/null +++ b/tools/remove_bom.sh @@ -0,0 +1 @@ +sed -b -i -e "1s/^\xEF\xBB\xBF//" $1 \ No newline at end of file diff --git a/tools/update.bat b/tools/update.bat new file mode 100644 index 0000000..612fe27 --- /dev/null +++ b/tools/update.bat @@ -0,0 +1,2 @@ +robocopy "%userprofile%/repos/web inspector" "%appdata%/sublime text 3/packages/web inspector" /s /xd .git* /xf .git* /xf *st3* /mir +attrib +r "%appdata%/sublime text 3/packages/web inspector/*py" \ No newline at end of file