diff --git a/src/MiniDocs/MiniDocs.class.st b/src/MiniDocs/MiniDocs.class.st index 95ec538..52c2134 100644 --- a/src/MiniDocs/MiniDocs.class.st +++ b/src/MiniDocs/MiniDocs.class.st @@ -11,3 +11,37 @@ MiniDocs class >> appFolder [ tempFolder exists ifFalse: [ tempFolder ensureCreateDirectory ]. ^ tempFolder ] + +{ #category : #accessing } +MiniDocs class >> installYamlToJson [ + "For the moment, only Gnu/Linux and Mac are supported. + IMPORTANT: Nimble, Nim's package manager should be installed, as this process doesn't verify its proper installation." + self yamlToJsonBinary exists ifTrue: [ ^ MiniDocs appFolder ]. + Nimble install: 'commandeer'. + OSSUnixSubprocess new + command: 'nim'; + arguments: {'c'. self yamlToJsonSourceCode fullName}; + runAndWaitOnExitDo: [ :process :outString | + (self yamlToJsonSourceCode basenameWithoutExtension) moveTo: MiniDocs appFolder asFileReference. + ^ MiniDocs appFolder ] +] + +{ #category : #accessing } +MiniDocs class >> yamlToJson: yamlString [ + + self yamlToJsonBinary exists ifFalse: [ self installYamlToJson ]. + + OSSUnixSubprocess new + command: self yamlToJsonBinary fullName; + runAndWaitOnExitDo: [ :process :outString | ^ outString ] +] + +{ #category : #accessing } +MiniDocs class >> yamlToJsonBinary [ + ^ self appFolder / 'yamlToJson' +] + +{ #category : #accessing } +MiniDocs class >> yamlToJsonSourceCode [ + ^ FileLocator image parent / 'pharo-local/iceberg/Offray/MiniDocs/src/yamlToJso.nim' +]