diff --git a/generate/eol_hack.js b/generate/eol_hack.js new file mode 100644 index 00000000..3297bc64 --- /dev/null +++ b/generate/eol_hack.js @@ -0,0 +1,32 @@ +/* + eol_hack.js - Don Cross + + Fixes line endings in a text file to be CR LF pairs. + This is a hack so that there is no diff noise + caused by running jsdoc2md from Windows. + + See open bug at: + https://github.com/jsdoc2md/jsdoc-to-markdown/issues/112 +*/ +'use strict'; +const fs = require('fs'); + +function FixFile(filename) { + const inText = fs.readFileSync(filename, 'utf8'); + const outText = inText.replace(/\r?\n|\r\n?/g, '\r\n'); + + if (inText === outText) { + console.log(`eol_hack.js: Leaving file as-is: ${filename}`); + } else { + fs.writeFileSync(filename, outText, 'utf8'); + console.log(`eol_hack.js: Rewrote line endings: ${filename}`); + } +} + +if (process.argv.length !== 3) { + console.log('USAGE: eol_hack.js filename'); + process.exit(1); +} + +FixFile(process.argv[2]); +process.exit(0); diff --git a/generate/makedocs.bat b/generate/makedocs.bat new file mode 100644 index 00000000..3da56ae5 --- /dev/null +++ b/generate/makedocs.bat @@ -0,0 +1,10 @@ +@echo off +echo. +echo.Making documentation files. +call jsdoc2md --template ../jsdoc2md/js.hbs --files ..\source\js\astronomy.js > ..\source\js\README.md +if errorlevel 1 ( + echo.FATAL: error in jsdoc2md + exit /b 1 +) + +exit /b 0 \ No newline at end of file diff --git a/generate/run.bat b/generate/run.bat index ee053c60..203a5a49 100644 --- a/generate/run.bat +++ b/generate/run.bat @@ -85,7 +85,7 @@ if not exist !EPHFILE! ( ) echo. -echo.Running the target code generator. +echo.Cleaning output directories. for %%d in (output temp) do ( if not exist %%d ( md %%d @@ -95,12 +95,27 @@ for %%d in (output temp) do ( ) ) ) + if exist output\vsop_*.txt (del /q output\vsop_*.txt) if exist temp\* (del /q temp\*) -!GENEXE! planets -if errorlevel 1 (exit /b 1) +echo. +echo.Generating planet models. +!GENEXE! planets +if errorlevel 1 ( + echo.FATAL: !GENEXE! planets + exit /b 1 +) + +echo. +echo.Generating target code. !GENEXE! source +if errorlevel 1 ( + echo.FATAL: !GENEXE! source + exit /b 1 +) + +call makedocs.bat if errorlevel 1 (exit /b 1) echo.