Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create Xcode project from base project.
export LANG=C
# Check arguments
if [$# -ne 2 ]; then
echo "[Error]: 2 arguments are necessary."
echo "[Usage]: $0 TEMPLATE_NAME PROJECT_NAME"
exit 1
fi
# Parameters
templateName=$1
projectPath=$2
projectName=`basename $projectPath`
# Copy template
cp -R ~/Documents/xcode/Template/$templateName $projectPath
# Rename file and folder
paths=`find -d $projectPath -name "*$templateName*"`
for path in $paths
do
replacePath=`dirname $path`/`basename $path | sed "s/$templateName/$projectName/g"`
mv $path $replacePath
done
# Replace file texts
files=`find $projectPath -type f -print`
for file in $files
do
sed -i '' -e "s/$templateName/$projectName/g" $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.