Add recipe create
; tweak recipe version handling
This commit is contained in:
parent
75bd599a33
commit
150c54da40
251
abra
251
abra
@ -37,6 +37,7 @@ Usage:
|
||||
abra [options] app <app> undeploy
|
||||
abra [options] app <app> <command> [<args>...]
|
||||
abra [options] recipe ls
|
||||
abra [options] recipe create <recipe>
|
||||
abra [options] recipe <recipe> release [--force]
|
||||
abra [options] recipe <recipe> versions
|
||||
abra [options] server add <host> [<user>] [<port>]
|
||||
@ -164,15 +165,15 @@ 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() {
|
||||
printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() {
|
||||
[[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() {
|
||||
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2325}
|
||||
usage=${DOC:40:1716}; digest=aefb0
|
||||
shorts=(-h -n -e -s -U -b -C -v -d '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '')
|
||||
longs=(--help --no-prompt --env --stack --skip-update --branch --skip-check --verbose --debug --status --server --type --domain --app-name --pass --secrets --all --update --force --skip-version-check --no-domain-poll --volumes --no-tty --user --dev)
|
||||
argcounts=(0 0 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0); node_0(){
|
||||
switch __help 0; }; node_1(){ switch __no_prompt 1; }; node_2(){ value __env 2
|
||||
}; node_3(){ value __stack 3; }; node_4(){ switch __skip_update 4; }; node_5(){
|
||||
value __branch 5; }; node_6(){ switch __skip_check 6; }; node_7(){
|
||||
switch __verbose 7; }; node_8(){ switch __debug 8; }; node_9(){
|
||||
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2365}
|
||||
usage=${DOC:40:1756}; digest=de09c
|
||||
shorts=(-s -b -d -C -e -n -h -v -U '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '')
|
||||
longs=(--stack --branch --debug --skip-check --env --no-prompt --help --verbose --skip-update --status --server --type --domain --app-name --pass --secrets --all --update --force --skip-version-check --no-domain-poll --volumes --no-tty --user --dev)
|
||||
argcounts=(1 1 0 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0); node_0(){
|
||||
value __stack 0; }; node_1(){ value __branch 1; }; node_2(){ switch __debug 2; }
|
||||
node_3(){ switch __skip_check 3; }; node_4(){ value __env 4; }; node_5(){
|
||||
switch __no_prompt 5; }; node_6(){ switch __help 6; }; node_7(){
|
||||
switch __verbose 7; }; node_8(){ switch __skip_update 8; }; node_9(){
|
||||
switch __status 9; }; node_10(){ value __server 10; }; node_11(){
|
||||
value __type 11; }; node_12(){ value __domain 12; }; node_13(){
|
||||
value __app_name 13; }; node_14(){ switch __pass 14; }; node_15(){
|
||||
@ -197,49 +198,49 @@ node_52(){ _command cp; }; node_53(){ _command logs; }; node_54(){ _command ps
|
||||
_command delete; }; node_58(){ _command run; }; node_59(){ _command rollback; }
|
||||
node_60(){ _command secret; }; node_61(){ _command generate; }; node_62(){
|
||||
_command insert; }; node_63(){ _command undeploy; }; node_64(){ _command recipe
|
||||
}; node_65(){ _command release; }; node_66(){ _command versions; }; node_67(){
|
||||
_command server; }; node_68(){ _command add; }; node_69(){ _command __ --; }
|
||||
node_70(){ _command init; }; node_71(){ _command apps; }; node_72(){
|
||||
_command upgrade; }; node_73(){ _command doctor; }; node_74(){ _command help; }
|
||||
node_75(){ optional 0 1 2 3 4 5 6 7 8; }; node_76(){ optional 75; }; node_77(){
|
||||
either 44 45; }; node_78(){ required 77; }; node_79(){ optional 9; }; node_80(){
|
||||
optional 10; }; node_81(){ optional 11; }; node_82(){ required 76 43 78 79 80 81
|
||||
}; node_83(){ optional 12; }; node_84(){ optional 13; }; node_85(){ optional 14
|
||||
}; node_86(){ optional 15; }; node_87(){ required 76 43 46 80 83 84 85 86 25; }
|
||||
node_88(){ either 27 16; }; node_89(){ required 88; }; node_90(){
|
||||
required 76 43 26 47 89; }; node_91(){ optional 17; }; node_92(){ optional 18; }
|
||||
node_93(){ optional 19; }; node_94(){ optional 20; }; node_95(){ optional 28; }
|
||||
node_96(){ required 76 43 26 48 91 92 93 94 95; }; node_97(){
|
||||
required 76 43 26 49; }; node_98(){ required 76 43 26 50; }; node_99(){
|
||||
required 76 43 26 51; }; node_100(){ required 76 43 26 52 29 30; }; node_101(){
|
||||
optional 27; }; node_102(){ required 76 43 26 53 101; }; node_103(){
|
||||
required 76 43 26 54; }; node_104(){ required 76 43 26 55 89; }; node_105(){
|
||||
either 56 57; }; node_106(){ required 105; }; node_107(){ optional 21; }
|
||||
node_108(){ required 76 43 26 106 107 86; }; node_109(){ optional 31; }
|
||||
node_110(){ required 76 43 26 55 27 109; }; node_111(){ optional 22; }
|
||||
node_112(){ optional 23; }; node_113(){ oneormore 32; }; node_114(){
|
||||
required 76 43 26 58 111 112 27 113; }; node_115(){ required 76 43 26 59 95; }
|
||||
node_116(){ required 33 28; }; node_117(){ either 116 16; }; node_118(){
|
||||
required 117; }; node_119(){ optional 34; }; node_120(){
|
||||
required 76 43 26 60 61 118 119 85; }; node_121(){
|
||||
required 76 43 26 60 62 33 28 35 85; }; node_122(){ either 33 16; }; node_123(){
|
||||
required 122; }; node_124(){ required 76 43 26 60 106 123 85; }; node_125(){
|
||||
required 76 43 26 63; }; node_126(){ optional 113; }; node_127(){
|
||||
required 76 43 26 36 126; }; node_128(){ required 76 64 45; }; node_129(){
|
||||
required 76 64 37 65 92; }; node_130(){ required 76 64 37 66; }; node_131(){
|
||||
optional 39; }; node_132(){ optional 40; }; node_133(){
|
||||
required 76 67 68 38 131 132; }; node_134(){ required 76 67 46 41 69 32; }
|
||||
node_135(){ required 76 67 78; }; node_136(){ required 76 67 38 56; }
|
||||
node_137(){ required 76 67 38 70; }; node_138(){ required 76 67 38 71 79; }
|
||||
node_139(){ optional 24; }; node_140(){ required 76 72 139; }; node_141(){
|
||||
required 76 50; }; node_142(){ required 76 73; }; node_143(){ oneormore 42; }
|
||||
node_144(){ optional 143; }; node_145(){ required 76 74 144; }; node_146(){
|
||||
required 76; }; node_147(){
|
||||
either 82 87 90 96 97 98 99 100 102 103 104 108 110 114 115 120 121 124 125 127 128 129 130 133 134 135 136 137 138 140 141 142 145 146
|
||||
}; node_148(){ required 147; }; cat <<<' docopt_exit() {
|
||||
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1716}" >&2
|
||||
exit 1; }'; unset var___help var___no_prompt var___env var___stack \
|
||||
var___skip_update var___branch var___skip_check var___verbose var___debug \
|
||||
}; node_65(){ _command create; }; node_66(){ _command release; }; node_67(){
|
||||
_command versions; }; node_68(){ _command server; }; node_69(){ _command add; }
|
||||
node_70(){ _command __ --; }; node_71(){ _command init; }; node_72(){
|
||||
_command apps; }; node_73(){ _command upgrade; }; node_74(){ _command doctor; }
|
||||
node_75(){ _command help; }; node_76(){ optional 0 1 2 3 4 5 6 7 8; }
|
||||
node_77(){ optional 76; }; node_78(){ either 44 45; }; node_79(){ required 78; }
|
||||
node_80(){ optional 9; }; node_81(){ optional 10; }; node_82(){ optional 11; }
|
||||
node_83(){ required 77 43 79 80 81 82; }; node_84(){ optional 12; }; node_85(){
|
||||
optional 13; }; node_86(){ optional 14; }; node_87(){ optional 15; }; node_88(){
|
||||
required 77 43 46 81 84 85 86 87 25; }; node_89(){ either 27 16; }; node_90(){
|
||||
required 89; }; node_91(){ required 77 43 26 47 90; }; node_92(){ optional 17; }
|
||||
node_93(){ optional 18; }; node_94(){ optional 19; }; node_95(){ optional 20; }
|
||||
node_96(){ optional 28; }; node_97(){ required 77 43 26 48 92 93 94 95 96; }
|
||||
node_98(){ required 77 43 26 49; }; node_99(){ required 77 43 26 50; }
|
||||
node_100(){ required 77 43 26 51; }; node_101(){ required 77 43 26 52 29 30; }
|
||||
node_102(){ optional 27; }; node_103(){ required 77 43 26 53 102; }; node_104(){
|
||||
required 77 43 26 54; }; node_105(){ required 77 43 26 55 90; }; node_106(){
|
||||
either 56 57; }; node_107(){ required 106; }; node_108(){ optional 21; }
|
||||
node_109(){ required 77 43 26 107 108 87; }; node_110(){ optional 31; }
|
||||
node_111(){ required 77 43 26 55 27 110; }; node_112(){ optional 22; }
|
||||
node_113(){ optional 23; }; node_114(){ oneormore 32; }; node_115(){
|
||||
required 77 43 26 58 112 113 27 114; }; node_116(){ required 77 43 26 59 96; }
|
||||
node_117(){ required 33 28; }; node_118(){ either 117 16; }; node_119(){
|
||||
required 118; }; node_120(){ optional 34; }; node_121(){
|
||||
required 77 43 26 60 61 119 120 86; }; node_122(){
|
||||
required 77 43 26 60 62 33 28 35 86; }; node_123(){ either 33 16; }; node_124(){
|
||||
required 123; }; node_125(){ required 77 43 26 60 107 124 86; }; node_126(){
|
||||
required 77 43 26 63; }; node_127(){ optional 114; }; node_128(){
|
||||
required 77 43 26 36 127; }; node_129(){ required 77 64 45; }; node_130(){
|
||||
required 77 64 65 37; }; node_131(){ required 77 64 37 66 93; }; node_132(){
|
||||
required 77 64 37 67; }; node_133(){ optional 39; }; node_134(){ optional 40; }
|
||||
node_135(){ required 77 68 69 38 133 134; }; node_136(){
|
||||
required 77 68 46 41 70 32; }; node_137(){ required 77 68 79; }; node_138(){
|
||||
required 77 68 38 56; }; node_139(){ required 77 68 38 71; }; node_140(){
|
||||
required 77 68 38 72 80; }; node_141(){ optional 24; }; node_142(){
|
||||
required 77 73 141; }; node_143(){ required 77 50; }; node_144(){ required 77 74
|
||||
}; node_145(){ oneormore 42; }; node_146(){ optional 145; }; node_147(){
|
||||
required 77 75 146; }; node_148(){ required 77; }; node_149(){
|
||||
either 83 88 91 97 98 99 100 101 103 104 105 109 111 115 116 121 122 125 126 128 129 130 131 132 135 136 137 138 139 140 142 143 144 147 148
|
||||
}; node_150(){ required 149; }; cat <<<' docopt_exit() {
|
||||
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1756}" >&2
|
||||
exit 1; }'; unset var___stack var___branch var___debug var___skip_check \
|
||||
var___env var___no_prompt var___help var___verbose var___skip_update \
|
||||
var___status var___server var___type var___domain var___app_name var___pass \
|
||||
var___secrets var___all var___update var___force var___skip_version_check \
|
||||
var___no_domain_poll var___volumes var___no_tty var___user var___dev \
|
||||
@ -249,38 +250,38 @@ var__recipe_ var__host_ var__user_ var__port_ var__provider_ var__subcommands_ \
|
||||
var_app var_list var_ls var_new var_backup var_deploy var_check var_version \
|
||||
var_config var_cp var_logs var_ps var_restore var_rm var_delete var_run \
|
||||
var_rollback var_secret var_generate var_insert var_undeploy var_recipe \
|
||||
var_release var_versions var_server var_add var___ var_init var_apps \
|
||||
var_upgrade var_doctor var_help; parse 148 "$@"
|
||||
local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__help" \
|
||||
"${prefix}__no_prompt" "${prefix}__env" "${prefix}__stack" \
|
||||
"${prefix}__skip_update" "${prefix}__branch" "${prefix}__skip_check" \
|
||||
"${prefix}__verbose" "${prefix}__debug" "${prefix}__status" \
|
||||
"${prefix}__server" "${prefix}__type" "${prefix}__domain" \
|
||||
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
|
||||
"${prefix}__update" "${prefix}__force" "${prefix}__skip_version_check" \
|
||||
"${prefix}__no_domain_poll" "${prefix}__volumes" "${prefix}__no_tty" \
|
||||
"${prefix}__user" "${prefix}__dev" "${prefix}_type_" "${prefix}_app_" \
|
||||
"${prefix}_service_" "${prefix}_version_" "${prefix}_src_" "${prefix}_dst_" \
|
||||
"${prefix}_backup_file_" "${prefix}_args_" "${prefix}_secret_" \
|
||||
"${prefix}_cmd_" "${prefix}_data_" "${prefix}_command_" "${prefix}_recipe_" \
|
||||
"${prefix}_host_" "${prefix}_user_" "${prefix}_port_" "${prefix}_provider_" \
|
||||
"${prefix}_subcommands_" "${prefix}app" "${prefix}list" "${prefix}ls" \
|
||||
"${prefix}new" "${prefix}backup" "${prefix}deploy" "${prefix}check" \
|
||||
"${prefix}version" "${prefix}config" "${prefix}cp" "${prefix}logs" \
|
||||
"${prefix}ps" "${prefix}restore" "${prefix}rm" "${prefix}delete" \
|
||||
"${prefix}run" "${prefix}rollback" "${prefix}secret" "${prefix}generate" \
|
||||
"${prefix}insert" "${prefix}undeploy" "${prefix}recipe" "${prefix}release" \
|
||||
"${prefix}versions" "${prefix}server" "${prefix}add" "${prefix}__" \
|
||||
"${prefix}init" "${prefix}apps" "${prefix}upgrade" "${prefix}doctor" \
|
||||
"${prefix}help"; eval "${prefix}"'__help=${var___help:-false}'
|
||||
eval "${prefix}"'__no_prompt=${var___no_prompt:-false}'
|
||||
eval "${prefix}"'__env=${var___env:-}'
|
||||
var_create var_release var_versions var_server var_add var___ var_init \
|
||||
var_apps var_upgrade var_doctor var_help; parse 150 "$@"
|
||||
local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__stack" \
|
||||
"${prefix}__branch" "${prefix}__debug" "${prefix}__skip_check" \
|
||||
"${prefix}__env" "${prefix}__no_prompt" "${prefix}__help" "${prefix}__verbose" \
|
||||
"${prefix}__skip_update" "${prefix}__status" "${prefix}__server" \
|
||||
"${prefix}__type" "${prefix}__domain" "${prefix}__app_name" "${prefix}__pass" \
|
||||
"${prefix}__secrets" "${prefix}__all" "${prefix}__update" "${prefix}__force" \
|
||||
"${prefix}__skip_version_check" "${prefix}__no_domain_poll" \
|
||||
"${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__dev" \
|
||||
"${prefix}_type_" "${prefix}_app_" "${prefix}_service_" "${prefix}_version_" \
|
||||
"${prefix}_src_" "${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
|
||||
"${prefix}_secret_" "${prefix}_cmd_" "${prefix}_data_" "${prefix}_command_" \
|
||||
"${prefix}_recipe_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
|
||||
"${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \
|
||||
"${prefix}ls" "${prefix}new" "${prefix}backup" "${prefix}deploy" \
|
||||
"${prefix}check" "${prefix}version" "${prefix}config" "${prefix}cp" \
|
||||
"${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \
|
||||
"${prefix}delete" "${prefix}run" "${prefix}rollback" "${prefix}secret" \
|
||||
"${prefix}generate" "${prefix}insert" "${prefix}undeploy" "${prefix}recipe" \
|
||||
"${prefix}create" "${prefix}release" "${prefix}versions" "${prefix}server" \
|
||||
"${prefix}add" "${prefix}__" "${prefix}init" "${prefix}apps" \
|
||||
"${prefix}upgrade" "${prefix}doctor" "${prefix}help"
|
||||
eval "${prefix}"'__stack=${var___stack:-}'
|
||||
eval "${prefix}"'__skip_update=${var___skip_update:-false}'
|
||||
eval "${prefix}"'__branch=${var___branch:-}'
|
||||
eval "${prefix}"'__skip_check=${var___skip_check:-false}'
|
||||
eval "${prefix}"'__verbose=${var___verbose:-false}'
|
||||
eval "${prefix}"'__debug=${var___debug:-false}'
|
||||
eval "${prefix}"'__skip_check=${var___skip_check:-false}'
|
||||
eval "${prefix}"'__env=${var___env:-}'
|
||||
eval "${prefix}"'__no_prompt=${var___no_prompt:-false}'
|
||||
eval "${prefix}"'__help=${var___help:-false}'
|
||||
eval "${prefix}"'__verbose=${var___verbose:-false}'
|
||||
eval "${prefix}"'__skip_update=${var___skip_update:-false}'
|
||||
eval "${prefix}"'__status=${var___status:-false}'
|
||||
eval "${prefix}"'__server=${var___server:-}'
|
||||
eval "${prefix}"'__type=${var___type:-}'
|
||||
@ -334,6 +335,7 @@ eval "${prefix}"'generate=${var_generate:-false}'
|
||||
eval "${prefix}"'insert=${var_insert:-false}'
|
||||
eval "${prefix}"'undeploy=${var_undeploy:-false}'
|
||||
eval "${prefix}"'recipe=${var_recipe:-false}'
|
||||
eval "${prefix}"'create=${var_create:-false}'
|
||||
eval "${prefix}"'release=${var_release:-false}'
|
||||
eval "${prefix}"'versions=${var_versions:-false}'
|
||||
eval "${prefix}"'server=${var_server:-false}'
|
||||
@ -344,9 +346,9 @@ eval "${prefix}"'upgrade=${var_upgrade:-false}'
|
||||
eval "${prefix}"'doctor=${var_doctor:-false}'
|
||||
eval "${prefix}"'help=${var_help:-false}'; local docopt_i=1
|
||||
[[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do
|
||||
declare -p "${prefix}__help" "${prefix}__no_prompt" "${prefix}__env" \
|
||||
"${prefix}__stack" "${prefix}__skip_update" "${prefix}__branch" \
|
||||
"${prefix}__skip_check" "${prefix}__verbose" "${prefix}__debug" \
|
||||
declare -p "${prefix}__stack" "${prefix}__branch" "${prefix}__debug" \
|
||||
"${prefix}__skip_check" "${prefix}__env" "${prefix}__no_prompt" \
|
||||
"${prefix}__help" "${prefix}__verbose" "${prefix}__skip_update" \
|
||||
"${prefix}__status" "${prefix}__server" "${prefix}__type" "${prefix}__domain" \
|
||||
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
|
||||
"${prefix}__update" "${prefix}__force" "${prefix}__skip_version_check" \
|
||||
@ -361,10 +363,10 @@ declare -p "${prefix}__help" "${prefix}__no_prompt" "${prefix}__env" \
|
||||
"${prefix}version" "${prefix}config" "${prefix}cp" "${prefix}logs" \
|
||||
"${prefix}ps" "${prefix}restore" "${prefix}rm" "${prefix}delete" \
|
||||
"${prefix}run" "${prefix}rollback" "${prefix}secret" "${prefix}generate" \
|
||||
"${prefix}insert" "${prefix}undeploy" "${prefix}recipe" "${prefix}release" \
|
||||
"${prefix}versions" "${prefix}server" "${prefix}add" "${prefix}__" \
|
||||
"${prefix}init" "${prefix}apps" "${prefix}upgrade" "${prefix}doctor" \
|
||||
"${prefix}help"; done; }
|
||||
"${prefix}insert" "${prefix}undeploy" "${prefix}recipe" "${prefix}create" \
|
||||
"${prefix}release" "${prefix}versions" "${prefix}server" "${prefix}add" \
|
||||
"${prefix}__" "${prefix}init" "${prefix}apps" "${prefix}upgrade" \
|
||||
"${prefix}doctor" "${prefix}help"; done; }
|
||||
# docopt parser above, complete command for generating this parser is `docopt.sh abra`
|
||||
|
||||
PROGRAM_NAME=$(basename "$0")
|
||||
@ -646,7 +648,23 @@ get_recipe_versions() {
|
||||
|
||||
recipe="${1?Recipe not set}"
|
||||
|
||||
mapfile -t RECIPE_VERSIONS < <($JQ -r ".\"${recipe}\".versions | keys | .[]" "$ABRA_APPS_JSON" | sort)
|
||||
recipe_json=$($JQ ".\"${recipe}\"" "$ABRA_APPS_JSON")
|
||||
|
||||
if [ "$recipe_json" = "null" ]; then
|
||||
declare -a RECIPE_VERSIONS
|
||||
else
|
||||
mapfile -t RECIPE_VERSIONS < <(echo "$recipe_json" | $JQ -r ".versions | keys | .[]" - | sort)
|
||||
fi
|
||||
}
|
||||
|
||||
get_recipe_version_latest() {
|
||||
if [ "${#RECIPE_VERSIONS[@]}" = 0 ]; then
|
||||
VERSION=""
|
||||
warning "No version specified, dangerously using latest git 😨"
|
||||
else
|
||||
VERSION="${RECIPE_VERSIONS[-1]}"
|
||||
info "Chose version $VERSION"
|
||||
fi
|
||||
}
|
||||
|
||||
###### Run-time loading
|
||||
@ -1086,13 +1104,7 @@ sub_app_new (){
|
||||
APP_NAME=$abra___app_name
|
||||
|
||||
get_recipe_versions "$TYPE"
|
||||
if [ "${#RECIPE_VERSIONS[@]}" = 0 ]; then
|
||||
VERSION=""
|
||||
warning "No version specified, dangerously using latest git 😨"
|
||||
else
|
||||
VERSION="${RECIPE_VERSIONS[-1]}"
|
||||
info "Chose version $VERSION"
|
||||
fi
|
||||
get_recipe_version_latest
|
||||
|
||||
require_app_version "$TYPE" "$VERSION"
|
||||
|
||||
@ -1286,17 +1298,19 @@ sub_app_deploy (){
|
||||
SKIP_VERSION_CHECK=$abra___skip_version_check
|
||||
NO_DOMAIN_POLL=$abra___no_domain_poll
|
||||
|
||||
if [ -n "$abra__version_" ]; then
|
||||
VERSION="$abra__version_"
|
||||
if ! printf '%s\0' "${RECIPE_VERSIONS[@]}" | grep -Fqxz -- "$VERSION"; then
|
||||
error "'$version' doesn't appear to be a valid version of $TYPE"
|
||||
fi
|
||||
else
|
||||
if [ ! "$abra__version_" = "dev" ]; then
|
||||
get_recipe_versions "$TYPE"
|
||||
VERSION="${RECIPE_VERSIONS[-1]}"
|
||||
fi
|
||||
|
||||
info "Chose version $VERSION"
|
||||
if [ -n "$abra__version_" ]; then
|
||||
VERSION="$abra__version_"
|
||||
if ! printf '%s\0' "${RECIPE_VERSIONS[@]}" | grep -Fqxz -- "$VERSION"; then
|
||||
error "'$version' doesn't appear to be a valid version of $TYPE"
|
||||
fi
|
||||
info "Chose version $VERSION"
|
||||
else
|
||||
get_recipe_version_latest
|
||||
fi
|
||||
fi
|
||||
|
||||
require_app_version "$TYPE" "$VERSION"
|
||||
|
||||
@ -1858,6 +1872,33 @@ sub_app_cp() {
|
||||
# abra recipe ..
|
||||
#######################################
|
||||
|
||||
###### .. recipe create
|
||||
help_recipe_create() {
|
||||
echo "abra [options] recipe create <recipe>
|
||||
|
||||
Create a new application recipe called <recipe>."
|
||||
}
|
||||
|
||||
sub_recipe_create() {
|
||||
recipe="$abra__recipe_"
|
||||
|
||||
recipe_dir="$ABRA_DIR/apps/$recipe"
|
||||
|
||||
if [ -d "$recipe_dir" ]; then
|
||||
error "Recipe '$recipe' already exists"
|
||||
fi
|
||||
|
||||
cd "$ABRA_DIR/apps/" || error "Can't find '$ABRA_DIR/apps/'"
|
||||
|
||||
git clone -q "${GIT_URL}example" "$recipe_dir"
|
||||
|
||||
cd "$recipe_dir" || error "Failed to create directory '$recipe_dir'"
|
||||
|
||||
rm -rf .git .gitea
|
||||
|
||||
success "New recipe created in '$recipe_dir', happy hacking! 👌"
|
||||
}
|
||||
|
||||
###### .. recipe ls
|
||||
help_recipe_ls (){
|
||||
help_recipe_list
|
||||
|
Reference in New Issue
Block a user