Skip to content

Instantly share code, notes, and snippets.

@srid
Created April 4, 2012 17:47
Show Gist options
  • Save srid/2304210 to your computer and use it in GitHub Desktop.
Save srid/2304210 to your computer and use it in GitHub Desktop.
stackato dev vm helper functions
# stackato repo
alias s=~/as/vmc-tcl/bin/stackato
export STACKATO_SSH_OPTS=-4
function vm-target {
H=stackato-$1.local
s target api.$H
}
# setup newly booted stackato vm
function vm-setup {
set -x
H=stackato-$1.local
C=stackato@$H
ssh-copy-id $C
curl -k -d "[email protected]&password=stackato&unix_password=stackato" https://api.$H/stackato/license || true
s target api.$H
s login [email protected] --passwd stackato
s info
}
# push local vcap repo changes to the vm
function vm-push {
H=stackato-$1.local
C=stackato@${H}
(gitch | rsync -4 -av --files-from=- . ${C}:stackato/vcap )
}
function vm-push-s {
H=stackato-$1.local
C=stackato@$H
rsync -rtv kato tools ${C}:stackato/
}
function vm-ssh {
H=stackato-$1.local
C=stackato@$H
ssh $C
}
# List changed files in this branch. useful for rsync'ing to remote
# containing only mainline.
# eg: gitch | rsync -av --files-from=- . [email protected]:stackato/vcap/
function gitch {
BRANCH=$(git name-rev --name-only HEAD)
COMMITED=$(git diff --name-only stackato..$BRANCH)
DIRTY=$(git status --porcelain | grep '^ M' | cut -d' ' -f3)
CHANGED=$(echo $COMMITED; echo $DIRTY)
echo $CHANGED
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment