annotate iReport.sh @ 1:440f4aa3db97 draft

Added option to dowload iReports
author saskia-hiltemann
date Wed, 30 Jul 2014 07:03:43 -0400
parents ac5f9272033b
children e8755431a0cd
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 repositorypath="/mnt/galaxyTools/shed_tools/toolshed.nbic.nl/repos/saskia-hiltemann/ireport/71dc132e9bb2/ireport" # TODO: dependency
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3 source "${repositorypath}/createHTML.sh"
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 --toolpath) repositorypath=$2;shift;;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 --galaxypath) galaxypath=$2;shift;;
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34
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
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 ## Copy supporting files to output directory
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
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78 echo "done copying resource files"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 ls ${galaxypath}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 ## Create cover HTML page
1
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
83 makeIntroPage "$title" $coverimage "report.html" $htmlout iReport_${reportname}.zip
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
84
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
85 ## Create copy of cover page for downloadable version
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
86 makeIntroPage "$title" $coverimage "report.html" coverpage.html iReport_${reportname}.zip
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
87 cp coverpage.html ${galaxypath}/coverpage.html
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
88
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
89 ## Create Report page with tabs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
90 createMainPage ${galaxypath}/report.html "$tabs" "$items" $minwidth
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91
1
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
92
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
93 ## Create zip file of this iReport for download by user
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
94 wd=`pwd`
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
95 cd ${galaxypath}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
96 zip -r iReport_${reportname} .
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
97 cd $wd
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents: 0
diff changeset
98