refactor: move get_cmd_from_procfile to ps/functions

Procfile handling should only be performed in the ps plugin
This commit is contained in:
Jose Diaz-Gonzalez
2018-07-29 14:08:14 -04:00
parent afd101034d
commit 0292c4ee3b
5 changed files with 13 additions and 13 deletions

View File

@@ -392,17 +392,6 @@ get_app_running_container_types() {
echo "$CONTAINER_TYPES"
}
get_cmd_from_procfile() {
declare desc="parse cmd from app Procfile"
declare APP="$1" PROC_TYPE="$2" PORT="$3"
local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
local COMMAND
verify_app_name "$APP"
[[ ! -f $DOKKU_PROCFILE ]] && return
procfile-util show --procfile "$PROC_TYPE" --default-port "$PORT"
}
is_deployed() {
declare desc="return 0 if given app has a running container"
local APP="$1"

View File

@@ -3,6 +3,17 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
get_cmd_from_procfile() {
declare desc="parse cmd from app Procfile"
declare APP="$1" PROC_TYPE="$2" PORT="$3"
local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
local COMMAND
verify_app_name "$APP"
[[ ! -f $DOKKU_PROCFILE ]] && return
procfile-util show --procfile "$DOKKU_PROCFILE" --process-type "$PROC_TYPE" --default-port "$PORT"
}
print_dokku_scale_file() {
declare desc="prints contents of DOKKU_SCALE file"
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"

View File

@@ -3,6 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
scheduler-docker-local-scheduler-deploy() {
declare desc="deploys an image tag for a given application"

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
scheduler-docker-local-scheduler-run() {
declare desc="runs command in container based on app image"

View File

@@ -13,7 +13,6 @@ teardown() {
}
@test "(ps:scale) procfile commands extraction" {
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
cat <<EOF > "$DOKKU_ROOT/$TEST_APP/DOKKU_PROCFILE"
web: node web.js --port \$PORT