Skip to content

Commit 2ea73ff

Browse files
author
Tobias Wojtylak
committed
get plugin name by php file in project directory
1 parent 8cc6e39 commit 2ea73ff

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

bin/sdActivatePlugin.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,43 @@ PROJECT_NAME="$( basename ${PROJECT_DIR} | tr '[:upper:]' '[:lower:]' )"
2828
PHP_CONTAINER_NAME="${PROJECT_NAME}_shopware546_php${VERSION}_1"
2929
WORK_DIR="/var/www/shopware54_php${VERSION}"
3030

31-
PLUGIN_DIRECTORY="custom/plugins/$PROJECT_NAME"
31+
PLUGIN_NAME=$(find . -name '*.php' -maxdepth 1 |sed 's#.*/##' | sed 's/\.php$//1')
32+
33+
PLUGIN_DIRECTORY="custom/plugins/$PLUGIN_NAME"
3234

3335
function init_plugin {
34-
echo "Init plugin $PROJECT_NAME"
36+
echo "Init plugin $PLUGIN_NAME"
3537
link_plugin
38+
install_plugin
39+
activate_plugin
3640
}
3741

3842
function link_plugin {
3943
echo "Link plugin $PROJECT_NAME to $PLUGIN_DIRECTORY"
40-
docker exec --workdir ${WORK_DIR} -it ${PHP_CONTAINER_NAME} ln -s /opt/host $PLUGIN_DIRECTORY
44+
execute_in_docker "ln -s /opt/host $PLUGIN_DIRECTORY"
45+
}
46+
47+
function install_plugin {
48+
execute_in_docker "bin/console sw:plugin:refresh"
49+
execute_in_docker "bin/console sw:plugin:install $PLUGIN_NAME"
50+
}
51+
52+
function activate_plugin {
53+
execute_in_docker "bin/console sw:plugin:activate $PLUGIN_NAME"
54+
execute_in_docker "bin/console sw:cache:clear"
4155
}
4256

4357
function reset_plugin {
58+
execute_in_docker "bin/console sw:plugin:refresh"
59+
4460
echo "reset plugin"
4561
}
4662

63+
function execute_in_docker {
64+
65+
docker exec --workdir ${WORK_DIR} -it ${PHP_CONTAINER_NAME} $1
66+
}
67+
4768
## start of the real program
4869

4970
export PROJECT_DIR

0 commit comments

Comments
 (0)