@@ -17,8 +17,8 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
17
17
18
18
val index = IOUtils .readStreamAsString(getClass.getResourceAsStream(" /scoverage/index.html" ))
19
19
IOUtils .writeToFile(indexFile, index)
20
- IOUtils .writeToFile(packageFile, packageList(coverage).toString)
21
- IOUtils .writeToFile(overviewFile, overview(coverage).toString)
20
+ IOUtils .writeToFile(packageFile, packageList(coverage).toString() )
21
+ IOUtils .writeToFile(overviewFile, overview(coverage).toString() )
22
22
23
23
coverage.packages.foreach(writePackage)
24
24
}
@@ -31,15 +31,15 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
31
31
// to com.example.html
32
32
val file = new File (outputDir, packageOverviewRelativePath(pkg))
33
33
file.getParentFile.mkdirs()
34
- IOUtils .writeToFile(file, packageOverview(pkg).toString)
34
+ IOUtils .writeToFile(file, packageOverview(pkg).toString() )
35
35
pkg.files.foreach(writeFile)
36
36
}
37
37
38
38
private def writeFile (mfile : MeasuredFile ): Unit = {
39
39
// each highlighted file is written out using the same structure as the original file.
40
40
val file = new File (outputDir, relativeSource(mfile.source) + " .html" )
41
41
file.getParentFile.mkdirs()
42
- IOUtils .writeToFile(file, filePage(mfile).toString)
42
+ IOUtils .writeToFile(file, filePage(mfile).toString() )
43
43
}
44
44
45
45
private def packageOverviewRelativePath (pkg : MeasuredPackage ) = pkg.name.replace(" <empty>" , " (empty)" ) + " .html"
@@ -57,10 +57,7 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
57
57
<title id =' title' >
58
58
{filename}
59
59
</title >
60
- <link rel =" stylesheet" href =" http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
61
- <script src =" http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script >
62
- <script src =" http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js" ></script >
63
- <script src =" http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.18.3/addons/pager/jquery.tablesorter.pager.min.js" ></script >
60
+ {plugins}
64
61
<style >
65
62
{css}
66
63
</style >
@@ -135,21 +132,13 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
135
132
| overflow: hidden;
136
133
|}""" .stripMargin
137
134
138
- val tableScript = """ $(document).ready(function() {$("#packages").tablesorter();});"""
139
-
140
135
<head >
141
136
<meta http-equiv =" Content-Type" content =" text/html; charset=utf-8" />
142
137
<title id =' title' >Scoverage Code Coverage </title >
143
- <link rel =" stylesheet" href =" http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
144
- <script src =" http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script >
145
- <script src =" http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js" ></script >
146
- <script src =" http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.18.3/addons/pager/jquery.tablesorter.pager.min.js" ></script >
138
+ {plugins}
147
139
<style >
148
140
{css}
149
141
</style >
150
- <script >
151
- {tableScript}
152
- </script >
153
142
</head >
154
143
}
155
144
@@ -282,29 +271,25 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
282
271
<title id =' title' >
283
272
Scoverage Code Coverage
284
273
</title >
285
- <link rel =" stylesheet" href =" http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
286
- <script src =" http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script >
287
- <script src =" http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js" ></script >
288
- <script src =" http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.18.3/addons/pager/jquery.tablesorter.pager.min.js" ></script >
274
+ {plugins}
289
275
</head >
290
276
<body style =" font-family: monospace;" >
291
- <table class =" table table-striped" style =" font-size: 13px" >
292
- <tbody >
277
+ <table class =" tablesorter table table-striped" style =" font-size: 13px" >
278
+ <thead >
293
279
<tr >
294
280
<td >
295
- <a href =" overview.html" target =" mainFrame" >
296
- All packages
297
- </a >{coverage.statementCoverageFormatted}
298
- %
281
+ <a href =" overview.html" target =" mainFrame" >All packages</a >
299
282
</td >
300
- </tr >{coverage.packages.map(arg =>
283
+ <td >{coverage.statementCoverageFormatted}%</ td>
284
+ </tr >
285
+ </thead >
286
+ <tbody >
287
+ {coverage.packages.map(arg =>
301
288
<tr >
302
289
<td >
303
- <a href ={packageOverviewRelativePath(arg)} target =" mainFrame" >
304
- {arg.name}
305
- </a >{arg.statementCoverageFormatted}
306
- %
290
+ <a href ={packageOverviewRelativePath(arg)} target =" mainFrame" >{arg.name}</a >
307
291
</td >
292
+ <td >{arg.statementCoverageFormatted}%</ td>
308
293
</tr >
309
294
)}
310
295
</tbody >
@@ -314,7 +299,7 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
314
299
}
315
300
316
301
def risks (coverage : Coverage , limit : Int ) = {
317
- <table id = " packages " class =" table table-striped" style =" font-size: 12px" >
302
+ <table class =" tablesorter table table-striped" style =" font-size: 12px" >
318
303
<thead >
319
304
<tr >
320
305
<th >
@@ -535,5 +520,16 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
535
520
</tr >
536
521
</table >
537
522
}
523
+
524
+ def plugins = {
525
+ <script src =" http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script >
526
+ <link rel =" stylesheet" href =" https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.20.1/css/theme.default.min.css" type =" text/css" />
527
+ <script src =" http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.20.1/js/jquery.tablesorter.min.js" ></script >
528
+ <link rel =" stylesheet" href =" http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" type =" text/css" />
529
+ <script src =" http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js" ></script >
530
+ <script type =" text/javascript" >
531
+ {xml.Unparsed (""" $(document).ready(function() {$(".tablesorter").tablesorter();});""" )}
532
+ </script >
533
+ }
538
534
}
539
535
0 commit comments