Skip to content

Commit

Permalink
Merge pull request #909 from jecisc/pharo-loading
Browse files Browse the repository at this point in the history
Improve postload to not break the Pharo bootstrap
  • Loading branch information
tesonep authored Oct 30, 2024
2 parents e390aeb + e38e73e commit 4643917
Showing 1 changed file with 11 additions and 24 deletions.
35 changes: 11 additions & 24 deletions src/BaselineOfMicrodown/BaselineOfMicrodown.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,13 @@ BaselineOfMicrodown >> mustache: spec [
{ #category : 'baselines' }
BaselineOfMicrodown >> postload: loader package: packageSpec [

| p |
self class name, ' postload ' traceCr.

p := (IceRepository repositoryNamed: 'microdown').
p ifNil: [ p := (IceRepository repositoryNamed: 'Microdown') ].
[
(p ifNotNil: [ :p2 | (p2 packageNamed: 'BaselineOfMicrodown') reload ])
]
on: MCMergeOrLoadWarning
do: [ :ex | ex load ]



"If it is absent it's because we are in the Pharo bootstrap"
self class environment at: #IceRepository ifPresent: [ :class |
| repository |
repository := (class repositoryNamed: 'microdown') ifNil: [ class repositoryNamed: 'Microdown' ].
[ repository ifNotNil: [ (repository packageNamed: 'BaselineOfMicrodown') reload ] ]
on: MCMergeOrLoadWarning
do: [ :ex | ex load ] ]
]

{ #category : 'baselines' }
Expand All @@ -175,21 +169,14 @@ BaselineOfMicrodown >> preload: loader package: packageSpec [
found
unload;
forget ] ]"

| packagesToUnload |
self class name, ' preload ' traceCr.
packagesToUnload := ((PackageOrganizer default packages
select: [ :each | each name beginsWith: 'Microdown' ]) collect: [ :each | each name ])
reject: [ :each |
#('Microdown-RichTextPresenter' 'Microdown-RichTextPresenter-Tests') includes: each ].
packagesToUnload := ((PackageOrganizer default packages select: [ :each | each name beginsWith: 'Microdown' ]) collect: [ :each | each name ]) reject: [ :each |
#( 'Microdown-RichTextPresenter' 'Microdown-RichTextPresenter-Tests' ) includes: each ].
"these two are not managed by the microdown repo but the documentation.
I should rename them in the future to avoid confusion"

packagesToUnload do:
[ :each |
((IceRepository repositoryNamed: 'Microdown') packageNamed: each) unload ].


packagesToUnload do: [ :each | ((IceRepository repositoryNamed: 'Microdown') packageNamed: each) unload ]
]

{ #category : 'external projects' }
Expand Down

0 comments on commit 4643917

Please sign in to comment.