Skip to content

Commit

Permalink
generalize, accept repo as first argument
Browse files Browse the repository at this point in the history
  • Loading branch information
jlongster committed Feb 17, 2011
1 parent c58e712 commit 2d352af
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions servable-branches
Expand Up @@ -14,7 +14,10 @@ function die {
}

# Paths
root="/sites/dev.mozilla.james.local"

[ -n "$1" ] || die "Usage: $0 <repo>" 5

root="$1"
master_dir="$root/master"
branch_dir="$root/branches"

Expand Down Expand Up @@ -46,12 +49,15 @@ for ref in refs/heads/*; do
if ! [ -d "$dest" ]; then
# New branch, clone it and start the service
git clone -b "$branch" "$master_dir" "$dest"
runsv "$dest" &
if [ -f "$dest/run" ]; then
runsv "$dest" &
fi
else
# Existing branch, update and restart the service if necessary
(cd "$dest";
last_commit=`most_recent_commit`
git pull > /dev/null
git submodule update --init --recursive
if ! [ "$last_commit" == `most_recent_commit` ]; then
echo "RESTARTING $dest"
sv restart .
Expand Down

0 comments on commit 2d352af

Please sign in to comment.