0
|
1 #!/bin/bash
|
2
|
2 #repositorypath="/mnt/galaxyTools/shed_tools/toolshed.nbic.nl/repos/saskia-hiltemann/ireport/71dc132e9bb2/ireport" # TODO: dependency
|
3
|
3
|
0
|
4
|
|
5 echo "allparams: $@"
|
|
6 function usage() { echo "Oops!"; }
|
|
7
|
|
8
|
|
9 # set some defaults
|
|
10
|
|
11
|
|
12 set -- `getopt -n$0 -u -a --longoptions="ifusepath: galaxypath: tab: item: htmlout: label: toolpath: minwidth: coverimage:" "h:" "$@"` || usage
|
|
13 [ $# -eq 0 ] && usage
|
|
14
|
|
15 while [ $# -gt 0 ]
|
|
16 do
|
|
17 case "$1" in
|
2
|
18 --toolpath) repositorypath=$2;shift;;
|
|
19 --galaxypath) galaxypath=$2;shift;;
|
0
|
20 --minwidth) minwidth=$2;shift;;
|
|
21 --tab) tabs+=",$2";shift;;
|
|
22 --item) items+=",$2";shift;;
|
|
23 --htmlout) htmlout=$2;shift;;
|
|
24 --label) title="$@";shift;;
|
|
25 --coverimage) coverimage=$2;shift;;
|
|
26 -h) shift;;
|
|
27 --) shift;break;;
|
|
28 -*) usage;;
|
|
29 *) break;;
|
|
30 esac
|
|
31 shift
|
|
32 done
|
|
33
|
3
|
34 source "${repositorypath}/createHTML.sh"
|
0
|
35 mkdir $galaxypath
|
|
36
|
|
37 tabs=${tabs//,/ }; tabs=${tabs/ /}
|
|
38 items=${items//,/ }; items=${items/ /}
|
|
39 title=${title//--/}
|
|
40 title=${title//label/}
|
1
|
41
|
|
42 reportname=${title// /}
|
|
43
|
0
|
44 echo -e "\n"
|
|
45 echo -e "title: $title"
|
|
46 echo -e "tabs: $tabs"
|
|
47 echo -e "items: $items"
|
|
48 echo -e "htmlout: $htmlout"
|
|
49 echo -e "coverimage: $coverimage"
|
|
50 echo -e "\n"
|
|
51
|
|
52 for i in $tabs
|
|
53 do
|
|
54 echo "tabname: $i"
|
|
55 done
|
|
56
|
|
57 coverimage=${coverimage:1}
|
|
58 echo -e "coverimage2: $coverimage"
|
|
59
|
|
60 #if no coverimage provided, use default EMC logo
|
|
61 if [[ -z $coverimage ]]
|
|
62 then
|
|
63 cp $repositorypath/intro.jpg ${galaxypath}/intro.jpg
|
|
64 coverimage="intro.jpg"
|
|
65 fi
|
|
66 echo -e "coverimage3: $coverimage"
|
|
67
|
4
|
68 ## Copy supporting files from repository to output directory
|
0
|
69 cp ${repositorypath}/jquery.dataTables.css ${galaxypath}/jquery.dataTables.css
|
|
70 cp ${repositorypath}/jquery.dataTables.js ${galaxypath}/jquery.dataTables.js
|
|
71 cp -R ${repositorypath}/iframe-resizer/ ${galaxypath}/iframe-resizer/
|
|
72 cp -R ${repositorypath}/DataTables-1.9.4/ ${galaxypath}/DataTables-1.9.4/
|
|
73 cp ${repositorypath}/jquery.zoom.js ${galaxypath}/jquery.zoom.js
|
1
|
74 cp ${repositorypath}/jquery-ui.css ${galaxypath}/jquery-ui.css
|
|
75 cp ${repositorypath}/jquery-1.10.2.js ${galaxypath}/jquery-1.10.2.js
|
|
76 cp ${repositorypath}/jquery-ui.js ${galaxypath}/jquery-ui.js
|
4
|
77 cp ${repositorypath}/md.css ${galaxypath}/md.css
|
|
78 cp ${repositorypath}/ireport_css.css ${galaxypath}/ireport_css.css
|
|
79 cp ${repositorypath}/ireport_jquery.js ${galaxypath}/ireport_jquery.js
|
0
|
80
|
|
81 echo "done copying resource files"
|
|
82 ls ${galaxypath}
|
|
83
|
|
84
|
|
85 ## Create cover HTML page
|
1
|
86 makeIntroPage "$title" $coverimage "report.html" $htmlout iReport_${reportname}.zip
|
|
87
|
|
88 ## Create copy of cover page for downloadable version
|
|
89 makeIntroPage "$title" $coverimage "report.html" coverpage.html iReport_${reportname}.zip
|
|
90 cp coverpage.html ${galaxypath}/coverpage.html
|
0
|
91
|
|
92 ## Create Report page with tabs
|
|
93 createMainPage ${galaxypath}/report.html "$tabs" "$items" $minwidth
|
|
94
|
1
|
95
|
|
96 ## Create zip file of this iReport for download by user
|
|
97 wd=`pwd`
|
|
98 cd ${galaxypath}
|
|
99 zip -r iReport_${reportname} .
|
|
100 cd $wd
|
|
101
|