91 lines
2.3 KiB
Smalltalk
91 lines
2.3 KiB
Smalltalk
Class {
|
|
#name : #ExoRepo,
|
|
#superclass : #Object,
|
|
#instVars : [
|
|
'repository'
|
|
],
|
|
#category : #ExoRepo
|
|
}
|
|
|
|
{ #category : #accessing }
|
|
ExoRepo class >> index [
|
|
"I list a set of external recommended repositories from the Grafoscopio community, in installation order."
|
|
| reposIndex repositoryAddresses|
|
|
repositoryAddresses := #('https://code.sustrato.red/Offray/MiniDocs').
|
|
reposIndex := OrderedCollection new.
|
|
repositoryAddresses do: [:adress | reposIndex add: (ExoRepo new repository: adress) ].
|
|
^ reposIndex
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
ExoRepo >> load [
|
|
"I load the configuration of this package using a external Gitea repository."
|
|
|
|
"While more Git independient providers are implemented in Monticello, I will
|
|
use Iceberg to download the repository and load it from a local directory"
|
|
|
|
| localRepo repoName count |
|
|
repoName := self repositoryName.
|
|
self local exists
|
|
ifFalse: [ (IceRepositoryCreator new
|
|
location: self local;
|
|
remote: (IceGitRemote url: self repository greaseString , '.git');
|
|
createRepository) register ].
|
|
localRepo := 'gitlocal://' , self local fullName.
|
|
count := 1.
|
|
[ true ]
|
|
whileTrue: [ [ ^ Metacello new
|
|
repository: localRepo;
|
|
baseline: repoName;
|
|
onConflictUseLoaded;
|
|
onWarningLog;
|
|
load ]
|
|
on: IceGenericError
|
|
do: [ :ex |
|
|
Notification
|
|
signal: (String with: Character cr) , ex description , (String with: Character cr)
|
|
, 'RETRYING ' , count greaseString.
|
|
(Delay forSeconds: 2) wait.
|
|
ex retry ].
|
|
count := count + 1 ]
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
ExoRepo >> local [
|
|
^ FileLocator localDirectory / 'iceberg' / (self provider) / self repositoryName
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
ExoRepo >> printOn: aStream [
|
|
super initialize.
|
|
aStream nextPutAll: self repositoryName, ' | ', self repository asString
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
ExoRepo >> provider [
|
|
self repository ifNil: [ ^ nil ].
|
|
^ self repository segments first
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
ExoRepo >> repository [
|
|
^ repository.
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
ExoRepo >> repository: aString [
|
|
repository := aString asZnUrl
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
ExoRepo >> repositoryName [
|
|
self repository ifNil: [ ^ self ].
|
|
^ self repository segments second
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
ExoRepo >> wiki [
|
|
^ (self local / 'wiki') ensureCreateDirectory.
|
|
|
|
]
|