diff options
author | Barbz <BarbzYHOOL@users.noreply.github.com> | 2018-12-19 18:03:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-19 18:03:27 +0100 |
commit | 51086f2dcd3c6490b0ff75978f2633e7aaf54126 (patch) | |
tree | 99ac1725ddaeda609b29759a50f9b1e5890f98bf | |
parent | 840642fa57471b757c38435443c7d172a67e65a8 (diff) |
Modules: Added create_module.sh script to kickstart module creation (#1071)
Helps people to create modules with the right base files.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | modules/create_module.sh | 105 | ||||
-rw-r--r-- | modules/how_to_make_a_module.md | 19 |
3 files changed, 123 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore index c458d4ff5b..726661ea70 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ apps/drassil/* env/dist/* env/user/* modules/* +!modules/*.md +!modules/*.sh build*/ var/* diff --git a/modules/create_module.sh b/modules/create_module.sh new file mode 100644 index 0000000000..3f2f638105 --- /dev/null +++ b/modules/create_module.sh @@ -0,0 +1,105 @@ +#!/bin/bash +## Just run it with bash or `git bash` on windows, and it will ask for the module's name and tada! +## By Barbz + +##------------------------------- VARIABLES ---------------------------------## + +MODULE_TEMPLATE_URL="https://github.com/azerothcore/skeleton-module/" +GIT_COMMIT_MSG_SETUP="setup_git_commit_template.sh" + +##------------------------------- CODE ---------------------------------## + +read -p "Enter the name of your future module: " "MODULE_NAME" +echo $MODULE_NAME | fgrep -q ' ' + +while [ $? -eq 0 ] +do + echo 'Blanks are not allowed!' + read -p "Enter the name of your future module: " MODULE_NAME + echo $MODULE_NAME | fgrep -q ' ' +done + +if test -n "$MODULE_NAME" +then + echo "--- Cloning 'skeleton-module' as $MODULE_NAME/" + git clone --depth 1 -b master $MODULE_TEMPLATE_URL $MODULE_NAME + + echo "--- Removing 'skeleton-module/.git/' history" + cd $MODULE_NAME && rm -rf .git/ + + echo "--- Init new git repository" + git init && git add -A && git commit -m "Initial commit - $MODULE_NAME" + + echo "--- Configure git for nice commit messages" + source $GIT_COMMIT_MSG_SETUP || bash $GIT_COMMIT_MSG_SETUP + + echo "--- Ready to code" +fi + + +# ## TODO Set the remote origin with username, repo url etc + + # $USER_NAME/$MODULE_NAME.git + + # echo "Do you want to set your git remote?" + # select yn in "Yes" "No"; do + # case $yn in + # Yes ) + # CONFIGURE_GIT=1; break;; + # No ) + # CONFIGURE_GIT=0; + # exit;; + # esac + # done + + + # if test "$CONFIGURE_GIT" == "1" + # then + # PS3='Where do you want to push your module?' + # options=("github.com" "gitlab.com" "bitbucket.org" "Quit") + # select opt in "${options[@]}" + # do + # case $opt in + # "github.com") + # echo "you chose choice 1" + # break + # ;; + # "gitlab.com") + # echo "you chose choice 2" + # break + # ;; + # "bitbucket.org") + # echo "you chose choice $REPLY which is $opt" + # break + # ;; + # "Quit") + # break + # ;; + # *) echo "invalid option $REPLY";; + # esac + # done + + # REMOTE_HOST="$opt" + + # PS3='HTTPS or SSH?' + # options=("HTTPS (default)" "SSH" "Quit") + # select opt in "${options[@]}" + # do + # case $opt in + # "HTTPS") + # echo "you chose choice 1" + # break + # ;; + # "SSH") + # echo "you chose choice $REPLY which is $opt" + # break + # ;; + # "Quit") + # break + # ;; + # *) echo "invalid option $REPLY";; + # esac + # done + + # REMOTE_PROTOCOL="$opt" + # fi diff --git a/modules/how_to_make_a_module.md b/modules/how_to_make_a_module.md index c16c0526ae..aed2a60094 100644 --- a/modules/how_to_make_a_module.md +++ b/modules/how_to_make_a_module.md @@ -1,7 +1,20 @@ -Read this page first: +# CREATE A NEW AZEROTHCORE MODULE + +1) Read this page first: https://github.com/azerothcore/azerothcore-wotlk/wiki/Create-a-Module -Then, start by cloning our skeleton-module: https://github.com/azerothcore/skeleton-module/ -Always clone it because we update it regularly +2) Run the script `create_module.sh`: +- If you're on windows, execute it with Git Bash (right click on it and choose Git bash) if you have installed Git extensions +- If you're on linux, just run it with bash or with ./create_module.sh + +This script will create the base of your module, with a clean history and add a git configuration option to this repository only (local config). + + +NOTE: You can also clone our skeleton-module manually, clean the history, and configure but you should use the script instead https://github.com/azerothcore/skeleton-module/ + + +3) Share it with the community! + +Join us on our discord, share it there, then we might fork it officially and it will appear in the module catalogue. |