Created
December 13, 2011 17:52
-
-
Save jaysoffian/1473107 to your computer and use it in GitHub Desktop.
tmproj
This file contains 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 | |
name=$(git rev-parse --abbrev-ref=strict HEAD | sed 's|/|-|g') | |
test "$name" = "HEAD" && name=$(git rev-parse --short $name) | |
OUT=${name}.tmproj | |
OUT2="${name}(2).tmproj" | |
exec > "$OUT" | |
cat <<'__EOF__' | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>documents</key> | |
<array> | |
__EOF__ | |
patterns="/var/tmp/tmproj.$$" | |
trap "rm -f '$patterns'" EXIT | |
cat > "$patterns" <<'__EOF__' | |
\.bin$ | |
\.croc$ | |
\.crx$ | |
\.cur$ | |
\.db$ | |
\.dll$ | |
\.dylib$ | |
\.exe$ | |
\.gif$ | |
\.graffle$ | |
\.gz$ | |
\.icns$ | |
\.ico$ | |
\.jpg$ | |
\.m4a$ | |
\.pak$ | |
\.pdb$ | |
\.pdf$ | |
\.pem$ | |
\.pfx$ | |
\.png$ | |
\.tiff$ | |
\.ttf$ | |
\.vcproj$ | |
\.xib$ | |
\.xtb$ | |
^chrome/test/data/ | |
^chrome_frame/ | |
^courgette/testdata/ | |
^gfx/test/data/ | |
^o3d/import/test_data/ | |
^o3d/tests/ | |
^third_party/sqlite/test/ | |
^third_party/tcmalloc/ | |
^third_party/tlslite/ | |
^webkit/data/test_shell/ | |
^webkit/glue/plugins/test/ | |
__EOF__ | |
i=0 | |
git ls-files | grep -i -v -f "$patterns" | while read path | |
do | |
test $(( i % 100 )) -eq 0 && printf "Generating $OUT... $i\r" >&2 | |
((i++)) | |
echo " <dict>" | |
echo " <key>filename</key>" | |
echo " <string>$path</string>" | |
echo " </dict>" | |
done | |
printf " \r" >&2 | |
cat <<'__EOF__' | |
</array> | |
<key>windowFrame</key> | |
<string>{{0, 55}, {854, 1523}}</string> | |
</dict> | |
</plist> | |
__EOF__ | |
echo "Done writing $OUT" >&2 | |
if [ "$1" = "2" ]; then | |
perl -pe 's|{{0, 55}, {854, 1523}}|{{853, 55}, {854, 1523}}|' <"$OUT" >"$OUT2" | |
open "$OUT" "$OUT2" | |
else | |
open "$OUT" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment