Last active
December 19, 2017 01:25
-
-
Save krimpedance/c670b71a6244a758cde2f5dfbaf5cb73 to your computer and use it in GitHub Desktop.
Create Xcode project from base project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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