2012-03-08 18:05:47 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
try () {
|
|
|
|
"$@" || exit -1
|
|
|
|
}
|
|
|
|
|
2012-03-09 02:46:16 +01:00
|
|
|
. $(dirname $0)/environment.sh
|
|
|
|
|
2012-03-08 18:05:47 +01:00
|
|
|
APPNAME=$1
|
|
|
|
APPID=$(echo $APPNAME | tr '[A-Z]' '[a-z]')
|
|
|
|
TEMPLATESDIR=$(dirname $0)/templates/
|
2012-03-09 02:46:16 +01:00
|
|
|
APPDIR=$KIVYIOSROOT/app-$APPID
|
2012-03-08 18:05:47 +01:00
|
|
|
if [ "X$APPNAME" == "X" ]; then
|
|
|
|
echo $(basename $0) "<appname>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "-> Create $APPDIR directory"
|
|
|
|
try mkdir $APPDIR
|
|
|
|
|
|
|
|
echo "-> Copy templates"
|
|
|
|
try cp $TEMPLATESDIR/main.m $APPDIR/main.m
|
|
|
|
try cp $TEMPLATESDIR/icon.png $APPDIR/icon.png
|
|
|
|
try cp $TEMPLATESDIR/template-Info.plist $APPDIR/$APPID-Info.plist
|
|
|
|
try cp -a $TEMPLATESDIR/template.xcodeproj $APPDIR/$APPID.xcodeproj
|
|
|
|
|
|
|
|
echo "-> Customize templates"
|
|
|
|
try find $APPDIR -type f -exec sed -i '' "s/##APPID##/$APPID/g" {} \;
|
|
|
|
try find $APPDIR -type f -exec sed -i '' "s/##APPNAME##/$APPNAME/g" {} \;
|
|
|
|
|
|
|
|
echo "-> Done !"
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Your project is available at $APPDIR"
|
|
|
|
echo
|
|
|
|
echo "You can now type: open $APPDIR/$APPID.xcodeproj"
|
|
|
|
echo
|