From bbd924b0796771f004e294b2f60997928aab6433 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 1 Sep 2024 11:36:54 -0500 Subject: [PATCH] Adding helper methods for package management. --- src/ExoRepo/Brew.class.st | 22 ++++++++++++++++++++++ src/ExoRepo/Nimble.class.st | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/src/ExoRepo/Brew.class.st b/src/ExoRepo/Brew.class.st index 59836bb..3f365cd 100644 --- a/src/ExoRepo/Brew.class.st +++ b/src/ExoRepo/Brew.class.st @@ -4,6 +4,14 @@ Class { #category : #ExoRepo } +{ #category : #accessing } +Brew class >> help [ + ^ (GtSubprocessWithInMemoryOutput new + shellCommand: 'brew help'; + runAndWait; + stdout) +] + { #category : #accessing } Brew class >> install [ "This is a preliminary starting installation script that is not working. @@ -24,3 +32,17 @@ Smalltalk os isWindows ifTrue: [ ^ nil ]. runAndWait; stdout) ] + +{ #category : #accessing } +Brew class >> isInstalled [ + ^ self help isEmptyOrNil not. +] + +{ #category : #accessing } +Brew >> install: packageName [ + ^ GtSubprocessWithInMemoryOutput new + shellCommand: 'brew install ', packageName; + runAndWait; + stdout + +] diff --git a/src/ExoRepo/Nimble.class.st b/src/ExoRepo/Nimble.class.st index 4e4c5cb..57b9b38 100644 --- a/src/ExoRepo/Nimble.class.st +++ b/src/ExoRepo/Nimble.class.st @@ -59,6 +59,11 @@ Nimble class >> installed [ stdout) lines ] +{ #category : #accessing } +Nimble class >> isInstalled [ + ^ self version isEmptyOrNil not +] + { #category : #accessing } Nimble class >> version [