Implementing external package management for Nim dependencies.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-07-25 09:43:45 -05:00
parent 8019cd4da3
commit 0d924fa23f
3 changed files with 60 additions and 0 deletions

View File

@ -11,3 +11,8 @@ Class {
ManifestMiniDocs class >> ruleExcessiveVariablesRuleV1FalsePositive [
^ #(#(#(#RGClassDefinition #(#Markdeep)) #'2022-07-16T12:24:34.695032-05:00') )
]
{ #category : #'code-critics' }
ManifestMiniDocs class >> ruleParseTreeLintRuleV1FalsePositive [
^ #(#(#(#RGPackageDefinition #(#MiniDocs)) #'2022-07-25T09:28:50.156394-05:00') )
]

View File

@ -18,6 +18,23 @@ Class {
#category : #'MiniDocs-MiniDocs'
}
{ #category : #accessing }
NanoID class >> binaryFile [
^ self scriptSourceCode parent / self scriptSourceCode basenameWithoutExtension
]
{ #category : #accessing }
NanoID class >> install [
"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."
Nimble install: 'nanoid'.
OSSUnixSubprocess new
command: 'nim';
arguments: {'c'. self scriptSourceCode fullName};
workingDirectory: self binaryFile parent;
runAndWaitOnExitDo: [ :process :outString | ^ self binaryFile parent ]
]
{ #category : #accessing }
NanoID class >> scriptSourceCode [
^ FileLocator image parent / 'pharo-local/iceberg/Offray/MiniDocs/src/nanoIdGen.nim'

View File

@ -0,0 +1,38 @@
"
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-MiniDocs'
}
{ #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 ].
OSSUnixSubprocess new
command: 'nimble';
arguments: {'install'.
packageName};
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
]
{ #category : #accessing }
Nimble class >> installed [
| installed |
OSSUnixSubprocess new
command: 'nimble';
arguments: #('list' '--installed');
redirectStdout;
runAndWaitOnExitDo: [ :command :outString | installed := outString ].
^ installed lines
]