b3869fcf7a88214143c1f40396b5e970840ae641
[releng.git] / jjb / genesis / build-docu.sh
1 #!/bin/bash
2 project="genesis"
3 export PATH=$PATH:/usr/local/bin/
4
5 files=()
6 while read -r -d ''; do
7       files+=("$REPLY")
8 done < <(find . -type f -iname '*.rst' -print0)
9
10 for file in "${{files[@]}}"; do
11
12   file_cut="${{file%.*}}"
13   gs_cp_folder="$(echo "$file"| cut -d "/" -f2,3)"
14
15   html_file=$file_cut".html"
16
17     echo "rst2html $file"
18     rst2html $file | gsutil cp -L gsoutput.txt - \
19     gs://artifacts.opnfv.org/"$project"/"$gs_cp_folder"/$(basename "$html_file")
20     gsutil setmeta -h "Content-Type:text/html" \
21                    -h "Cache-Control:private, max-age=0, no-transform" \
22                    gs://artifacts.opnfv.org/"$project"/"$gs_cp_folder"/$(basename "$html_file")
23     cat gsoutput.txt
24     rm -f gsoutput.txt
25
26   pdf_file="$file_cut"".pdf"
27
28     echo "rst2pdf $file"
29     rst2pdf "$file" -o - | gsutil cp -L gsoutput.txt - \
30     gs://artifacts.opnfv.org/"$project"/"$gs_cp_folder"/$(basename "$pdf_file")
31     gsutil setmeta -h "Content-Type:application/pdf" \
32                    -h "Cache-Control:private, max-age=0, no-transform" \
33                    gs://artifacts.opnfv.org/"$project"/"$gs_cp_folder"/$(basename "$pdf_file")
34     cat gsoutput.txt
35     rm -f gsoutput.txt
36
37 done
38