GitHubWrapper now contains common functionality for external programs provided via GitHub.
This commit is contained in:
parent
19c4275dcd
commit
e5b6269547
35
src/ExoRepo/GitHubWrapper.class.st
Normal file
35
src/ExoRepo/GitHubWrapper.class.st
Normal 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
|
||||
]
|
@ -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
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user