From ef982eb6a10ec7e8e8236a5d8f0291c2edda7d96 Mon Sep 17 00:00:00 2001 From: Offray Date: Sat, 27 Apr 2024 03:59:21 -0500 Subject: [PATCH] Nim's package manager, Nimble, moved from MiniDocs to ExoRepo. --- src/MiniDocs/Nimble.class.st | 89 ------------------------------------ 1 file changed, 89 deletions(-) delete mode 100644 src/MiniDocs/Nimble.class.st diff --git a/src/MiniDocs/Nimble.class.st b/src/MiniDocs/Nimble.class.st deleted file mode 100644 index 78952aa..0000000 --- a/src/MiniDocs/Nimble.class.st +++ /dev/null @@ -1,89 +0,0 @@ -" -I'm a helper class modelling the common uses of the Nim's [Nimble package manager](https://github.com/nim-lang/nimble). -This was evolved in the context of the [Grafoscopio](mutabit.com/grafoscopio/en.html) community exploration and prototyping of interactive documentation. -" -Class { - #name : #Nimble, - #superclass : #Object, - #category : #'MiniDocs-External' -} - -{ #category : #accessing } -Nimble class >> detect: packageName [ - ^ self installed - detect: [ :dependency | dependency beginsWith: packageName ] - ifFound: [ ^ true ] - ifNone: [ ^ false ] -] - -{ #category : #accessing } -Nimble class >> install: packageName [ - (self detect: packageName) ifTrue: [ ^ self ]. - self installPackagesList. - Smalltalk os isWindows - ifTrue: [ ^ LibC runCommand: 'nimble install ', packageName ]. - OSSUnixSubprocess new - command: 'nimble'; - arguments: {'install'. - packageName}; - redirectStdout; - redirectStderr; - runAndWaitOnExitDo: [ :process :outString :errString | - process isSuccess - ifTrue: [ Transcript show: 'Command exited correctly with output: ', outString. ] - ifFalse: [ - ^ 'Command exit with error status: ', process exitStatusInterpreter printString, String cr, - 'Stderr contents: ', errString. - ] - ] -] - -{ #category : #accessing } -Nimble class >> installPackagesList [ - - (FileLocator home / '.nimble' / 'packages_official.json') exists - ifTrue: [ ^ self ]. - (Smalltalk os isUnix or: [ Smalltalk os isMacOS ]) - ifTrue: [ - OSSUnixSubprocess new - command: 'nimble'; - arguments: #('refresh'); - redirectStdout; - runAndWaitOnExitDo: [ :process :outString | ^ outString ]. - ]. - Smalltalk os isWindows - ifTrue: [ ^ LibC resultOfCommand: 'nimble refresh' ] -] - -{ #category : #accessing } -Nimble class >> installed [ - - Smalltalk os isWindows - ifTrue: [ | process | - process := GtExternalProcessBuilder new - command: 'nimble.exe'; - args: #('list' '--installed'); - output. - ^ process stdout lines ]. - - OSSUnixSubprocess new - command: 'nimble'; - arguments: #('list' '--installed'); - redirectStdout; - redirectStderr; - runAndWaitOnExitDo: [ :process :outString :errString | - process isSuccess - ifTrue: [ ^ outString lines ]; - ifFalse: [ ^ nil ] - ] -] - -{ #category : #accessing } -Nimble class >> version [ - - OSSUnixSubprocess new - command: 'nimble'; - arguments: #('--version'); - redirectStdout; - runAndWaitOnExitDo: [ :process :outString | ^ outString ] -]