ExoRepo/src/ExoRepo/MCGiteabRepository.class.st

80 lines
2.2 KiB
Smalltalk

Class {
#name : #MCGiteabRepository,
#superclass : #MCGitBasedNetworkRepository,
#category : #ExoRepo
}
{ #category : #accessing }
MCGiteabRepository class >> basicDescription [
^ 'gitea'
]
{ #category : #'as yet unclassified' }
MCGiteabRepository class >> basicFromUrl: aZnUrl [
^ self location: aZnUrl asString
]
{ #category : #'*ExoRepo' }
MCGiteabRepository class >> createRepositoryFromSpec: aMetacelloRepositorySpec on: anIceMetacelloPharoPlatform [
^ anIceMetacelloPharoPlatform createGiteaRepository: aMetacelloRepositorySpec
]
{ #category : #accessing }
MCGiteabRepository class >> isAvailableFor: type [
^ type = 'gitea'
]
{ #category : #private }
MCGiteabRepository class >> projectZipUrlFor: projectPath versionString: versionString [
^ 'https://' , projectPath , '/archive/' , versionString , '.zip'
]
{ #category : #accessing }
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, '/', self repoPath, '/branches';
redirectStdout;
runAndWaitOnExitDo: [ :command :outString |
outString ifEmpty: [^ command ].
(STON fromString: outString) do: [:each |
response at: (each at: 'text') put: (each at: 'href')
]
].
^ response
]
{ #category : #accessing }
MCGiteabRepository >> calculateRepositoryDirectory [
| directory |
directory := self class
projectDirectoryFrom: self projectPath, '/', self repoPath
version: self projectVersion.
self repoPath isEmpty ifFalse: [
directory := directory parent ].
^ directory
]
{ #category : #accessing }
MCGiteabRepository >> location: aString [
]
{ #category : #accessing }
MCGiteabRepository >> projectVersion [
(projectVersion == nil or: [ projectVersion isEmpty ])
ifTrue: [ projectVersion := self branches keys first ].
^ projectVersion
]