diff --git a/CHANELOG.md b/CHANELOG.md
index 1701b7a..7c377ce 100644
--- a/CHANELOG.md
+++ b/CHANELOG.md
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support for scoped php version in Laravel Valet 3
- Alias for composer install and require as `mage i`
- Alias for composer remove as `mage rm`
+- **Breaking change** dropped static new module and new theme for git templates,
+ currently only module works, a theme template will be added in the next release
## [1.8.3] - 2022-05-30
### Fixes
diff --git a/mage b/mage
index dbf381c..e1ec6b0 100755
--- a/mage
+++ b/mage
@@ -16,7 +16,7 @@ RED='\033[0;31m'
GREEN='\033[1;32m'
BLUE='\033[1;34m'
-VERSION="1.8.3"
+VERSION="1.9.0"
GITNAME="$(git config --global --get user.name | head -n1 | cut -d " " -f1)"
GITEMAIL="$(git config --global --get user.email)"
ADMINNAME="admin_$(echo "$GITNAME" | tr '[:upper:]' '[:lower:]')"
@@ -88,45 +88,41 @@ function helpMessage() {
}
function newMagentoMod() {
+ SKIP="false"
+ CREATE_SRC="app/code"
+
if [[ "$2" == "--yes" ]] || [[ "$2" == "-y" ]]; then SKIP="true"; fi
-
+ if [[ $SKIP == "false" ]]; then
+ read -p "Create in package-source (If no app code will be used) ? [Y/n] "
+ echo ""
+ if [[ ! $REPLY =~ ^[nN]|[nN][oO]$ ]]; then CREATE_SRC="package-source"; fi
+ else
+ CREATE_SRC="package-source"
+ fi
+
read -p "Vendor: " VENDOR
if [[ -z "$VENDOR" ]]; then echo "The 'Vendor' can not be empty" && exit 1; fi
read -p "Name: " NAME
if [[ -z "$NAME" ]]; then echo "The 'Name' can not be empty" && exit 1; fi
- TAB=" "
VENDOR="$(echo $VENDOR | tr '[:upper:]' '[:lower:]' | awk '{for(i=1;i<=NF;i++){ $i=toupper(substr($i,1,1)) substr($i,2) }}1' | tr -d '[:blank:]')";
CAMEL_NAME="$(echo $NAME | tr '[:upper:]' '[:lower:]' | awk '{for(i=1;i<=NF;i++){ $i=toupper(substr($i,1,1)) substr($i,2) }}1' | tr -d '[:blank:]')";
LOWER_NAME="$(tr '[:upper:][:blank:]' '[:lower:]-' <<< ${NAME})";
- MOD_PATH="app/code/$VENDOR/${CAMEL_NAME}"
if [[ $1 == "theme" ]]; then
- if [[ $SKIP == "false" ]]; then
- read -p "Folder (${LOWER_NAME}-theme) or: " FOLDER
- read -p "Parent (${VENDOR}/blank) or: " PARENT
- fi
-
- if [[ -z "$FOLDER" ]]; then FOLDER="${LOWER_NAME}-theme"; fi
- if [[ -z "$PARENT" ]]; then PARENT="${VENDOR}/blank"; fi
-
- MOD_PATH="app/design/frontend/$VENDOR/${FOLDER}"
- mkdir -p $MOD_PATH
-
- touch $MOD_PATH/registration.php &&
- echo -e "> $MOD_PATH/registration.php
-
- touch $MOD_PATH/theme.xml &&
- echo -e "\n${TAB}${VENDOR} ${CAMEL_NAME}\n${TAB}${PARENT}\n" >> $MOD_PATH/theme.xml
+ echo "No theme templates available yet"
else
- mkdir -p $MOD_PATH/etc
-
- touch $MOD_PATH/registration.php &&
- echo -e "> $MOD_PATH/registration.php
-
- touch $MOD_PATH/etc/module.xml &&
- echo -e "\n\n${TAB}\n${TAB}${TAB}\n${TAB}${TAB}${TAB}\n${TAB}${TAB}\n${TAB}\n" >> $MOD_PATH/etc/module.xml
+ mkdir -p $CREATE_SRC/$VENDOR/$LOWER_NAME &&
+ cd $CREATE_SRC/$VENDOR/$LOWER_NAME &&
+ git clone git@github.com:GrimLink/hyva-module-template.git . &&
+ rm -rf .git &&
+
+ echo ""
+ echo -e "${BLUE}${BOLD}Replace the following values with your own;${RESET}"
+ echo -e "${ITALIC}${RESET} (example: ${ITALIC}${VENDOR}${RESET})"
+ echo -e "${ITALIC}${RESET} (example: ${ITALIC}${CAMEL_NAME}${RESET})"
+ echo -e "${ITALIC}${RESET} (example: ${ITALIC}${LOWER_NAME}${RESET})"
fi
}
@@ -286,8 +282,8 @@ case "${@}" in
newMagentoMod "theme" "$3"
;;
-"new module")
- newMagentoMod "module"
+"new module"*)
+ newMagentoMod "module" "$3"
;;
"new"*)