-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscaffold
More file actions
43 lines (34 loc) · 839 Bytes
/
scaffold
File metadata and controls
43 lines (34 loc) · 839 Bytes
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
#!/usr/bin/env bash
set -e
shopt -s extglob
shopt -s globstar
shopt -s nullglob
print_help() {
cat <<EOF
usage: scaffold <element name>
EOF
exit 1
}
if (($# < 1)); then
print_help
fi
name=$1
author_name=$(git config --global user.name)
author_email=$(git config --global user.email)
if [[ -z "$author_name" || -z "$author_email" ]]; then
echo "Please set your git global user details"
echo "Run following commands"
echo "git config --global user.name <your name>"
echo "git config --global user.email <your email>"
fi
author="$author_name <$author_email>"
cp -r "$UTIL_INSTALL_DIR"/scaffold-element ./"$name"
for file in ./"$name"/**/*
do
if [[ -f "$file" ]]; then
sed -i "s:%name%:$name:g" "$file"
sed -i "s:%author%:$author:g" "$file"
echo "scaffold: $file"
fi
done
mv ./"$name"/el-name.html ./"$name/$name".html