annotate iReport.sh @ 4:a4813532bbc6 draft

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