cedric pushed a commit to branch master. http://git.enlightenment.org/tools/skeleton.git/commit/?id=f44916e6d04224eb711cb7fed81f0bc0f464696e
commit f44916e6d04224eb711cb7fed81f0bc0f464696e Author: Sanjeev BA <iamsanj...@gmail.com> Date: Thu Apr 27 10:35:35 2017 -0700 update readme and add new script. Summary: Signed-off-by: Sanjeev BA <iamsanj...@gmail.com> Test Plan: eflprg script does a good job but after creating it - there is much pain. It creates a folder and clones skeleton into it, find and replaces incorrectly and finally user need to either move the directory or know where to create it before hand. makeprg.sh does away with most of it. It replaces cedric string in the same folder. and renames the same folder to the project name. Picks up git user and email from gitconfig and uses it. Also adds user to authors file. Reviewers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4829 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- README | 8 +++++++ makeprj.sh | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/README b/README index e69de29..f9d975d 100644 --- a/README +++ b/README @@ -0,0 +1,8 @@ +Two scripts to help you create projects + +1. usage : ./eflprj proj_path proj_name usr_name usr_email www (without http:// !!) + +2. usage : ./makeprj.sh proj_name [www] +Project name is mandatory. +Picks up email and name from git config. +www site address is optional. Defaults to www.enlightenment.org diff --git a/makeprj.sh b/makeprj.sh new file mode 100755 index 0000000..8fb8f25 --- /dev/null +++ b/makeprj.sh @@ -0,0 +1,78 @@ +#! /bin/bash + +if [ $# -lt 1 ]; then + echo "usage : $0 proj_name [www]" + echo "Project name is mandatory." + exit 1 +fi + +SELF=$(readlink -f $0) +SRC=${SELF%/*} +echo $SELF $SRC + +PROJ=$1 +NAME=`git config user.name` +if [ "$?" -eq 1 ] +then + echo "Setup git username first." + echo "git config --global user.name "Your Name"" + exit 1 +fi + +EMAIL=`git config user.email` +if [ "$?" -eq 1 ] +then + echo "Setup git email first." + echo "git config --global user.email "y...@example.com"" + exit 1 +fi + +if [ -z "$NAME" ] +then + NAME="Enlightenment" +fi + +if [ -z "$EMAIL" ] +then + NAME="enlightenment-devel@lists.sourceforge.net" +fi + +if [ -z "$2" ] +then + WWW="www.enlightenment.org" +else + WWW=$2 +fi + +SELF=$(readlink -f $0) +SRC=${SELF%/*} + +PROJ_U=$(echo "$PROJ" | sed 's/.*/\u&/') +PROJ_UU=$(echo "$PROJ" | sed 's/.*/\U&/') +PROJ_LL=$(echo "$PROJ" | sed 's/.*/\L&/') +rm -fr .git || exit 1 +git init && git add . &> /dev/null && git commit -sa -m "Initial commit." &> /dev/null || exit 1 + +echo "" > description +for file in $(git ls-files); do + [ "$file" = "makeprj.sh" ] && continue + [ "$file" = "eflprj" ] && continue + echo "$file" | grep -qE '^m4' && continue + sed -i "s/skeleton/${PROJ_LL}/g;s/Skeleton/${PROJ_U}/g;s/SKELETON/${PROJ_UU}/g;s/www.enlightenment.org/${WWW}/g;" $file + sed -i "s/Cedric\ Bail/${NAME}/g;s/cedric\.bail@samsung\.com/${EMAIL}/g;s/Cedric\ BAIL/${NAME}/g;" $file +done +for file in $(find -name '*skeleton*'); do + name=$(echo "$file" | sed "s/skeleton/${PROJ_LL}/") + mv $file $name +done +for file in $(find -name '*Skeleton*'); do + name=$(echo "$file" | sed "s/Skeleton/${PROJ_U}/") + mv $file $name +done +echo $NAME "<$EMAIL>" >> AUTHORS +grep --color=auto -R FIXME . + +mv $PWD ${PWD%/*}/$PROJ +echo "Execute : cd ${PWD%/*}/$PROJ" +exit 0 + --