-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.sh
executable file
·31 lines (27 loc) · 942 Bytes
/
generate.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
remote_url=$(git remote get-url origin)
repo_name=$(basename -s .git $remote_url)
repo_path=$(dirname $remote_url)
author_handle=${repo_path##*:}
author_handle=${author_handle##*/}
executable_name=$(echo $repo_name | perl -pe 's/(^|-|_| |%20)(\w)/uc($2)/ge' )
author_name=$(git config user.name)
author_email=$(git config user.email)
for path in $(find . -type d -path "*EXECUTABLE-NAME*")
do
mv $path ${path//EXECUTABLE-NAME/$executable_name}
done
for path in $(find . -type f ! -path "./.*/*" ! -name "./generate.sh" ! -name ".DS_Store")
do
sed -i "" -e "s/AUTHOR-HANDLE/$author_handle/g" $path
sed -i "" -e "s/AUTHOR-NAME/$author_name/g" $path
sed -i "" -e "s/AUTHOR-EMAIL/$author_email/g" $path
sed -i "" -e "s/EXECUTABLE-NAME/$executable_name/g" $path
if [[ $path =~ "EXECUTABLE-NAME" ]]
then
mv $path ${path//EXECUTABLE-NAME/$executable_name}
fi
done
swift test
swift run
open Package.swift
rm -rf ./generate.sh