@@ -7,7 +7,7 @@ vim: syntax=groovy
7
7
= C O M P I L E - B E A M E R =
8
8
================================================================================
9
9
@Author
10
- Maxime Garcia <max@ithake.eu > [@MaxUlysse]
10
+ Maxime Garcia <max[email protected] > [@MaxUlysse]
11
11
--------------------------------------------------------------------------------
12
12
@Homepage
13
13
https://github.com/MaxUlysse/compile-beamer
25
25
================================================================================
26
26
*/
27
27
28
+ if (! nextflow. version. matches(' >= 0.25.0' )) {exit 1 , " Nextflow version 0.25.0 or greater is needed to run this workflow" }
29
+
28
30
version = ' 1.5'
29
31
30
32
switch (params) {
31
- case {params. help} :
32
- helpMessage(version, grabRevision() )
33
- exit 1
33
+ case {params. help} :
34
+ helpMessage()
35
+ exit 1
34
36
35
- case {params. version} :
36
- versionMessage(version, grabRevision() )
37
- exit 1
37
+ case {params. version} :
38
+ versionMessage()
39
+ exit 1
38
40
}
39
41
40
42
if (! params. tex) {exit 1 , ' No tex file, see --help for more information' }
41
43
42
44
pictures = file(params. pictures)
43
45
tex = file(params. tex)
44
46
45
- startMessage(version, grabRevision() )
47
+ startMessage()
46
48
47
49
/*
48
50
================================================================================
@@ -51,22 +53,22 @@ startMessage(version, grabRevision())
51
53
*/
52
54
53
55
process RunXelatex {
54
- tag {tex}
56
+ tag {tex}
55
57
56
- publishDir " ." , mode : ' move'
58
+ publishDir " ." , mode : ' move'
57
59
58
- input :
59
- file tex
60
- file pictures
60
+ input :
61
+ file tex
62
+ file pictures
61
63
62
- output :
63
- file(" ${ tex.baseName} .pdf" ) into pdf
64
+ output :
65
+ file(" ${ tex.baseName} .pdf" ) into pdf
64
66
65
- script :
66
- """
67
- xelatex -shell-escape ${ tex.baseName}
68
- xelatex -shell-escape ${ tex.baseName}
69
- """
67
+ script :
68
+ """
69
+ xelatex -shell-escape ${ tex.baseName}
70
+ xelatex -shell-escape ${ tex.baseName}
71
+ """
70
72
}
71
73
72
74
/*
@@ -75,53 +77,73 @@ process RunXelatex {
75
77
================================================================================
76
78
*/
77
79
80
+ def compileBeamerMessage () {
81
+ // Display COMPILE-BEAMER message
82
+ log. info " COMPILE-BEAMER ~ $version - " + this . grabRevision() + (workflow. commitId ? " [$workflow . commitId ]" : " " )
83
+ }
84
+
85
+
78
86
def grabRevision () {
79
- return workflow. revision ?: workflow. scriptId. substring(0 ,10 )
87
+ // Return the same string executed from github or not
88
+ return workflow. revision ?: workflow. commitId ?: workflow. scriptId. substring(0 ,10 )
89
+ }
90
+
91
+ def helpMessage () {
92
+ // Display help message
93
+ this . compileBeamerMessage()
94
+ log. info " Usage:"
95
+ log. info " nextflow run MaxUlysse/compile-beamer --tex <input.tex> --theme <BTB||KI||SciLifeLab>"
96
+ log. info " --tex"
97
+ log. info " Compile the given tex file"
98
+ log. info " --help"
99
+ log. info " you're reading it"
100
+ log. info " --version"
101
+ log. info " displays version number"
102
+ }
103
+
104
+ def minimalInformationMessage () {
105
+ // Minimal information message
106
+ log. info " Command Line: $workflow . commandLine "
107
+ log. info " Project Dir : $workflow . projectDir "
108
+ log. info " Launch Dir : $workflow . launchDir "
109
+ log. info " Work Dir : $workflow . workDir "
110
+ log. info " Tex file : $tex "
111
+ log. info " Pictures in : $pictures "
80
112
}
81
113
82
- def helpMessage (version , revision ) {
83
- log. info " COMPILE-BEAMER ~ $version - revision: $revision "
84
- log. info " Usage:"
85
- log. info " nextflow run MaxUlysse/compile-beamer --tex <input.tex> --theme <BTB||KI||SciLifeLab>"
86
- log. info " --tex"
87
- log. info " Compile the given tex file"
88
- log. info " --help"
89
- log. info " you're reading it"
90
- log. info " --version"
91
- log. info " displays version number"
114
+ def nextflowMessage () {
115
+ // Nextflow message (version + build)
116
+ log. info " N E X T F L O W ~ version $workflow . nextflow . version $workflow . nextflow . build "
92
117
}
93
118
94
- def startMessage (version , revision ) {
95
- log. info " COMPILE-BEAMER ~ $version - revision: $revision "
96
- log. info " Command line: $workflow . commandLine "
97
- log. info " Project Dir : $workflow . projectDir "
98
- log. info " Launch Dir : $workflow . launchDir "
99
- log. info " Work Dir : $workflow . workDir "
119
+ def startMessage () {
120
+ // Display start message
121
+ this . compileBeamerMessage()
122
+ this . minimalInformationMessage()
100
123
}
101
124
102
- def versionMessage (version , revision ) {
103
- log. info " COMPILE-BEAMER"
104
- log. info " version $version "
105
- log. info ((workflow. commitId) ? " Git info : $workflow . repository - $workflow . revision [$workflow . commitId ]" : " revision: $revision " )
106
- log. info " Project : $workflow . projectDir "
107
- log. info " Directory: $workflow . launchDir "
125
+ def versionMessage () {
126
+ // Display version message
127
+ log. info " COMPILE-BEAMER"
128
+ log. info " version $version "
129
+ log. info workflow. commitId ? " Git info : $workflow . repository - $workflow . revision [$workflow . commitId ]" : " revision : " + this . grabRevision()
108
130
}
109
131
110
132
workflow. onComplete {
111
- log. info " N E X T F L O W ~ $workflow . nextflow . version - $workflow . nextflow . build "
112
- log. info " COMPILE-BEAMER ~ $version - revision: $revision "
113
- log. info " Command line: $workflow . commandLine "
114
- log. info " Project Dir : $workflow . projectDir "
115
- log. info " Launch Dir : $workflow . launchDir "
116
- log. info " Work Dir : $workflow . workDir "
117
- log. info " Completed at: $workflow . complete "
118
- log. info " Duration : $workflow . duration "
119
- log. info " Success : $workflow . success "
120
- log. info " Exit status : $workflow . exitStatus "
121
- log. info " Error report:" + (workflow. errorReport ?: ' -' )
133
+ // Display end message
134
+ this . nextflowMessage()
135
+ this . compileBeamerMessage()
136
+ this . minimalInformationMessage()
137
+ log. info " Completed at: $workflow . complete "
138
+ log. info " Duration : $workflow . duration "
139
+ log. info " Success : $workflow . success "
140
+ log. info " Exit status : $workflow . exitStatus "
141
+ log. info " Error report:" + (workflow. errorReport ?: ' -' )
122
142
}
123
143
124
144
workflow. onError {
125
- log. info " COMPILE-BEAMER"
126
- log. info " Workflow execution stopped with the following message: $workflow . errorMessage "
145
+ // Display error message
146
+ this . nextflowMessage()
147
+ this . compileBeamerMessage()
148
+ log. info " Workflow execution stopped with the following message: $workflow . errorMessage "
127
149
}
0 commit comments