Skip to content

Instantly share code, notes, and snippets.

@kimroen
Forked from daneden/install-sketch-templates.sh
Last active August 28, 2015 19:27
Show Gist options
  • Save kimroen/7a15690e9e75eaa3d427 to your computer and use it in GitHub Desktop.
Save kimroen/7a15690e9e75eaa3d427 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Let's get some color going!
red=$'\e[1;31m'
grn=$'\e[1;32m'
end=$'\e[0m'
# cd to cwd of the script (presumably in it's proper location)
cd "$(dirname "$0")"
printf "\nInstalling Sketch templates..."
# Install for App Store/Stable Sketch
if [ -d "$HOME/Library/Application Support/com.bohemiancoding.sketch3/" ]; then
path="$HOME/Library/Application Support/com.bohemiancoding.sketch3/"
ditto "Web - Blankslates.sketch" "${path}Templates/Dropbox Web.sketch"
ditto "Mobile - iOS - Blankslates.sketch" "${path}Templates/Dropbox iOS.sketch"
mv "${path}assets-v55.sketchpreset" "${path}assets-v55.sketchpreset.backup"
ditto "Web - Colors.sketchpreset" "${path}assets-v55.sketchpreset"
fi
if [ -d "$HOME/Library/Containers/com.bohemiancoding.sketch3/" ]; then
path="$HOME/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/"
ditto "Web - Blankslates.sketch" "${path}Templates/Dropbox Web.sketch"
ditto "Mobile - iOS - Blankslates.sketch" "${path}Templates/Dropbox iOS.sketch"
mv "${path}assets-v55.sketchpreset" "${path}assets-v55.sketchpreset.backup"
ditto "Web - Colors.sketchpreset" "${path}assets-v55.sketchpreset"
fi
# Install for Sketch Beta
if [ -d "$HOME/Library/Containers/com.bohemiancoding.sketch3.beta/" ]; then
path="$HOME/Library/Containers/com.bohemiancoding.sketch3.beta/Data/Library/Application Support/com.bohemiancoding.sketch3/"
ditto "Web - Blankslates.sketch" "${path}Templates/Dropbox Web.sketch"
ditto "Mobile - iOS - Blankslates.sketch" "${path}Templates/Dropbox iOS.sketch"
mv "${path}assets-v55.sketchpreset" "${path}assets-v55.sketchpreset.backup"
ditto "Web - Colors.sketchpreset" "${path}assets-v55.sketchpreset"
printf "\nInstalling templates for Sketch Beta..."
fi
# Catch errors or confirm success
if [ ! -d "$HOME/Library/Containers/com.bohemiancoding.sketch3/" ] && [ ! -d "$HOME/Library/Containers/com.bohemiancoding.sketch3.beta/" ]; then
printf "\n\n${red}Welp. Couldn't install the templates.${end}"
printf "\nMake sure Sketch is installed or contact [email protected].\n"
else
printf "\n\n${grn}Done! \nIf something seems awry, contact [email protected]. It's his fault.${end}\n"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment