Getting branches from Gitea sites without using the API thanks to restify (go-lang based).

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-04-13 20:43:49 -05:00
parent e290538d58
commit a28e3652de

View File

@ -18,3 +18,29 @@ MCGiteabRepository class >> basicFromUrl: aZnUrl [
MCGiteabRepository class >> urlSchemes [
^ #(gitea)
]
{ #category : #accessing }
MCGiteabRepository >> branches [
"IMPORTANT! This requires the installation of the external multiplatform binary dependency
restify at: https://github.com/itzg/restify/.
This should be installed independiently."
| response |
response := OrderedDictionary new.
OSSUnixSubprocess new
shellCommand: 'restify --class="gt-ellipsis" ', 'https://', self projectPath, '/branches';
redirectStdout;
runAndWaitOnExitDo: [ :command :outString |
(STON fromString: outString) do: [:each |
response at: (each at: 'text') put: (each at: 'href')
]
].
^ response
]
{ #category : #accessing }
MCGiteabRepository >> projectVersion [
(projectVersion == nil or: [ projectVersion isEmpty ])
ifTrue: [ projectVersion := self branches keys first ].
^ projectVersion
]