GitHubWrapper now contains common functionality for external programs provided via GitHub.

This commit is contained in:
= 2024-05-02 10:27:48 -05:00
parent 19c4275dcd
commit e5b6269547
2 changed files with 38 additions and 7 deletions

View File

@ -0,0 +1,35 @@
Class {
#name : #GitHubWrapper,
#superclass : #Object,
#instVars : [
'repository'
],
#category : #'ExoRepo-External'
}
{ #category : #accessing }
GitHubWrapper class >> apiEndPoint [
^ 'https://api.github.com/' asUrl
]
{ #category : #accessing }
GitHubWrapper >> lastReleaseData [
| releasesLink |
releasesLink := self class apiEndPoint addPathSegment: 'repos'.
self repository asUrl segments do: [:segment |
releasesLink addPathSegment: segment
].
releasesLink addPathSegment: 'releases'.
^ (STONJSON
fromString: releasesLink retrieveContents) first
]
{ #category : #accessing }
GitHubWrapper >> repository [
^ repository
]
{ #category : #accessing }
GitHubWrapper >> repository: anUrl [
repository := anUrl
]

View File

@ -26,7 +26,9 @@ YQ class >> binaryFile [
{ #category : #accessing }
YQ class >> install [
^ self lastReleaseData
^ GitHubWrapper new
repository: 'https://github.com/mikefarah/yq';
lastReleaseData
]
{ #category : #accessing }
@ -45,9 +47,3 @@ YQ class >> jsonToYaml: aDictionary [
Smalltalk os isWindows
ifTrue: [ ^ LibC resultOfCommand: 'yq -p=json ', jsonFile fullName ].
]
{ #category : #accessing }
YQ class >> lastReleaseData [
^ (STONJSON
fromString: 'https://api.github.com/repos/mikefarah/yq/releases' asUrl retrieveContents) first
]