这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/apps/functions
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"

apps_create() {
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ ! "$1" =~ ^[a-z].* && ! "$1" =~ ^[0-9].* ]] && dokku_log_fail "App name must begin with lowercase alphanumeric character"
[[ -d "$DOKKU_ROOT/$1" ]] && dokku_log_fail "Name is already taken"
local APP="$1"

Expand Down
4 changes: 4 additions & 0 deletions plugins/common/functions
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ dokku_container_log_verbose_quiet() {
verify_app_name() {
local APP="$1"
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
if [[ ! "$APP" =~ ^[a-z].* && ! "$APP" =~ ^[0-9].* ]]; then
[[ -d "$DOKKU_ROOT/$APP" ]] && rm -rf "$DOKKU_ROOT/$APP"
dokku_log_fail "App name must begin with lowercase alphanumeric character"
fi
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"

return 0
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/10_apps.bats
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ load test_helper
echo "status: "$status
assert_success
destroy_app

run dokku apps:create 1994testapp
echo "output: "$output
echo "status: "$status
assert_success
dokku --force apps:destroy 1994testapp

run dokku apps:create TestApp
echo "output: "$output
echo "status: "$status
assert_failure
}

@test "(apps) apps:destroy" {
Expand Down