|
1 |
| -#!/bin/bash |
2 |
| - |
3 |
| -echo "Prepare docs..." |
4 |
| -echo "Update contributing page" |
5 |
| -cp CONTRIBUTING.md docs/content/contributing/contributing.md |
6 |
| -sed -i '1d' docs/content/contributing/contributing.md |
7 |
| -sed -i '1i ---' docs/content/contributing/contributing.md |
8 |
| -sed -i '1i weight: 9010' docs/content/contributing/contributing.md |
9 |
| -sed -i '1i title: Contributing to Project Flogo' docs/content/contributing/contributing.md |
10 |
| -sed -i '1i ---' docs/content/contributing/contributing.md |
11 |
| - |
12 |
| -echo "Updating the frontpage" |
13 |
| -cp README.md docs/content/introduction/_index.md |
14 |
| -sed -i '1,4d' docs/content/introduction/_index.md |
15 |
| -sed -i '5,18d' docs/content/introduction/_index.md |
16 |
| -sed -i '1i ---' docs/content/introduction/_index.md |
17 |
| -sed -i '1i pre: "<i class=\\"fa fa-home\\" aria-hidden=\\"true\\"></i> "' docs/content/introduction/_index.md |
18 |
| -sed -i '1i weight: 1000' docs/content/introduction/_index.md |
19 |
| -sed -i '1i title: Introduction' docs/content/introduction/_index.md |
20 |
| -sed -i '1i ---' docs/content/introduction/_index.md |
21 |
| -sed -i 's#images/flogo-web2.gif#https://raw.githubusercontent.com/TIBCOSoftware/flogo/master/images/flogo-web2.gif#g' docs/content/introduction/_index.md |
22 |
| -sed -i 's#images/flogo-cli.gif#https://raw.githubusercontent.com/TIBCOSoftware/flogo/master/images/flogo-cli.gif#g' docs/content/introduction/_index.md |
23 |
| - |
24 |
| -echo "Getting the docs for the activities and triggers" |
25 |
| -git clone https://github.com/TIBCOSoftware/flogo-contrib |
26 |
| -for i in `find flogo-contrib/activity -name \*.md` ; do filename=$(basename $(dirname $i)); cp $i docs/content/development/webui/activities/$filename.md; done; |
27 |
| -for i in `find flogo-contrib/trigger -name \*.md` ; do filename=$(basename $(dirname $i)); cp $i docs/content/development/webui/triggers/$filename.md; done; |
28 |
| -rm -rf flogo-contrib |
29 |
| - |
30 |
| -echo "Getting the docs for the commandline tools" |
31 |
| -curl -o docs/content/flogo-cli/flogo-cli.md https://raw.githubusercontent.com/TIBCOSoftware/flogo-cli/master/docs/flogo-cli.md |
32 |
| -curl -o docs/content/flogo-cli/flogodevice-cli.md https://raw.githubusercontent.com/TIBCOSoftware/flogo-cli/master/docs/flogodevice-cli.md |
33 |
| -curl -o docs/content/flogo-cli/flogogen-cli.md https://raw.githubusercontent.com/TIBCOSoftware/flogo-cli/master/docs/flogogen-cli.md |
34 |
| -curl -o docs/content/flogo-cli/tools-overview.md https://raw.githubusercontent.com/TIBCOSoftware/flogo-cli/master/docs/tools-overview.md |
35 |
| - |
36 |
| -echo "Build docs site..." |
37 |
| -cd docs && hugo |
38 |
| -cd ../showcases && hugo |
39 |
| -mv public ../docs/public/showcases |
40 |
| -cd ../docs |
41 |
| -cd public && ls -alh |
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Description: Build script for Project Flogo documentation |
| 4 | +# Author: retgits <https://github.com/retgits> |
| 5 | +# Last Updated: 2018-08-03 |
| 6 | + |
| 7 | +#--- Variables --- |
| 8 | +HUGO_VERSION=0.45 |
| 9 | + |
| 10 | +#--- Download and install prerequisites --- |
| 11 | +prerequisites() { |
| 12 | + wget -O hugo.tar.gz https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz |
| 13 | + mkdir -p hugobin |
| 14 | + tar -xzvf hugo.tar.gz -C ./hugobin |
| 15 | + mv ./hugobin/hugo $HOME/gopath/bin |
| 16 | + rm hugo.tar.gz && rm -rf ./hugobin |
| 17 | +} |
| 18 | + |
| 19 | +#--- Get external docs --- |
| 20 | +ext_docs() { |
| 21 | + echo "Getting the docs for the activities and triggers" |
| 22 | + git clone https://github.com/TIBCOSoftware/flogo-contrib |
| 23 | + for i in `find flogo-contrib/activity -name \*.md` ; do filename=$(basename $(dirname $i)); cp $i docs/content/development/webui/activities/$filename.md; done; |
| 24 | + for i in `find flogo-contrib/trigger -name \*.md` ; do filename=$(basename $(dirname $i)); cp $i docs/content/development/webui/triggers/$filename.md; done; |
| 25 | + rm -rf flogo-contrib |
| 26 | + |
| 27 | + echo "Getting the docs for the commandline tools" |
| 28 | + curl -o docs/content/flogo-cli/flogo-cli.md https://raw.githubusercontent.com/TIBCOSoftware/flogo-cli/master/docs/flogo-cli.md |
| 29 | + curl -o docs/content/flogo-cli/flogodevice-cli.md https://raw.githubusercontent.com/TIBCOSoftware/flogo-cli/master/docs/flogodevice-cli.md |
| 30 | + curl -o docs/content/flogo-cli/flogogen-cli.md https://raw.githubusercontent.com/TIBCOSoftware/flogo-cli/master/docs/flogogen-cli.md |
| 31 | + curl -o docs/content/flogo-cli/tools-overview.md https://raw.githubusercontent.com/TIBCOSoftware/flogo-cli/master/docs/tools-overview.md |
| 32 | + |
| 33 | + echo "Getting interactive labs" |
| 34 | + git clone https://github.com/retgits/katacoda-scenarios |
| 35 | + for i in `find katacoda-scenarios -name \*interactive-lab.md` ; do filename=$(basename $i); title=`echo | awk 'NR==2 {print;exit}' $i`; link=`echo | awk 'NR==3 {print;exit}' $i`; echo "<div class=\"card\"><div class=\"card-header bg3\"><img class=\"card-image\" src=\"../images/labs/047-safety-glasses.svg\" alt=\"Share\" /></div><div class=\"card-content\"><p class=\"card-text\">${title:7}</p><a class=\"card-start\" href=\"${link:5}\" target=\"_blank\" alt=\"Start\">Start!</a></div></div>" >> docs/content/labs/_index.md ; done; |
| 36 | + echo "</div>" >> docs/content/labs/_index.md |
| 37 | + rm -rf katacoda-scenarios |
| 38 | +} |
| 39 | + |
| 40 | +#--- Update contributions page --- |
| 41 | +update_page_contrib() { |
| 42 | + echo "Update contributing page" |
| 43 | + cp CONTRIBUTING.md docs/content/contributing/contributing.md |
| 44 | + sed -i '1d' docs/content/contributing/contributing.md |
| 45 | + sed -i '1i ---' docs/content/contributing/contributing.md |
| 46 | + sed -i '1i weight: 9010' docs/content/contributing/contributing.md |
| 47 | + sed -i '1i title: Contributing to Project Flogo' docs/content/contributing/contributing.md |
| 48 | + sed -i '1i ---' docs/content/contributing/contributing.md |
| 49 | +} |
| 50 | + |
| 51 | +#--- Update introduction page --- |
| 52 | +update_page_introduction() { |
| 53 | + cp README.md docs/content/introduction/_index.md |
| 54 | + sed -i '1,4d' docs/content/introduction/_index.md |
| 55 | + sed -i '5,18d' docs/content/introduction/_index.md |
| 56 | + sed -i '1i ---' docs/content/introduction/_index.md |
| 57 | + sed -i '1i pre: "<i class=\\"fa fa-home\\" aria-hidden=\\"true\\"></i> "' docs/content/introduction/_index.md |
| 58 | + sed -i '1i weight: 1000' docs/content/introduction/_index.md |
| 59 | + sed -i '1i title: Introduction' docs/content/introduction/_index.md |
| 60 | + sed -i '1i ---' docs/content/introduction/_index.md |
| 61 | + sed -i 's#images/flogo-web2.gif#https://raw.githubusercontent.com/TIBCOSoftware/flogo/master/images/flogo-web2.gif#g' docs/content/introduction/_index.md |
| 62 | + sed -i 's#images/flogo-cli.gif#https://raw.githubusercontent.com/TIBCOSoftware/flogo/master/images/flogo-cli.gif#g' docs/content/introduction/_index.md |
| 63 | +} |
| 64 | + |
| 65 | +#--- Update page --- |
| 66 | +update_page() { |
| 67 | + case "$1" in |
| 68 | + "contributing") |
| 69 | + update_page_contrib |
| 70 | + ;; |
| 71 | + "introduction") |
| 72 | + update_page_introduction |
| 73 | + ;; |
| 74 | + *) |
| 75 | + echo "Updating all pages" |
| 76 | + update_page_contrib |
| 77 | + update_page_introduction |
| 78 | + esac |
| 79 | +} |
| 80 | + |
| 81 | +#--- Execute build --- |
| 82 | +build() { |
| 83 | + echo "Build docs site..." |
| 84 | + cd docs && hugo |
| 85 | + cd ../showcases && hugo |
| 86 | + mv public ../docs/public/showcases |
| 87 | + cd ../docs |
| 88 | + cd public && ls -alh |
| 89 | +} |
| 90 | + |
| 91 | + |
| 92 | +case "$1" in |
| 93 | + "prerequisites") |
| 94 | + prerequisites |
| 95 | + ;; |
| 96 | + "ext-docs") |
| 97 | + ext_docs |
| 98 | + ;; |
| 99 | + "update-page") |
| 100 | + update_page $2 |
| 101 | + ;; |
| 102 | + "build") |
| 103 | + build |
| 104 | + ;; |
| 105 | + *) |
| 106 | + echo "The target {$1} you want to execute doesn't exist" |
| 107 | +esac |
0 commit comments