feat: support the file:// scheme to install plugin

This commit is contained in:
Mayeu
2019-04-23 15:23:35 +07:00
parent bb494b69ea
commit 252092c73a
2 changed files with 50 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ plugin_install_cmd() {
[[ "$#" -gt 2 ]] && dokku_log_info1_quiet "Cannot install additional core plugins, running core plugin install trigger"
PLUGIN_PATH="$PLUGIN_CORE_PATH" plugn trigger install
;;
https:* | git* | ssh:* | *.tar.gz | *.tgz)
https:* | git* | ssh:* | file:* | *.tar.gz | *.tgz)
shift
download_and_enable_plugin "$@"
plugn trigger install

View File

@@ -3,13 +3,20 @@
load test_helper
TEST_PLUGIN_NAME=smoke-test-plugin
TEST_PLUGIN_GIT_REPO=https://github.com/dokku/${TEST_PLUGIN_NAME}.git
TEST_PLUGIN_LOCAL_REPO="$(mktemp -d)/$TEST_PLUGIN_NAME"
clone_test_plugin() {
git clone "$TEST_PLUGIN_GIT_REPO" "$TEST_PLUGIN_LOCAL_REPO"
}
setup() {
global_setup
clone_test_plugin
}
remove_test_plugin() {
rm -rf $PLUGIN_ENABLED_PATH/$TEST_PLUGIN_NAME $PLUGIN_AVAILABLE_PATH/$TEST_PLUGIN_NAME
rm -rf $TEST_PLUGIN_LOCAL_REPO
}
teardown() {
@@ -59,6 +66,48 @@ teardown() {
assert_failure
}
@test "(plugin) plugin:install, plugin:disable, plugin:update plugin:uninstall (with file://)" {
run /bin/bash -c "dokku plugin:install file://$TEST_PLUGIN_LOCAL_REPO --name $TEST_PLUGIN_NAME"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku plugin:update $TEST_PLUGIN_NAME"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku plugin | grep enabled | grep $TEST_PLUGIN_NAME"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "sudo -E -u nobody dokku plugin:uninstall $TEST_PLUGIN_NAME"
echo "output: $output"
echo "status: $status"
assert_failure
run /bin/bash -c "dokku plugin:disable $TEST_PLUGIN_NAME"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku plugin | grep disabled | grep $TEST_PLUGIN_NAME"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku plugin:uninstall $TEST_PLUGIN_NAME"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku plugin | grep $TEST_PLUGIN_NAME"
echo "output: $output"
echo "status: $status"
assert_failure
}
@test "(plugin) plugin:install plugin:update (with tag)" {
run /bin/bash -c "dokku plugin:install $TEST_PLUGIN_GIT_REPO --committish v0.2.0 --name $TEST_PLUGIN_NAME"
echo "output: $output"