Skip to content

Commit

Permalink
adds basic scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sdsykes committed Apr 3, 2013
1 parent ef55508 commit f17d8bd
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 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
36 changes: 36 additions & 0 deletions 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
15 changes: 15 additions & 0 deletions 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
29 changes: 29 additions & 0 deletions 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
14 changes: 14 additions & 0 deletions 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"

0 comments on commit f17d8bd

Please sign in to comment.