Implementing external package management for Nim dependencies.
This commit is contained in:
parent
8019cd4da3
commit
0d924fa23f
@ -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') )
|
||||
]
|
||||
|
@ -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'
|
||||
|
38
src/MiniDocs/Nimble.class.st
Normal file
38
src/MiniDocs/Nimble.class.st
Normal 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
|
||||
]
|
Loading…
Reference in New Issue
Block a user