Skip to content

Instantly share code, notes, and snippets.

@otakup0pe
Created September 17, 2013 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otakup0pe/6588729 to your computer and use it in GitHub Desktop.
Save otakup0pe/6588729 to your computer and use it in GitHub Desktop.
cookbook upload widget for osx does a background upload and then notifies
#!/usr/bin/env bash
if [ "$(which terminal-notifier | wc -l)" == "0" ] ; then
echo "requires terminal-notifier gem"
exit 1
fi
COOKBOOK=$1
VERSION=$2
function msg {
MSG="$1"
SOUND="$2"
if [ "${VERSION}" == "" ] ; then
C_NAME="${COOKBOOK}"
else
C_NAME="${COOKBOOK}@${VERSION}"
fi
terminal-notifier -message "${MSG}" -title "Cookbook Upload Status" -subtitle "${COOKBOOK}" -sound $SOUND
}
function upload {
if [ "$VERSION" == "" ] ; then
knife cookbook delete -y $COOKBOOK
else
knife cookbook delete -y $COOKBOOK $VERSION
fi && \
berks upload
if [ "$?" == "0" ] ; then
msg "success" "Purr"
else
msg "failed" "Sosumi"
fi
}
OWD=$(pwd)
cd "${HOME}/src/${COOKBOOK}-cookbook"
upload &> /dev/null &
cd $OWD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment