-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlaunchNewProject.sh
executable file
·67 lines (50 loc) · 1.99 KB
/
launchNewProject.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash -e
if [ -z "$1" ]
then
echo "Please supply a Project Name when running this script."
exit 1
fi
TEMPLATE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_NAME=$1
PROJECT_DIR="$TEMPLATE_DIR/../$PROJECT_NAME"
if [ -d "$PROJECT_DIR" ]; then
echo "A Project already exists at $PROJECT_DIR"
exit 1
fi
mkdir "$PROJECT_DIR"
cd "$PROJECT_DIR"
echo
echo "Creating new project at: $(pwd)"
cp -fr $TEMPLATE_DIR/BlueRocketFuelAppTests \
$TEMPLATE_DIR/BlueRocketFuelApp \
$TEMPLATE_DIR/BlueRocketFuelApp.xcodeproj \
$TEMPLATE_DIR/config.json \
$TEMPLATE_DIR/strings.json \
$TEMPLATE_DIR/Podfile \
.
/usr/bin/sed -i "" s/BlueRocketFuelApp/$PROJECT_NAME/g BlueRocketFuelApp.xcodeproj/project.pbxproj
/usr/bin/sed -i "" s/BlueRocketFuelApp/$PROJECT_NAME/g BlueRocketFuelApp.xcodeproj/xcshareddata/xcschemes/BlueRocketFuelApp.xcscheme
/usr/bin/sed -i "" s/BlueRocketFuelApp/$PROJECT_NAME/g BlueRocketFuelApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
/usr/bin/sed -i "" s/BlueRocketFuelApp/$PROJECT_NAME/g BlueRocketFuelAppTests/BlueRocketFuelAppTests.m
/usr/bin/sed -i "" s/\'BlueRocketFuelApp\'/\'$PROJECT_NAME\'/g Podfile
cd BlueRocketFuelApp.xcodeproj/xcshareddata/xcschemes/
mv -f BlueRocketFuelApp.xcscheme "$PROJECT_NAME.xcscheme"
cd "$PROJECT_DIR"
mv -f BlueRocketFuelAppTests/BlueRocketFuelAppTests.m "BlueRocketFuelAppTests/${PROJECT_NAME}Tests.m"
mv -f BlueRocketFuelAppTests "${PROJECT_NAME}Tests"
mv -f BlueRocketFuelApp "$PROJECT_NAME"
mv -f BlueRocketFuelApp.xcodeproj "$PROJECT_NAME.xcodeproj"
cd "$PROJECT_NAME.xcodeproj"
rm -rf xcuserdata
rm -rf project.xcworkspace/xcuserdata
echo
echo "Configuring BlueRocketFuelCore as a CocoaPod..."
cd "$PROJECT_DIR"
pod install
echo
echo "Initializing git repository and performing initial commit..."
git init
git add --all
git commit -am "Initial Commit using BlueRocketFuelApp starter app."
echo "Your new app is ready to go. Always use $PROJECT_NAME.xcworkspace to open the project."
open -a Xcode "$PROJECT_NAME.xcworkspace"