diff options
author | tv <tv@shackspace.de> | 2015-10-15 01:48:48 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-10-15 01:48:48 +0200 |
commit | 513da89fe50b3bad3d758855f5622c4508977e4a (patch) | |
tree | d13b0f6e4e816f697601b6f3f8879dc983da83ae |
initial commit
-rwxr-xr-x | push | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -0,0 +1,36 @@ +#! /bin/sh +# NAME +# push - Push master to all your repositores +# +# SYNOPSIS +# push +# +# ENVIRONMENT VARIABLES +# LOGNAME Specifies who you are. +# +# STOCKHOLM Specifies where stockholm can be found. +# (Default: ~/stockholm) +# +set -efu + +STOCKHOLM=${STOCKHOLM-$HOME/stockholm} + +my_hosts() { + (cd "$STOCKHOLM" && get "$LOGNAME" -l | jq -R -s -c 'split("\n")') +} + +all_push_hosts() { + echo '{' + git remote -v \ + | sed -n 's/^\(\S\+\)\s\+git@\([^:]\+\):\(\S\+\) (push)$/"\1":{"host":"\2","repo":"\3"}/;T;$!s/$/,/;p' + echo '}' +} + +my_push_hosts() { + my_hosts \ + | jq -r --argjson all_push_hosts "$(all_push_hosts)" \ + 'map(. as $host | select( $all_push_hosts | has($host)))[]' +} + +my_push_hosts \ + | parallel -j0 --no-notice --line-buffer --tag-string {} git push {} master |