Open opoudjis opened 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.
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.
@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.
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.
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.
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
And, as noted in sifxml2pescjson_source readme,
npm init --y npm install x2js npm install fs npm install dot-object
It's running, but the roundtripping is failing: attributes are not being recognised, and I will need to work out why.
Tweaked JSON script, dot-object paths appear to be serialised differently for lists (x[n]
instead of x.n
).
The integration is now working for Powershell.
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.