Christopher Piro | 094823a | 2007-07-18 00:26:12 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | |
| 4 | if [ $# -ne 2 ];then |
| 5 | echo "" |
| 6 | echo "usage: $0 <appname> <prefix>" |
| 7 | echo "" |
| 8 | echo "appname is the title of the application to be generated" |
| 9 | echo "prefix is the prefix that will be appended to all files in" |
| 10 | echo "the application due to erlangs lack of a package structure. The prefix" |
| 11 | echo "is typicaly the first letter of each word in the name of the application" |
| 12 | echo "" |
| 13 | echo "example: $0 chat_server cs" |
| 14 | echo "" |
| 15 | exit 1 |
| 16 | fi |
| 17 | |
| 18 | APP_NAME=$1 |
| 19 | APP_NAME_UPPER_CASE=$(echo $APP_NAME | tr a-z A-Z) |
| 20 | PREFIX=$2 |
| 21 | |
| 22 | cd ../.appgen |
| 23 | echo `pwd` |
| 24 | |
| 25 | cp -r blank_app $APP_NAME |
| 26 | cp -r blank_app_rel "$APP_NAME"_rel |
| 27 | |
| 28 | cd "$APP_NAME"_rel |
| 29 | ls blank_app* | ../rename.sh blank_app $APP_NAME |
| 30 | cd .. |
| 31 | |
| 32 | # The base directory of the release |
| 33 | ./substitute.sh %%APP_NAME%% $APP_NAME "$APP_NAME"_rel/"$APP_NAME"_rel.rel.src |
| 34 | |
| 35 | |
| 36 | cd $APP_NAME/src |
| 37 | ls ba* | ../../rename.sh ba $PREFIX |
| 38 | ls blank_app* | ../../rename.sh blank_app $APP_NAME |
| 39 | cd - |
| 40 | |
| 41 | # The base directory of the application |
| 42 | ./substitute.sh %%APP_NAME_UPPER_CASE%% $APP_NAME_UPPER_CASE $APP_NAME/Makefile |
| 43 | ./substitute.sh %%APP_NAME_UPPER_CASE%% $APP_NAME_UPPER_CASE $APP_NAME/vsn.mk |
| 44 | |
| 45 | # The src directory of the application |
| 46 | ./substitute.sh %%APP_NAME%% $APP_NAME $APP_NAME/src/Makefile |
| 47 | ./substitute.sh %%APP_NAME_UPPER_CASE%% $APP_NAME_UPPER_CASE $APP_NAME/src/Makefile |
| 48 | ./substitute.sh %%PFX%% $PREFIX $APP_NAME/src/Makefile |
| 49 | |
| 50 | ./substitute.sh %%APP_NAME%% $APP_NAME $APP_NAME/src/"$APP_NAME".erl |
| 51 | ./substitute.sh %%PFX%% $PREFIX $APP_NAME/src/"$APP_NAME".erl |
| 52 | ./substitute.sh %%PFX%% $PREFIX $APP_NAME/src/"$PREFIX"_sup.erl |
| 53 | ./substitute.sh %%APP_NAME%% $APP_NAME $APP_NAME/src/"$PREFIX"_sup.erl |
| 54 | ./substitute.sh %%PFX%% $PREFIX $APP_NAME/src/"$PREFIX"_server.erl |
| 55 | ./substitute.sh %%APP_NAME%% $APP_NAME $APP_NAME/src/"$PREFIX"_server.erl |
| 56 | |
| 57 | # include directory |
| 58 | mv $APP_NAME/include/blank_app.hrl $APP_NAME/include/"$APP_NAME".hrl |
| 59 | |
| 60 | find $APP_NAME -name ".svn" | xargs rm -r |
| 61 | mv $APP_NAME ../../lib |
| 62 | mv "$APP_NAME"_rel ../../release |
| 63 | |
| 64 | echo "" |
| 65 | echo "$APP_NAME has been generated and placed under lib/$APP_NAME" |
| 66 | echo $APP_NAME"_rel has been generated and placed under release/$APP_NAME""_rel" |
| 67 | echo "" |
| 68 | |
| 69 | cd ../utilities |