forked from ochococo/OOD-Principles-In-Swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-playground.sh
executable file
·30 lines (19 loc) · 1 KB
/
generate-playground.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
#!/bin/bash
rm ./contents.swift
rm ./OOD-Principles-In-Swift.playground.zip
cat ./source/header.swift > ./contents.swift
cat ./source/srp.swift >> ./contents.swift
cat ./source/ocp.swift >> ./contents.swift
cat ./source/lsp.swift >> ./contents.swift
cat ./source/isp.swift >> ./contents.swift
cat ./source/dip.swift >> ./contents.swift
cat ./source/footer.swift >> ./contents.swift
cp ./contents.swift ./OOD-Principles-In-Swift.playground/contents.swift
{ rm contents.swift && awk '{gsub("\\*//\\*:", "", $0); print}' > contents.swift; } < contents.swift
{ rm contents.swift && awk '{gsub("/\\*:", "```\n", $0); print}' > contents.swift; } < contents.swift
{ rm contents.swift && awk '{gsub("\\*/", "\n```swift", $0); print}' > contents.swift; } < contents.swift
{ rm contents.swift && awk 'NR>1{print buf}{buf = $0}' > contents.swift; } < contents.swift
echo "\`\`\`swift
$(cat ./contents.swift)" > ./README.md
zip -r -X OOD-Principles-In-Swift.playground.zip ./OOD-Principles-In-Swift.playground
rm ./contents.swift