From f17d8bd25d5012cd75f750c26379904c2cb63215 Mon Sep 17 00:00:00 2001 From: Stephen Sykes Date: Wed, 3 Apr 2013 16:25:26 +0300 Subject: [PATCH] adds basic scripts --- bin/commit.sh | 21 +++++++++++++++++++++ bin/dev.sh | 36 ++++++++++++++++++++++++++++++++++++ bin/restart.sh | 15 +++++++++++++++ bin/sync.sh | 29 +++++++++++++++++++++++++++++ bin/undev.sh | 14 ++++++++++++++ 5 files changed, 115 insertions(+) create mode 100755 bin/commit.sh create mode 100755 bin/dev.sh create mode 100755 bin/restart.sh create mode 100755 bin/sync.sh create mode 100755 bin/undev.sh diff --git a/bin/commit.sh b/bin/commit.sh new file mode 100755 index 0000000..39799bc --- /dev/null +++ b/bin/commit.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +pushd . > /dev/null +cd "$(dirname "$0")" +cd .. + +echo "Committing last changes..." +echo "Note you maybe have to manually add new files you changed ('git add mynewfile.ext')" + +#ask for a message +read -p "Write a commit message to identify this commit and its changes and press ENTER: " +git commit -a -m "$REPLY" + +read -p "Succesfully commited! Do you want to push? [y/n] " -n 1 +echo "" +if [[ $REPLY =~ ^[Yy]$ ]]; then + git push + echo "Pushed!" +fi + +popd > /dev/null diff --git a/bin/dev.sh b/bin/dev.sh new file mode 100755 index 0000000..1bf611c --- /dev/null +++ b/bin/dev.sh @@ -0,0 +1,36 @@ +#!/bin/bash +TOTALSPACES_RESOURCES='/Applications/TotalSpaces.app/Contents/Resources' +TOTALSPACES_RESOURCES_BACKUP='/Applications/TotalSpaces.app/Contents/ResourcesOrig' + +# need absolute path of the repo's root +pushd . > /dev/null +cd "$(dirname "$0")" +cd .. +ROOT=$PWD + +if [ ! -d "$TOTALSPACES_RESOURCES" ]; then # is it a folder? + echo "Please install TotalSpaces. Folder '$TOTALSPACES_RESOURCES' not found". + popd > /dev/null + exit +fi + +if [ -L "$TOTALSPACES_RESOURCES" ]; then # is is a symlink? + echo "TotalSpaces is already in dev mode. Folder '$TOTALSPACES_RESOURCES' is a symlink! Exiting.". + popd > /dev/null + exit +fi + +# ok, we should be safe to do the replacement +sudo mv "$TOTALSPACES_RESOURCES" "$TOTALSPACES_RESOURCES_BACKUP" +sudo ln -s "$ROOT/app" "$TOTALSPACES_RESOURCES" +sudo cp "$TOTALSPACES_RESOURCES_BACKUP/"*.nib "$TOTALSPACES_RESOURCES" +sudo cp "$TOTALSPACES_RESOURCES_BACKUP/"*.png "$TOTALSPACES_RESOURCES" +sudo cp "$TOTALSPACES_RESOURCES_BACKUP/"*.plist "$TOTALSPACES_RESOURCES" +sudo cp "$TOTALSPACES_RESOURCES_BACKUP/"*.html "$TOTALSPACES_RESOURCES" +sudo cp "$TOTALSPACES_RESOURCES_BACKUP/"*.icns "$TOTALSPACES_RESOURCES" +sudo cp "$TOTALSPACES_RESOURCES_BACKUP/"*.pem "$TOTALSPACES_RESOURCES" +sudo cp "$TOTALSPACES_RESOURCES_BACKUP/"*.applescript "$TOTALSPACES_RESOURCES" +sudo cp "$TOTALSPACES_RESOURCES_BACKUP/"*.scpt "$TOTALSPACES_RESOURCES" +sudo cp -r "$TOTALSPACES_RESOURCES_BACKUP/"*.app "$TOTALSPACES_RESOURCES" + +popd > /dev/null diff --git a/bin/restart.sh b/bin/restart.sh new file mode 100755 index 0000000..85dc500 --- /dev/null +++ b/bin/restart.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +pushd . > /dev/null +cd "$(dirname "$0")" +cd .. + +# quit TotalSpaces +osascript -e "tell application \"TotalSpaces\" to quit" + +killall -SIGINT TotalSpacesCrashWatcher + +# start TotalSpaces agan +open /Applications/TotalSpaces.app + +popd > /dev/null diff --git a/bin/sync.sh b/bin/sync.sh new file mode 100755 index 0000000..251e53d --- /dev/null +++ b/bin/sync.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +pushd . > /dev/null +cd "$(dirname "$0")" +cd .. + +echo "This may end in conflict, see git docs." + +#point to server +read -p "Is this the first time you sync? [y/n] " -n 1 +echo "" +if [[ $REPLY =~ ^[Yy]$ ]]; then + git remote add ba git://github.com/binaryage/totalspaces-i18n.git + echo "Pointed!" +fi + +#merge repos +git fetch ba && git merge ba/master +echo "Merged!" + +#push to GitHub +read -p "Do you want to push to GitHub? This will update the online repo with any commit you made since last push. Until you do this, changes won't be in your GitHub fork. [y/n] " -n 1 +echo "" +if [[ $REPLY =~ ^[Yy]$ ]]; then + git push + echo "Pushed!" +fi + +popd > /dev/null diff --git a/bin/undev.sh b/bin/undev.sh new file mode 100755 index 0000000..17d6d4f --- /dev/null +++ b/bin/undev.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +TOTALSPACES_RESOURCES='/Applications/TotalSpaces.app/Contents/Resources' +TOTALSPACES_RESOURCES_BACKUP='/Applications/TotalSpaces.app/Contents/ResourcesOrig' + +if [ -d "$TOTALSPACES_RESOURCES" ]; then # is it a folder? + if [ -L "$TOTALSPACES_RESOURCES" ]; then # is it a symlink? + sudo rm "$TOTALSPACES_RESOURCES" + sudo mv "$TOTALSPACES_RESOURCES_BACKUP" "$TOTALSPACES_RESOURCES" + exit + fi +fi + +echo "Failed: TotalSpaces is not installed or not in dev mode"