Modules: Added create_module.sh script to kickstart module creation (#1071)

Helps people to create modules with the right base files.
This commit is contained in:
Barbz 2018-12-19 18:03:27 +01:00 committed by GitHub
parent 840642fa57
commit 51086f2dcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 123 additions and 3 deletions

2
.gitignore vendored
View file

@ -8,6 +8,8 @@ apps/drassil/*
env/dist/*
env/user/*
modules/*
!modules/*.md
!modules/*.sh
build*/
var/*

105
modules/create_module.sh Normal file
View file

@ -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

View file

@ -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.