6 if [ "$#" != "2" ];then
8 echo "usage: $0 <appname> <prefix>"
10 echo "appname is the title of the application to be generated"
11 echo "prefix is the prefix that will be appended to all files in"
12 echo "the application due to erlangs lack of a package structure. The prefix"
13 echo "is typicaly the first letter of each word in the name of the application"
15 echo "example: $0 chat_server cs"
21 APP_NAME_UPPER_CASE
=$
(echo $APP_NAME |
tr a-z A-Z
)
24 if [ -e ..
/..
/lib
/$APP_NAME ];then
25 echo "an application with name $APP_NAME already exists would you like to delete it [y|N] $> \c"
27 if [ "$DEL" != "y" ];then
28 echo "aborting application creation"
31 echo "deleting $APP_NAME"
32 rm -rf ..
/..
/lib
/$APP_NAME
39 cp -r blank_app
$APP_NAME
42 ls ba
* | ..
/..
/rename.sh ba
$PREFIX
43 ls blank_app
* | ..
/..
/rename.sh blank_app
$APP_NAME
46 # The base directory of the application
47 .
/substitute.sh
%%APP_NAME_UPPER_CASE
%% $APP_NAME_UPPER_CASE $APP_NAME/Makefile
48 .
/substitute.sh
%%APP_NAME_UPPER_CASE
%% $APP_NAME_UPPER_CASE $APP_NAME/vsn.mk
50 # The src directory of the application
51 .
/substitute.sh
%%APP_NAME
%% $APP_NAME $APP_NAME/src
/Makefile
52 .
/substitute.sh
%%APP_NAME_UPPER_CASE
%% $APP_NAME_UPPER_CASE $APP_NAME/src
/Makefile
53 .
/substitute.sh
%%PFX
%% $PREFIX $APP_NAME/src
/Makefile
56 mv $APP_NAME/include
/blank_app.hrl
$APP_NAME/include
/"$APP_NAME".hrl
58 mv $APP_NAME ..
/..
/lib
61 echo "$APP_NAME has been generated and placed under lib/$APP_NAME"