diff --git a/src/MiniDocs/YQ.class.st b/src/MiniDocs/YQ.class.st deleted file mode 100644 index 7f81dfb..0000000 --- a/src/MiniDocs/YQ.class.st +++ /dev/null @@ -1,52 +0,0 @@ -" -The `External` tag is related on its dependency on other programming languages and frameworks, -though the dependency should be loaded by just loading a small binary with no dependencies. -" -Class { - #name : #YQ, - #superclass : #Object, - #category : #'MiniDocs-External' -} - -{ #category : #accessing } -YQ class >> binaryDownloadLinkFor: operativeSystem on: processor [ - | binaryName binaryDownloadData | - binaryName := 'yq_', operativeSystem , '_', processor. - binaryDownloadData := ((self lastReleaseData at: 'assets') - select: [:each | (each at: 'name') beginsWith: binaryName ]) first. - ^ binaryDownloadData at: 'browser_download_url' -] - -{ #category : #accessing } -YQ class >> binaryFile [ - "Starting with location on Arch Linux and its derivates. Multidistro and multiOS support should be added." - ^ FileLocator root / 'usr/bin/yq' -] - -{ #category : #accessing } -YQ class >> install [ - ^ self lastReleaseData -] - -{ #category : #accessing } -YQ class >> jsonToYaml: aDictionary [ - | jsonFile | - self binaryFile exists ifFalse: [ YQ install]. - jsonFile := MarkupFile exportAsFileOn: FileLocator temp / 'data.json' containing: aDictionary. - (Smalltalk os isUnix or: [ Smalltalk os isMacOS ]) - ifTrue: [ - OSSUnixSubprocess new - shellCommand: 'cat ', jsonFile fullName,' | yq -y'; - redirectStdout; - runAndWaitOnExitDo: [ :command :outString | - ^ outString - ]]. - Smalltalk os isWindows - ifTrue: [ ^ LibC resultOfCommand: 'yq -p=json ', jsonFile fullName ]. -] - -{ #category : #accessing } -YQ class >> lastReleaseData [ - ^ (STONJSON - fromString: 'https://api.github.com/repos/mikefarah/yq/releases' asUrl retrieveContents) first -]