Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port sifxml2pescjson_source to be part of specgen run #63

Open
opoudjis opened this issue Dec 23, 2022 · 10 comments
Open

Port sifxml2pescjson_source to be part of specgen run #63

opoudjis opened this issue Dec 23, 2022 · 10 comments
Assignees

Comments

@opoudjis
Copy link
Member

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.

@opoudjis opoudjis self-assigned this Dec 23, 2022
@4pins
Copy link
Collaborator

4pins commented Dec 27, 2022

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

@opoudjis
Copy link
Member Author

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
Copy link
Collaborator

4pins commented Jan 3, 2023

@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
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

opoudjis commented Feb 13, 2023

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
Copy link
Member Author

And, as noted in sifxml2pescjson_source readme,

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

@opoudjis
Copy link
Member Author

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

@opoudjis
Copy link
Member Author

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

opoudjis pushed a commit to nsip/sifxml2pescjson_source that referenced this issue Feb 14, 2023
@opoudjis
Copy link
Member Author

The integration is now working for Powershell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants