Adding Nim and NanoID support to Windows platform.

This commit is contained in:
Paula Martinez 2024-04-04 17:35:25 -05:00
parent 7979007091
commit 9ae7a6ec62
2 changed files with 16 additions and 5 deletions

View File

@ -28,6 +28,8 @@ NanoID class >> binaryFile [
{ #category : #accessing } { #category : #accessing }
NanoID class >> generate [ NanoID class >> generate [
self binaryFile exists ifFalse: [ NanoID install]. self binaryFile exists ifFalse: [ NanoID install].
Smalltalk os isWindows
ifTrue: [ ^ (LibC resultOfCommand:self binaryFile fullName) copyWithoutAll: (Character lf asString) ].
OSSUnixSubprocess new OSSUnixSubprocess new
command: self binaryFile fullName; command: self binaryFile fullName;
redirectStdout; redirectStdout;
@ -41,6 +43,8 @@ NanoID class >> install [
IMPORTANT: Nimble, Nim's package manager should be installed, as this process doesn't verify its proper installation." IMPORTANT: Nimble, Nim's package manager should be installed, as this process doesn't verify its proper installation."
self binaryFile exists ifTrue: [ ^ MiniDocs appFolder ]. self binaryFile exists ifTrue: [ ^ MiniDocs appFolder ].
Nimble install: 'nanoid'. Nimble install: 'nanoid'.
Smalltalk os isWindows
ifTrue: [ ^ LibC resultOfCommand: 'nanoid c ',self scriptSourceCode fullName ].
OSSUnixSubprocess new OSSUnixSubprocess new
command: 'nim'; command: 'nim';
arguments: {'c'. self scriptSourceCode fullName}; arguments: {'c'. self scriptSourceCode fullName};

View File

@ -20,6 +20,8 @@ Nimble class >> detect: packageName [
Nimble class >> install: packageName [ Nimble class >> install: packageName [
(self detect: packageName) ifTrue: [ ^ self ]. (self detect: packageName) ifTrue: [ ^ self ].
self installPackagesList. self installPackagesList.
Smalltalk os isWindows
ifTrue: [ ^ LibC runCommand: 'nimble install ', packageName ].
OSSUnixSubprocess new OSSUnixSubprocess new
command: 'nimble'; command: 'nimble';
arguments: {'install'. arguments: {'install'.
@ -41,11 +43,16 @@ Nimble class >> installPackagesList [
(FileLocator home / '.nimble' / 'packages_official.json') exists (FileLocator home / '.nimble' / 'packages_official.json') exists
ifTrue: [ ^ self ]. ifTrue: [ ^ self ].
(Smalltalk os isUnix or: [ Smalltalk os isMacOS ])
ifTrue: [
OSSUnixSubprocess new OSSUnixSubprocess new
command: 'nimble'; command: 'nimble';
arguments: #('refresh'); arguments: #('refresh');
redirectStdout; redirectStdout;
runAndWaitOnExitDo: [ :process :outString | ^ outString ] runAndWaitOnExitDo: [ :process :outString | ^ outString ].
].
Smalltalk os isWindows
ifTrue: [ ^ LibC resultOfCommand: 'nimble refresh' ]
] ]
{ #category : #accessing } { #category : #accessing }