Skip to content

Instantly share code, notes, and snippets.

@rainerborene
Created June 22, 2011 18:48
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 rainerborene/8aefdcc157eb362da1db to your computer and use it in GitHub Desktop.
Save rainerborene/8aefdcc157eb362da1db to your computer and use it in GitHub Desktop.
--- /tmp/deploy1 2011-06-22 15:46:34.610463511 -0300
+++ /usr/local/bin/deploy 2011-06-22 15:44:27.240463497 -0300
@@ -135,8 +135,7 @@
local cmd=`config_get $hook`
if test -n "$cmd"; then
log "executing $hook \`$cmd\`"
- run "cd $path/current; \
- SHARED=\"$path/shared\" \
+ run "cd $path; \
$cmd 2>&1 | tee -a $LOG; \
exit \${PIPESTATUS[0]}"
test $? -eq 0
@@ -152,11 +151,10 @@
setup() {
local path=`config_get path`
local repo=`config_get repo`
- run "mkdir -p $path/{shared/{logs,pids},source}"
test $? -eq 0 || abort setup paths failed
log running setup
log cloning $repo
- run "git clone $repo $path/source"
+ run "git clone $repo $path"
test $? -eq 0 || abort failed to clone
log setup complete
}
@@ -174,13 +172,13 @@
# fetch source
log fetching updates
- run "cd $path/source && git fetch --all"
+ run "cd $path && git fetch --all"
test $? -eq 0 || abort fetch failed
# latest tag
if test -z "$ref"; then
log fetching latest tag
- ref=`run "cd $path/source && git for-each-ref refs/tags \
+ ref=`run "cd $path && git for-each-ref refs/tags \
--sort=-authordate \
--format='%(refname)' \
--count=1 | cut -d '/' -f 3"`
@@ -189,15 +187,11 @@
# reset HEAD
log resetting HEAD to $ref
- run "cd $path/source && git reset --hard $ref"
+ run "cd $path && git reset --hard $ref"
test $? -eq 0 || abort git reset failed
- # link current
- run "ln -sfn $path/source $path/current"
- test $? -eq 0 || abort symlink failed
-
# deploy log
- run "cd $path/source && \
+ run "cd $path && \
echo \`git rev-parse --short HEAD\` \
>> $path/.deploys"
test $? -eq 0 || abort deploy log append failed
@@ -224,7 +218,7 @@
current_commit() {
local path=`config_get path`
- run "cd $path/source && \
+ run "cd $path && \
git rev-parse --short HEAD"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment