-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
and bump version to 1.0.4
- Loading branch information
Crisci, Fabio | Piuccio | TRVDD
committed
Sep 27, 2013
1 parent
c5451f9
commit bf70ddf
Showing
5 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env node | ||
var fs = require("fs"); | ||
var report = require("./lib/report"); | ||
var argv = require("optimist") | ||
.usage("Merge coverage reports.\n$0 -o destination source [source ...]") | ||
.boolean("h").alias("h", "help") | ||
.alias("o", "output").describe("o", "Output file.") | ||
.argv; | ||
|
||
|
||
if (argv.h) { | ||
help(true); | ||
} else if (!argv.o) { | ||
console.error("Output file is mandatory."); | ||
help(); | ||
} else if (argv._.length < 2) { | ||
console.error("Output file is mandatory."); | ||
help(); | ||
} else { | ||
good(argv.o, argv._); | ||
} | ||
|
||
function help (cleanExit) { | ||
require("optimist").showHelp(); | ||
if (cleanExit) { | ||
process.exit(0); | ||
} | ||
} | ||
|
||
function good (destination, files) { | ||
var reports = []; | ||
files.forEach(function (file) { | ||
reports.push(JSON.parse(fs.readFileSync(file))); | ||
}); | ||
fs.writeFileSync(destination, JSON.stringify(report.mergeReports(reports))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters