forked from vaadin-learning-center/learning-content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.sh
executable file
·54 lines (46 loc) · 1.91 KB
/
create.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
#!/bin/sh
#Read profile data
. profile
echo "Profile:"
echo "$fullname"
echo "$id"
echo "$github"
echo "====================="
#Read new content name
echo "Please enter a name for the new content"
echo "e.g. Hello World Tutorial"
read name
content=$(echo "$name" | tr '[:upper:]' '[:lower:]' | tr " " -)
echo "Alright, creating content for $content.."
#Create Git branch
git branch "author/$github/$content"
git checkout "author/$github/$content"
#Create file structure
mkdir "tutorials/$content"
mkdir "tutorials/$content/images"
touch "tutorials/$content/article.properties"
touch "tutorials/$content/content.adoc"
#Fill default data
echo "title=$name" >> "tutorials/$content/article.properties"
echo "author=$fullname" >> "tutorials/$content/article.properties"
echo "author_id=$id" >> "tutorials/$content/article.properties"
echo "topics=<check topics.json>" >> "tutorials/$content/article.properties"
echo "#card_image=" >> "tutorials/$content/article.properties"
echo "= $name" >> "tutorials/$content/content.adoc"
echo "" >> "tutorials/$content/content.adoc"
echo ":type: text" >> "tutorials/$content/content.adoc"
echo ":tags: <check>, <allowed_tags.lst>, <foo>, <bar>" >> "tutorials/$content/content.adoc"
echo ":description: <put detailed description here>" >> "tutorials/$content/content.adoc"
echo ":repo:" >> "tutorials/$content/content.adoc"
echo ":linkattrs:" >> "tutorials/$content/content.adoc"
echo ":imagesdir: ./images" >> "tutorials/$content/content.adoc"
echo ":related_tutorials:" >> "tutorials/$content/content.adoc"
echo "" >> "tutorials/$content/content.adoc"
echo "<Write content here>" >> "tutorials/$content/content.adoc"
#Success
echo "======================"
echo "Please write your tutorial in tutorials/$content/content.adoc"
echo "IMPORTANT: Update topics value in tutorials/$content/article.properties"
echo "======================"
# Open editor
code "tutorials/$content/" "tutorials/$content/content.adoc"