libexec/lock in alpha_omega-0.0.113 vs libexec/lock in alpha_omega-0.0.114

- old
+ new

@@ -8,155 +8,185 @@ exec bin/proxy $(basename $0) "$@" exit 1 fi fi +export LOCAL_ONLY=true + +default_pod=$(cat /etc/podname 2>&- || true) + case "$(basename $0)" in - debug) - export LOCAL_ONLY=true + invoke) + export COMMAND="$1"; shift - { - cap $(for a in "$@"; do echo $a.echo; done) - } - ;; + if [[ -n $1 ]]; then + set $(for a in "$@"; do if [[ $default_pod = $a ]]; then echo "default.app"; else echo $a.app; fi; done) + fi - hosts) - export LOCAL_ONLY=true + LOCAL_ONLY= + tmp_invoke=$(mktemp -t XXXXXXXXX) + bundle exec cap "$@" invoke 2>&1 | perl -pe 's{.\[\d+m}{}g' | perl -ne 'm{^\s*\*+\s*\[(out|err)\s*::\s*([^]]+)\] ?(.*)} && print "$1 $2 $3\n"' > $tmp_invoke 2>&1 - { - cap $(for a in "$@"; do echo $a.echo; done) - } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u + cat $tmp_invoke | awk '{print $2}' | sort -u | while read -r nm_host; do + egrep "^(out|err) $nm_host" $tmp_invoke || true + echo + done + rm -f $tmp_invoke ;; + *) + if [[ -n $1 ]]; then + set $(for a in "$@"; do if [[ $default_pod = $a ]]; then echo "default"; else echo $a; fi; done) + fi - dna) - export LOCAL_ONLY=true + case "$(basename $0)" in + debug) + if [[ -z $1 ]]; then + set "world" + fi - { - echo "eea914aaa8dde6fdae29242b1084a2b0415eefaf ---" - cap $(for a in "$@"; do echo $a.yaml; done) - } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##' - ;; + if [[ -n $1 ]]; then + cap $(for a in "$@"; do echo $a.echo; done) + fi + ;; - bump) - case "$1" in - patch|minor|major) - bump=$1; shift - set $(cat VERSION | sed 's#\.# #g') - case "$bump" in - patch) - echo "$1.$2.$(($3 + 1))" - ;; - minor) - echo "$1.$(($2 + 1)).0" - ;; - major) - echo "$(($1 + 1)).0.0" - ;; - esac > VERSION + hosts) + { + if [[ -n $1 ]]; then + cap $(for a in "$@"; do echo $a.echo; done) + fi + } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u ;; - *) - ver_new=$1; shift - set $(echo "$ver_new" | sed 's#\.# #g') 0 - M=$1; shift - m=$1; shift - p=$1; shift - tmp_version=$(mktemp -t XXXXXXXXX) - (echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&- - ver_new_same=$(cat $tmp_version) - rm -f $tmp_version - - if [[ $ver_new = $ver_new_same ]]; then - echo "$ver_new" > VERSION - else - echo "ERROR: invalid version: $ver_new" 1>&2 - exit 1 - fi + dna) + { + echo "eea914aaa8dde6fdae29242b1084a2b0415eefaf ---" + if [[ -n $1 ]]; then + cap $(for a in "$@"; do echo $a.yaml; done) + fi + } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##' ;; - esac - if [[ -f Gemfile ]]; then - bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; } - git add Gemfile.lock - fi + bump) + case "$1" in + patch|minor|major) + bump=$1; shift + set $(cat VERSION | sed 's#\.# #g') + case "$bump" in + patch) + echo "$1.$2.$(($3 + 1))" + ;; + minor) + echo "$1.$(($2 + 1)).0" + ;; + major) + echo "$(($1 + 1)).0.0" + ;; + esac > VERSION + ;; + *) + ver_new=$1; shift + set $(echo "$ver_new" | sed 's#\.# #g') 0 + M=$1; shift + m=$1; shift + p=$1; shift - git add VERSION + tmp_version=$(mktemp -t XXXXXXXXX) + (echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&- + ver_new_same=$(cat $tmp_version) + rm -f $tmp_version - ver_bumped=$(cat VERSION) - git commit -m "bump: $ver_bumped" - git tag "v$ver_bumped" - echo $ver_bumped - ;; + if [[ $ver_new = $ver_new_same ]]; then + echo "$ver_new" > VERSION + else + echo "ERROR: invalid version: $ver_new" 1>&2 + exit 1 + fi + ;; + esac - *) - set $(for a in "$@"; do echo $a.app; done) - case "$(basename $0)" in - deploy) - bundle exec cap "$@" deploy - ;; + if [[ -f Gemfile ]]; then + bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; } + git add Gemfile.lock + fi - release) - bundle exec cap "$@" deploy - ;; + git add VERSION - stage) - bundle exec cap "$@" deploy:update_code + ver_bumped=$(cat VERSION) + git commit -m "bump: $ver_bumped" + git tag "v$ver_bumped" + echo $ver_bumped ;; - restart) - bundle exec cap "$@" deploy:restart - ;; + *) + LOCAL_ONLY= + if [[ -n $1 ]]; then + set $(for a in "$@"; do echo $a.app; done) + fi + case "$(basename $0)" in + deploy) + bundle exec cap "$@" deploy + ;; - config) - bundle exec cap "$@" deploy:config - ;; + release) + bundle exec cap "$@" deploy + ;; - build) - bundle exec cap "$@" deploy:build - ;; + stage) + bundle exec cap "$@" deploy:update_code + ;; - dist) - bundle exec cap "$@" deploy:dist - ;; + restart) + bundle exec cap "$@" deploy:restart + ;; - activate) - bundle exec cap "$@" deploy:symlink deploy:restart - ;; + config) + bundle exec cap "$@" deploy:config + ;; - rollback) - bundle exec cap "$@" deploy:rollback - ;; + build) + bundle exec cap "$@" deploy:build + ;; - check) - bundle exec cap "$@" deploy:check - ;; + dist) + bundle exec cap "$@" deploy:dist + ;; - compare) - bundle exec cap "$@" deploy:compare - ;; + activate) + bundle exec cap "$@" deploy:symlink deploy:restart + ;; - plan) - bundle exec cap "$@" deploy:plan - ;; + rollback) + bundle exec cap "$@" deploy:rollback + ;; - lock) - bundle exec cap "$@" deploy:lock - ;; + check) + bundle exec cap "$@" deploy:check + ;; - unlock) - bundle exec cap "$@" deploy:unlock - ;; + compare) + bundle exec cap "$@" deploy:compare + ;; - invoke) - bundle exec cap "$@" invoke - ;; + plan) + bundle exec cap "$@" deploy:plan + ;; - shell) - bundle exec cap "$@" shell - ;; + lock) + bundle exec cap "$@" deploy:lock + ;; - *) - bundle exec cap "$@" - ;; - esac + unlock) + bundle exec cap "$@" deploy:unlock + ;; + + shell) + bundle exec cap "$@" shell + ;; + + *) + bundle exec cap "$@" + ;; + esac + esac + ;; esac