parent
e307286db7
commit
fd735a1310
117
abra
117
abra
@ -20,6 +20,7 @@ Usage:
|
|||||||
abra [options] app <domain> logs [<service>]
|
abra [options] app <domain> logs [<service>]
|
||||||
abra [options] app <domain> multilogs
|
abra [options] app <domain> multilogs
|
||||||
abra [options] app <domain> cp <src> <dst>
|
abra [options] app <domain> cp <src> <dst>
|
||||||
|
abra [options] app <domain> check
|
||||||
abra [options] app <domain> run [--user=<user>] <service> <args>...
|
abra [options] app <domain> run [--user=<user>] <service> <args>...
|
||||||
abra [options] app <domain> run <service> <args>...
|
abra [options] app <domain> run <service> <args>...
|
||||||
abra [options] app <domain> secret auto
|
abra [options] app <domain> secret auto
|
||||||
@ -141,11 +142,11 @@ eval "var_$1+=($value)"; else eval "var_$1=$value"; fi; return 0; fi; done
|
|||||||
return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() {
|
return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() {
|
||||||
printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() {
|
printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() {
|
||||||
[[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() {
|
[[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() {
|
||||||
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:1371}
|
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:1407}
|
||||||
usage=${DOC:40:1063}; digest=d0254; shorts=(-v -s -e -h '' '' '' '' '' '' '' '')
|
usage=${DOC:40:1099}; digest=53ae1; shorts=(-s -e -h -v '' '' '' '' '' '' '' '')
|
||||||
longs=(--version --stack --env --help --server --domain --pass --auto --status --force --user --all)
|
longs=(--stack --env --help --version --server --domain --pass --auto --status --force --user --all)
|
||||||
argcounts=(0 1 1 0 1 1 0 0 0 0 1 0); node_0(){ switch __version 0; }; node_1(){
|
argcounts=(1 1 0 0 1 1 0 0 0 0 1 0); node_0(){ value __stack 0; }; node_1(){
|
||||||
value __stack 1; }; node_2(){ value __env 2; }; node_3(){ switch __help 3; }
|
value __env 1; }; node_2(){ switch __help 2; }; node_3(){ switch __version 3; }
|
||||||
node_4(){ value __server 4; }; node_5(){ value __domain 5; }; node_6(){
|
node_4(){ value __server 4; }; node_5(){ value __domain 5; }; node_6(){
|
||||||
switch __pass 6; }; node_7(){ switch __auto 7; }; node_8(){ switch __status 8; }
|
switch __pass 6; }; node_7(){ switch __auto 7; }; node_8(){ switch __status 8; }
|
||||||
node_9(){ switch __force 9; }; node_10(){ value __user 10; }; node_11(){
|
node_9(){ switch __force 9; }; node_10(){ value __user 10; }; node_11(){
|
||||||
@ -159,41 +160,42 @@ _command new; }; node_27(){ _command list; }; node_28(){ _command ls; }
|
|||||||
node_29(){ _command deploy; }; node_30(){ _command undeploy; }; node_31(){
|
node_29(){ _command deploy; }; node_30(){ _command undeploy; }; node_31(){
|
||||||
_command config; }; node_32(){ _command delete; }; node_33(){ _command rm; }
|
_command config; }; node_32(){ _command delete; }; node_33(){ _command rm; }
|
||||||
node_34(){ _command logs; }; node_35(){ _command multilogs; }; node_36(){
|
node_34(){ _command logs; }; node_35(){ _command multilogs; }; node_36(){
|
||||||
_command cp; }; node_37(){ _command run; }; node_38(){ _command secret; }
|
_command cp; }; node_37(){ _command check; }; node_38(){ _command run; }
|
||||||
node_39(){ _command auto; }; node_40(){ _command generate; }; node_41(){
|
node_39(){ _command secret; }; node_40(){ _command auto; }; node_41(){
|
||||||
_command insert; }; node_42(){ _command server; }; node_43(){ _command add; }
|
_command generate; }; node_42(){ _command insert; }; node_43(){ _command server
|
||||||
node_44(){ _command use; }; node_45(){ _command init; }; node_46(){
|
}; node_44(){ _command add; }; node_45(){ _command use; }; node_46(){
|
||||||
_command upgrade; }; node_47(){ optional 0 1 2 3; }; node_48(){ optional 47; }
|
_command init; }; node_47(){ _command upgrade; }; node_48(){ optional 0 1 2 3; }
|
||||||
node_49(){ optional 4; }; node_50(){ optional 5; }; node_51(){ optional 6; }
|
node_49(){ optional 48; }; node_50(){ optional 4; }; node_51(){ optional 5; }
|
||||||
node_52(){ optional 7; }; node_53(){ required 48 25 26 49 50 51 52 12; }
|
node_52(){ optional 6; }; node_53(){ optional 7; }; node_54(){
|
||||||
node_54(){ either 27 28; }; node_55(){ required 54; }; node_56(){ optional 8; }
|
required 49 25 26 50 51 52 53 12; }; node_55(){ either 27 28; }; node_56(){
|
||||||
node_57(){ required 48 25 55 56; }; node_58(){ required 48 25 13 29; }
|
required 55; }; node_57(){ optional 8; }; node_58(){ required 49 25 56 57; }
|
||||||
node_59(){ required 48 25 13 30; }; node_60(){ required 48 25 13 31; }
|
node_59(){ required 49 25 13 29; }; node_60(){ required 49 25 13 30; }
|
||||||
node_61(){ either 32 33; }; node_62(){ required 61; }; node_63(){ optional 9; }
|
node_61(){ required 49 25 13 31; }; node_62(){ either 32 33; }; node_63(){
|
||||||
node_64(){ required 48 25 13 62 63; }; node_65(){ optional 14; }; node_66(){
|
required 62; }; node_64(){ optional 9; }; node_65(){ required 49 25 13 63 64; }
|
||||||
required 48 25 13 34 65; }; node_67(){ required 48 25 13 35; }; node_68(){
|
node_66(){ optional 14; }; node_67(){ required 49 25 13 34 66; }; node_68(){
|
||||||
required 48 25 13 36 15 16; }; node_69(){ optional 10; }; node_70(){
|
required 49 25 13 35; }; node_69(){ required 49 25 13 36 15 16; }; node_70(){
|
||||||
oneormore 17; }; node_71(){ required 48 25 13 37 69 14 70; }; node_72(){
|
required 49 25 13 37; }; node_71(){ optional 10; }; node_72(){ oneormore 17; }
|
||||||
required 48 25 13 37 14 70; }; node_73(){ required 48 25 13 38 39; }; node_74(){
|
node_73(){ required 49 25 13 38 71 14 72; }; node_74(){
|
||||||
optional 20; }; node_75(){ required 48 25 13 38 40 18 19 74 51; }; node_76(){
|
required 49 25 13 38 14 72; }; node_75(){ required 49 25 13 39 40; }; node_76(){
|
||||||
required 48 25 13 38 41 18 19 21 51; }; node_77(){ either 18 11; }; node_78(){
|
optional 20; }; node_77(){ required 49 25 13 39 41 18 19 76 52; }; node_78(){
|
||||||
required 77; }; node_79(){ required 48 25 13 38 62 78 51 63; }; node_80(){
|
required 49 25 13 39 42 18 19 21 52; }; node_79(){ either 18 11; }; node_80(){
|
||||||
optional 23; }; node_81(){ optional 24; }; node_82(){ required 48 42 43 22 80 81
|
required 79; }; node_81(){ required 49 25 13 39 63 80 52 64; }; node_82(){
|
||||||
}; node_83(){ required 48 42 55; }; node_84(){ required 48 42 33 22; }
|
optional 23; }; node_83(){ optional 24; }; node_84(){ required 49 43 44 22 82 83
|
||||||
node_85(){ required 48 42 44 22; }; node_86(){ required 48 42 45 22; }
|
}; node_85(){ required 49 43 56; }; node_86(){ required 49 43 33 22; }
|
||||||
node_87(){ required 48 46; }; node_88(){
|
node_87(){ required 49 43 45 22; }; node_88(){ required 49 43 46 22; }
|
||||||
either 53 57 58 59 60 64 66 67 68 71 72 73 75 76 79 82 83 84 85 86 87; }
|
node_89(){ required 49 47; }; node_90(){
|
||||||
node_89(){ required 88; }; cat <<<' docopt_exit() {
|
either 54 58 59 60 61 65 67 68 69 70 73 74 75 77 78 81 84 85 86 87 88 89; }
|
||||||
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1063}" >&2
|
node_91(){ required 90; }; cat <<<' docopt_exit() {
|
||||||
exit 1; }'; unset var___version var___stack var___env var___help var___server \
|
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1099}" >&2
|
||||||
|
exit 1; }'; unset var___stack var___env var___help var___version var___server \
|
||||||
var___domain var___pass var___auto var___status var___force var___user \
|
var___domain var___pass var___auto var___status var___force var___user \
|
||||||
var___all var__app_ var__domain_ var__service_ var__src_ var__dst_ var__args_ \
|
var___all var__app_ var__domain_ var__service_ var__src_ var__dst_ var__args_ \
|
||||||
var__secret_ var__version_ var__cmd_ var__data_ var__host_ var__user_ \
|
var__secret_ var__version_ var__cmd_ var__data_ var__host_ var__user_ \
|
||||||
var__port_ var_app var_new var_list var_ls var_deploy var_undeploy var_config \
|
var__port_ var_app var_new var_list var_ls var_deploy var_undeploy var_config \
|
||||||
var_delete var_rm var_logs var_multilogs var_cp var_run var_secret var_auto \
|
var_delete var_rm var_logs var_multilogs var_cp var_check var_run var_secret \
|
||||||
var_generate var_insert var_server var_add var_use var_init var_upgrade
|
var_auto var_generate var_insert var_server var_add var_use var_init var_upgrade
|
||||||
parse 89 "$@"; local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__version" \
|
parse 91 "$@"; local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__stack" \
|
||||||
"${prefix}__stack" "${prefix}__env" "${prefix}__help" "${prefix}__server" \
|
"${prefix}__env" "${prefix}__help" "${prefix}__version" "${prefix}__server" \
|
||||||
"${prefix}__domain" "${prefix}__pass" "${prefix}__auto" "${prefix}__status" \
|
"${prefix}__domain" "${prefix}__pass" "${prefix}__auto" "${prefix}__status" \
|
||||||
"${prefix}__force" "${prefix}__user" "${prefix}__all" "${prefix}_app_" \
|
"${prefix}__force" "${prefix}__user" "${prefix}__all" "${prefix}_app_" \
|
||||||
"${prefix}_domain_" "${prefix}_service_" "${prefix}_src_" "${prefix}_dst_" \
|
"${prefix}_domain_" "${prefix}_service_" "${prefix}_src_" "${prefix}_dst_" \
|
||||||
@ -201,13 +203,13 @@ parse 89 "$@"; local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__version" \
|
|||||||
"${prefix}_data_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
|
"${prefix}_data_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
|
||||||
"${prefix}app" "${prefix}new" "${prefix}list" "${prefix}ls" "${prefix}deploy" \
|
"${prefix}app" "${prefix}new" "${prefix}list" "${prefix}ls" "${prefix}deploy" \
|
||||||
"${prefix}undeploy" "${prefix}config" "${prefix}delete" "${prefix}rm" \
|
"${prefix}undeploy" "${prefix}config" "${prefix}delete" "${prefix}rm" \
|
||||||
"${prefix}logs" "${prefix}multilogs" "${prefix}cp" "${prefix}run" \
|
"${prefix}logs" "${prefix}multilogs" "${prefix}cp" "${prefix}check" \
|
||||||
"${prefix}secret" "${prefix}auto" "${prefix}generate" "${prefix}insert" \
|
"${prefix}run" "${prefix}secret" "${prefix}auto" "${prefix}generate" \
|
||||||
"${prefix}server" "${prefix}add" "${prefix}use" "${prefix}init" \
|
"${prefix}insert" "${prefix}server" "${prefix}add" "${prefix}use" \
|
||||||
"${prefix}upgrade"; eval "${prefix}"'__version=${var___version:-false}'
|
"${prefix}init" "${prefix}upgrade"; eval "${prefix}"'__stack=${var___stack:-}'
|
||||||
eval "${prefix}"'__stack=${var___stack:-}'
|
|
||||||
eval "${prefix}"'__env=${var___env:-}'
|
eval "${prefix}"'__env=${var___env:-}'
|
||||||
eval "${prefix}"'__help=${var___help:-false}'
|
eval "${prefix}"'__help=${var___help:-false}'
|
||||||
|
eval "${prefix}"'__version=${var___version:-false}'
|
||||||
eval "${prefix}"'__server=${var___server:-}'
|
eval "${prefix}"'__server=${var___server:-}'
|
||||||
eval "${prefix}"'__domain=${var___domain:-}'
|
eval "${prefix}"'__domain=${var___domain:-}'
|
||||||
eval "${prefix}"'__pass=${var___pass:-false}'
|
eval "${prefix}"'__pass=${var___pass:-false}'
|
||||||
@ -236,7 +238,9 @@ eval "${prefix}"'config=${var_config:-false}'
|
|||||||
eval "${prefix}"'delete=${var_delete:-false}'
|
eval "${prefix}"'delete=${var_delete:-false}'
|
||||||
eval "${prefix}"'rm=${var_rm:-false}'; eval "${prefix}"'logs=${var_logs:-false}'
|
eval "${prefix}"'rm=${var_rm:-false}'; eval "${prefix}"'logs=${var_logs:-false}'
|
||||||
eval "${prefix}"'multilogs=${var_multilogs:-false}'
|
eval "${prefix}"'multilogs=${var_multilogs:-false}'
|
||||||
eval "${prefix}"'cp=${var_cp:-false}'; eval "${prefix}"'run=${var_run:-false}'
|
eval "${prefix}"'cp=${var_cp:-false}'
|
||||||
|
eval "${prefix}"'check=${var_check:-false}'
|
||||||
|
eval "${prefix}"'run=${var_run:-false}'
|
||||||
eval "${prefix}"'secret=${var_secret:-false}'
|
eval "${prefix}"'secret=${var_secret:-false}'
|
||||||
eval "${prefix}"'auto=${var_auto:-false}'
|
eval "${prefix}"'auto=${var_auto:-false}'
|
||||||
eval "${prefix}"'generate=${var_generate:-false}'
|
eval "${prefix}"'generate=${var_generate:-false}'
|
||||||
@ -246,8 +250,8 @@ eval "${prefix}"'add=${var_add:-false}'; eval "${prefix}"'use=${var_use:-false}'
|
|||||||
eval "${prefix}"'init=${var_init:-false}'
|
eval "${prefix}"'init=${var_init:-false}'
|
||||||
eval "${prefix}"'upgrade=${var_upgrade:-false}'; local docopt_i=1
|
eval "${prefix}"'upgrade=${var_upgrade:-false}'; local docopt_i=1
|
||||||
[[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do
|
[[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do
|
||||||
declare -p "${prefix}__version" "${prefix}__stack" "${prefix}__env" \
|
declare -p "${prefix}__stack" "${prefix}__env" "${prefix}__help" \
|
||||||
"${prefix}__help" "${prefix}__server" "${prefix}__domain" "${prefix}__pass" \
|
"${prefix}__version" "${prefix}__server" "${prefix}__domain" "${prefix}__pass" \
|
||||||
"${prefix}__auto" "${prefix}__status" "${prefix}__force" "${prefix}__user" \
|
"${prefix}__auto" "${prefix}__status" "${prefix}__force" "${prefix}__user" \
|
||||||
"${prefix}__all" "${prefix}_app_" "${prefix}_domain_" "${prefix}_service_" \
|
"${prefix}__all" "${prefix}_app_" "${prefix}_domain_" "${prefix}_service_" \
|
||||||
"${prefix}_src_" "${prefix}_dst_" "${prefix}_args_" "${prefix}_secret_" \
|
"${prefix}_src_" "${prefix}_dst_" "${prefix}_args_" "${prefix}_secret_" \
|
||||||
@ -255,9 +259,10 @@ declare -p "${prefix}__version" "${prefix}__stack" "${prefix}__env" \
|
|||||||
"${prefix}_user_" "${prefix}_port_" "${prefix}app" "${prefix}new" \
|
"${prefix}_user_" "${prefix}_port_" "${prefix}app" "${prefix}new" \
|
||||||
"${prefix}list" "${prefix}ls" "${prefix}deploy" "${prefix}undeploy" \
|
"${prefix}list" "${prefix}ls" "${prefix}deploy" "${prefix}undeploy" \
|
||||||
"${prefix}config" "${prefix}delete" "${prefix}rm" "${prefix}logs" \
|
"${prefix}config" "${prefix}delete" "${prefix}rm" "${prefix}logs" \
|
||||||
"${prefix}multilogs" "${prefix}cp" "${prefix}run" "${prefix}secret" \
|
"${prefix}multilogs" "${prefix}cp" "${prefix}check" "${prefix}run" \
|
||||||
"${prefix}auto" "${prefix}generate" "${prefix}insert" "${prefix}server" \
|
"${prefix}secret" "${prefix}auto" "${prefix}generate" "${prefix}insert" \
|
||||||
"${prefix}add" "${prefix}use" "${prefix}init" "${prefix}upgrade"; done; }
|
"${prefix}server" "${prefix}add" "${prefix}use" "${prefix}init" \
|
||||||
|
"${prefix}upgrade"; done; }
|
||||||
# docopt parser above, complete command for generating this parser is `docopt.sh abra`
|
# docopt parser above, complete command for generating this parser is `docopt.sh abra`
|
||||||
|
|
||||||
PROGRAM_NAME=$(basename "$0")
|
PROGRAM_NAME=$(basename "$0")
|
||||||
@ -611,6 +616,24 @@ sub_app_config (){
|
|||||||
$EDITOR "$ENV_FILE"
|
$EDITOR "$ENV_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###### .. app check
|
||||||
|
sub_app_check (){
|
||||||
|
load_instance
|
||||||
|
load_instance_env
|
||||||
|
|
||||||
|
APP_ENV=$(grep -v '^#' "$ENV_FILE" | sed 's/^.* \([^=]\+\)=.*/\1/' | sort)
|
||||||
|
STACK_ENV=$(grep -v '^#' "$APP_DIR/.envrc.sample" | sed 's/^.* \([^=]\+\)=.*/\1/' | sort)
|
||||||
|
|
||||||
|
MISSING_VARS=$(comm -23 <(echo "$STACK_ENV") <(echo "$APP_ENV"))
|
||||||
|
|
||||||
|
if [ -z "$MISSING_VARS" ]; then
|
||||||
|
success "Yay! All the necessary basic variables are defined"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
error "Found missing variables: $MISSING_VARS"
|
||||||
|
}
|
||||||
|
|
||||||
###### .. app <domain> delete
|
###### .. app <domain> delete
|
||||||
sub_app_rm (){
|
sub_app_rm (){
|
||||||
sub_app_delete
|
sub_app_delete
|
||||||
|
Loading…
Reference in New Issue
Block a user