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 } { #category : #accessing }
ExoRepo class >> index [ ExoRepo class >> index [
"I list a set of external recommended repositories from the Grafoscopio community, in installation order." "I list a set of external recommended repositories from the Grafoscopio community, in installation order."
| reposIndex repositoryAddresses| | reposIndex repositoryAddresses users |
repositoryAddresses := users := #('Offray' 'mutabiT' 'ruidajo' ).
#('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 := OrderedCollection new. reposIndex := OrderedCollection new.
repositoryAddresses do: [:adress | reposIndex add: (ExoRepo new repository: adress) ]. repositoryAddresses := users do: [:user |
^ reposIndex 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 } { #category : #accessing }
ExoRepo class >> install: shortNameString [ ExoRepo class >> install: shortNameString [
| repo | | repo exoRepo |
repo := self index [repo := self index at: shortNameString]
detect: [:current | current repositoryName = shortNameString ] onErrorDo: [:err | UIManager default inform: 'No repository named: ', shortNameString, '.
ifNone: [ Please run ExoRepo index
^ 'ERROR!:
No repository named "', shortNameString, '".
Please run
ExoRepo index
to list know repositories or load your own repository with: to list know repositories or load your own repository with:
ExoRepo new ExoRepo new
repository: {repositoryAddres}; repository: {repositoryAddres};
load. load.
replacing "{repositoryAddres}" with a Git public repository' ]. replacing {repositoryAddres} with a Git public repository'.^ {self new. err}].
^ repo load exoRepo := self new repository: repo.
(IceRepositoryCreator new
location: exoRepo local;
remote: (IceGitRemote url: repo);
createRepository) register.
^ exoRepo load
] ]
{ #category : #accessing } { #category : #accessing }
@ -59,7 +53,7 @@ ExoRepo >> load [
self local exists self local exists
ifFalse: [ (IceRepositoryCreator new ifFalse: [ (IceRepositoryCreator new
location: self local; location: self local;
remote: (IceGitRemote url: self repository greaseString , '.git'); remote: (IceGitRemote url: self repository greaseString ", '.git'");
createRepository) register ]. createRepository) register ].
localRepo := 'gitlocal://' , self local fullName. localRepo := 'gitlocal://' , self local fullName.
count := 1. count := 1.
@ -88,7 +82,9 @@ ExoRepo >> local [
{ #category : #accessing } { #category : #accessing }
ExoRepo >> printOn: aStream [ ExoRepo >> printOn: aStream [
super initialize. 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 } { #category : #accessing }