-
Notifications
You must be signed in to change notification settings - Fork 0
/
new-holi-project.sh
executable file
·51 lines (39 loc) · 1.35 KB
/
new-holi-project.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
#!/usr/bin/env bash
echo "---------------------"
echo "New holi project"
echo "---------------------"
echo ""
echo "Enter a project name (e.g. company-calendars):"
read -r PROJECT_NAME
if [ -z "$PROJECT_NAME" ]
then
echo "Project name cannot be empty"
echo ""
exit 1
fi
echo "Enter your namespace (e.g. com.yourcompany):"
read -r NAMESPACE
if [ -z "$NAMESPACE" ]
then
echo "Namespace cannot be empty"
echo ""
exit 1
fi
echo ""
echo "Downloading template..."
curl -LO https://github.com/luciolucio/holi/raw/1.1.0/resources/holi-template.zip
echo ""
echo "Decompressing template..."
unzip holi-template.zip
mv holi-template "$PROJECT_NAME"
sed -i '' "s/{{lib-name}}/$PROJECT_NAME/g" "$PROJECT_NAME/README.md" "$PROJECT_NAME/gen-lib.sh" "$PROJECT_NAME/resources/calendars.cljc" "$PROJECT_NAME/resources/build.clj"
sed -i '' "s/{{lib-ns}}/$NAMESPACE/g" "$PROJECT_NAME/resources/calendars.cljc" "$PROJECT_NAME/resources/build.clj"
NAMESPACE_UNDERSCORED="${NAMESPACE//-/_}"
FULL_PATH="$PROJECT_NAME/resources/src/${NAMESPACE_UNDERSCORED//\.//}"
PROJECT_NAME_UNDERSCORED="${PROJECT_NAME//-/_}"
mkdir -p "$FULL_PATH"
mv "$PROJECT_NAME/resources/calendars.cljc" "$FULL_PATH/$PROJECT_NAME_UNDERSCORED.cljc"
chmod a+x "$PROJECT_NAME/gen-lib.sh"
mkdir "$PROJECT_NAME/calendars"
echo ""
echo "Project successfully generated at $PROJECT_NAME/"