blob: b619222b6eaf968c483f9f94c9da87c5468f09c7 [file] [log] [blame]
Christopher Piro094823a2007-07-18 00:26:12 +00001#!/bin/sh
2
3
4if [ $# -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
16fi
17
18APP_NAME=$1
19APP_NAME_UPPER_CASE=$(echo $APP_NAME | tr a-z A-Z)
20PREFIX=$2
21
22cd ../.appgen
23echo `pwd`
24
25cp -r blank_app $APP_NAME
26cp -r blank_app_rel "$APP_NAME"_rel
27
28cd "$APP_NAME"_rel
29ls blank_app* | ../rename.sh blank_app $APP_NAME
30cd ..
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
36cd $APP_NAME/src
37ls ba* | ../../rename.sh ba $PREFIX
38ls blank_app* | ../../rename.sh blank_app $APP_NAME
39cd -
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
58mv $APP_NAME/include/blank_app.hrl $APP_NAME/include/"$APP_NAME".hrl
59
60find $APP_NAME -name ".svn" | xargs rm -r
61mv $APP_NAME ../../lib
62mv "$APP_NAME"_rel ../../release
63
64echo ""
65echo "$APP_NAME has been generated and placed under lib/$APP_NAME"
66echo $APP_NAME"_rel has been generated and placed under release/$APP_NAME""_rel"
67echo ""
68
69cd ../utilities