nsip / specgen_input_au

Capture of specgen input files
2 stars 0 forks source link

Port sifxml2pescjson_source to be part of specgen run #63

Open opoudjis opened 1 year ago

opoudjis commented 1 year ago

https://github.com/nsip/sifxml2pescjson_source

Specgen needs to have the latest version of sif2jsonspecgen.xslt based on live data. Me forgetting to run it resulted in crashes and invalid JSON examples. And I do not want to trust that either I or @4pins will remember to run sifxml2pescjson_source separately, and then import the generated sif2jsonspecgen.xslt into specgen_input, each time we update the spec.

That means converting the bash shell of the existing repo into Powershell.

4pins commented 1 year ago

@opoudjis Um, I don't think Powershell is necessary. I believe I'm doing all of that in my bash script. Confused.

opoudjis commented 1 year ago

You run specgen in a Linux-like environment? Because I'm running specgen on a work machine, with an SOE; hence me avoiding bash (though bash would make my life slightly easier — for one, I could run my existing bash shell from my Mac for sif2jsonspecgen on the same machine as specgen).

... I strongly suspect our scripts have nothing in common. Oh well. Another thing to sort out later.

4pins commented 1 year ago

@opoudjis So at some point in the past everyone involved in SpecGen agreed to use Git for Windows including Git BASH. This change in environment is why I'm having such a hard time updating Git repositories I have maintained for years. If you look closely you'll realize this wasn't easy for me, but automating with Bash has been worth it.

Screen Shot 2023-01-03 at 8 52 35 AM
opoudjis commented 1 year ago

I am going to port sifxml2pescjson_source to Windows first, before porting the entire run script to bash. sh seems to be invoked by my Powershell, which helps.

Right now sifxml2pescjson_source assumes, in its *_extract.sh scripts, that the specgen directories are child submodules of the sifxml2pescjson_source repository. This needs to change, to make the specgen directories sibling submodules: I will be passing the directory location as an argument into these scripts.

opoudjis commented 1 year ago

At the moment sifxml2pescjson_source uses both Ruby and Perl. I seem to have both installed on my PC, but I may need to translate the Perl to Ruby.

opoudjis commented 1 year ago

I do also need to run xsltproc, xmllint, jq, node.

xsltproc: https://pretextbook.org/doc/author-guide/html/installing-xsltproc.html . This is fairly embarrassing jq: https://stedolan.github.io/jq/download/ (rename the precompiled executable from jq-win32 to jq) node: https://nodejs.org/en/download/

Or use a package manager like chocolatey

opoudjis commented 1 year ago

And, as noted in sifxml2pescjson_source readme,

npm init --y npm install x2js npm install fs npm install dot-object

opoudjis commented 1 year ago

It's running, but the roundtripping is failing: attributes are not being recognised, and I will need to work out why.

opoudjis commented 1 year ago

Tweaked JSON script, dot-object paths appear to be serialised differently for lists (x[n] instead of x.n).

opoudjis commented 1 year ago

The integration is now working for Powershell.