Improving index, install and print.

This commit is contained in:
ruidajo 2024-02-24 21:33:32 -05:00
parent 4e55c165d8
commit aa89f4884a

View File

@ -10,41 +10,35 @@ Class {
{ #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'
'https://code.sustrato.red/Offray/Fossil'
'https://code.sustrato.red/Offray/Shortener'
'https://code.sustrato.red/Offray/TiddlyWikiPharo'
'https://code.sustrato.red/mutabiT/EchartsPharo'
'https://code.sustrato.red/Offray/VideoWeb'
'https://code.sustrato.red/Offray/Socialmetrica').
| reposIndex repositoryAddresses users |
users := #('Offray' 'mutabiT' 'ruidajo' ).
reposIndex := OrderedCollection new.
repositoryAddresses do: [:adress | reposIndex add: (ExoRepo new repository: adress) ].
^ reposIndex
repositoryAddresses := users do: [:user |
reposIndex add:
((STONJSON fromString:('https://code.sustrato.red/api/v1/users/', user, '/repos') asZnUrl retrieveContents) collect: [:repo |
(repo at: 'name') -> (repo at: 'html_url')])].
^ (reposIndex flatCollect: [:i | i]) asDictionary
]
{ #category : #accessing }
ExoRepo class >> install: shortNameString [
| repo |
repo := self index
detect: [:current | current repositoryName = shortNameString ]
ifNone: [
^ 'ERROR!:
No repository named "', shortNameString, '".
Please run
ExoRepo index
| repo exoRepo |
[repo := self index at: shortNameString]
onErrorDo: [:err | UIManager default inform: 'No repository named: ', shortNameString, '.
Please run ExoRepo index
to list know repositories or load your own repository with:
ExoRepo new
repository: {repositoryAddres};
load.
replacing "{repositoryAddres}" with a Git public repository' ].
^ repo load
replacing {repositoryAddres} with a Git public repository'.^ {self new. err}].
exoRepo := self new repository: repo.
(IceRepositoryCreator new
location: exoRepo local;
remote: (IceGitRemote url: repo);
createRepository) register.
^ exoRepo load
]
{ #category : #accessing }
@ -59,7 +53,7 @@ ExoRepo >> load [
self local exists
ifFalse: [ (IceRepositoryCreator new
location: self local;
remote: (IceGitRemote url: self repository greaseString , '.git');
remote: (IceGitRemote url: self repository greaseString ", '.git'");
createRepository) register ].
localRepo := 'gitlocal://' , self local fullName.
count := 1.
@ -88,7 +82,9 @@ ExoRepo >> local [
{ #category : #accessing }
ExoRepo >> printOn: aStream [
super initialize.
aStream nextPutAll: self repositoryName, ' | ', self repository asString
self repository ifNotNil: [
aStream nextPutAll: self repositoryName, ' | ', self repository asString]
ifNil: [ aStream nextPutAll: 'ExoRepo without repository' ].
]
{ #category : #accessing }