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
|
2012-04-18 02:58:40 +02:00
|
|
|
SRCDIR=$2
|
2012-03-08 18:05:47 +01:00
|
|
|
APPID=$(echo $APPNAME | tr '[A-Z]' '[a-z]')
|
|
|
|
TEMPLATESDIR=$(dirname $0)/templates/
|
2012-03-09 02:46:16 +01:00
|
|
|
APPDIR=$KIVYIOSROOT/app-$APPID
|
2013-08-26 23:39:35 +02:00
|
|
|
OLD_LC_CTYPE=$LC_CTYPE
|
2013-08-27 14:05:56 +02:00
|
|
|
OLD_LANG=$LANG
|
|
|
|
|
2013-08-26 23:39:35 +02:00
|
|
|
# fix for -> sed: RE error: illegal byte sequence
|
2013-08-27 14:05:56 +02:00
|
|
|
LC_CTYPE=C
|
|
|
|
LANG=C
|
2013-08-26 23:39:35 +02:00
|
|
|
|
2012-03-08 18:05:47 +01:00
|
|
|
if [ "X$APPNAME" == "X" ]; then
|
2012-04-18 02:58:40 +02:00
|
|
|
echo $(basename $0) "<appname> <source directory>"
|
2012-03-08 18:05:47 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2012-04-18 02:58:40 +02:00
|
|
|
if [ "X$SRCDIR" == "X" ]; then
|
|
|
|
echo $(basename $0) "<appname> <source directory>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2012-03-08 18:05:47 +01:00
|
|
|
echo "-> Create $APPDIR directory"
|
|
|
|
try mkdir $APPDIR
|
|
|
|
|
|
|
|
echo "-> Copy templates"
|
|
|
|
try cp $TEMPLATESDIR/main.m $APPDIR/main.m
|
2013-09-04 01:53:33 +02:00
|
|
|
try cp $TEMPLATESDIR/bridge.h $APPDIR/bridge.h
|
|
|
|
try cp $TEMPLATESDIR/bridge.m $APPDIR/bridge.m
|
2012-03-08 18:05:47 +01:00
|
|
|
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"
|
2013-09-27 14:38:31 +02:00
|
|
|
try find $APPDIR -type f -not -iname *.png -exec sed -i '' "s/##APPID##/$APPID/g" {} \;
|
|
|
|
try find $APPDIR -type f -not -iname *.png -exec sed -i '' "s/##APPNAME##/$APPNAME/g" {} \;
|
|
|
|
try find $APPDIR -type f -not -iname *.png -exec sed -i '' "s/##SDKVER##/$SDKVER/g" {} \;
|
|
|
|
try find $APPDIR -type f -not -iname *.png -exec sed -i '' "s^##SRCDIR##^$SRCDIR^g" {} \;
|
2012-03-08 18:05:47 +01:00
|
|
|
|
2013-08-26 23:39:35 +02:00
|
|
|
LC_CTYPE=$OLD_LC_CTYPE
|
2013-08-27 14:05:56 +02:00
|
|
|
LANG=$OLD_LANG
|
2012-03-08 18:05:47 +01:00
|
|
|
|
|
|
|
echo "-> Done !"
|
|
|
|
echo
|
|
|
|
echo "Your project is available at $APPDIR"
|
|
|
|
echo
|
|
|
|
echo "You can now type: open $APPDIR/$APPID.xcodeproj"
|
|
|
|
echo
|