Implementing YAML metadata to JSON via external Nim script.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-10-16 19:10:37 -05:00
parent 94b3c59d7a
commit 2bb50789ea
1 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,7 @@ MiniDocs class >> installYamlToJson [
command: 'nim';
arguments: {'c'. self yamlToJsonSourceCode fullName};
runAndWaitOnExitDo: [ :process :outString |
(self yamlToJsonSourceCode basenameWithoutExtension) moveTo: MiniDocs appFolder asFileReference.
(self yamlToJsonSourceCode parent / self yamlToJsonSourceCode basenameWithoutExtension) moveTo: MiniDocs appFolder asFileReference.
^ MiniDocs appFolder ]
]
@ -33,7 +33,11 @@ MiniDocs class >> yamlToJson: yamlString [
OSSUnixSubprocess new
command: self yamlToJsonBinary fullName;
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
arguments: {yamlString};
redirectStdout;
runAndWaitOnExitDo: [ :process :outString |
^ (STONJSON fromString: outString allButFirst) first
]
]
{ #category : #accessing }
@ -43,5 +47,5 @@ MiniDocs class >> yamlToJsonBinary [
{ #category : #accessing }
MiniDocs class >> yamlToJsonSourceCode [
^ FileLocator image parent / 'pharo-local/iceberg/Offray/MiniDocs/src/yamlToJso.nim'
^ FileLocator image parent / 'pharo-local/iceberg/Offray/MiniDocs/src/yamlToJson.nim'
]