-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,36 @@ | ||
const fs = require('fs'); | ||
const clc = require('cli-color'); | ||
const sha1 = require('js-sha1'); | ||
const blue = clc.blueBright; | ||
const D = require('./definitions'); | ||
const Parser = require('./parser'); | ||
const PlantUML = require('./plantuml'); | ||
|
||
const INPUT_FILE_LOG = `unlockThenRideHexNoParsingV2.log`; | ||
const INPUT_PATH_LOG = `${__dirname}/logfiles/${INPUT_FILE_LOG}`; | ||
const LOG_HEADER = 'Ready...'; | ||
|
||
// UML file (generated only if PLANTUML_PATH env variable exists) | ||
const UML_FILE_LOG = `uml.txt`; | ||
const UML_PATH_LOG = `${__dirname}/generated/${UML_FILE_LOG}`; | ||
|
||
// Verbose file | ||
const OUTPUT_FILE_LOG = `resume.log`; | ||
const OUTPUT_PATH_LOG = `${__dirname}/${OUTPUT_FILE_LOG}`; | ||
const OUTPUT_PATH_LOG = `${__dirname}/generated/${OUTPUT_FILE_LOG}`; | ||
|
||
const PLANTUML_PATH = process.env.PLANTUML_PATH; | ||
|
||
console.log(blue('Reading file'), INPUT_PATH_LOG); | ||
|
||
const logData = fs.readFileSync(INPUT_PATH_LOG) | ||
Parser.parseHex(logData); | ||
let frames = Parser.parseHex(logData); | ||
let txt = ''; | ||
frames.forEach(frame => { | ||
txt += Parser.frameToString(frame) + '\n'; | ||
}); | ||
fs.writeFileSync(OUTPUT_PATH_LOG, txt); | ||
|
||
// generate uml sequence diagram? | ||
if (PLANTUML_PATH) { | ||
let uml = PlantUML.toUML(frames); | ||
fs.writeFileSync(UML_PATH_LOG, uml); | ||
PlantUML.generateImage(PLANTUML_PATH, UML_PATH_LOG); | ||
} else console.log('UML file skipped'); | ||
|