Hi Martin,

Interesting solution but it feels a bit like a hack.
For the GTools we made a solution that triggers a custom announcer before
and after a Monticello load.
We'll make a slice later today.

Cheers,
Andrei

On Thu, Dec 3, 2015 at 3:46 PM, Martin Dias <tinchod...@gmail.com> wrote:

> Hi,
>
> Doru asked me how does Epicea listen this information, and I created a
> snippet to demo it *in a plain Pharo 5 image* (no need to load Epicea
> before). Maybe somebody else is interested, that's why I share it with
> everybody.
>
> You can open a Transcript and evaluate the following snippet. After
> evaluation, you can add new methods in Nautilus and see the log in the
> Transcript. (The code is not very nice).
>
> Cheers,
> Martin
>
>
>
> "Listen load start"
> Job jobAnnouncer
> when: JobStart
> do: [ :aJobStart |
> | owner |
> owner := aJobStart job owner.
>
> (owner isKindOf: MCVersionLoader)
> ifTrue: [ ('Starting to load ', owner versions asArray asString) logCr ] ].
> "Listen load end"
> Job jobAnnouncer
> when: JobEnd
> do: [ :aJobEnd |
> | owner |
> owner := aJobEnd job owner.
>
> (owner isKindOf: MCVersionLoader)
> ifTrue: [ ('Ending to load ', owner versions asArray asString) logCr ] ].
>
> "Listen changes in the middle"
> SystemAnnouncer uniqueInstance
> when: MethodAdded
> do: [ :aMethodAdded |
> | mcLoaderJobOrNil |
> mcLoaderJobOrNil :=
> Job current
> ifNil: [ nil ]
> ifNotNil: [ :currentJob |
> currentJob
> lookup: [ :job | job owner isKindOf: MCVersionLoader ]
> ifNone: [ nil ] ].
> (aMethodAdded methodAdded printString, ' --- ',
> (mcLoaderJobOrNil
> ifNil: [ 'no info' ]
> ifNotNil: [ 'while loading ', mcLoaderJobOrNil owner versions asArray
> asString ])) logCr ].
>
>
> "Try it loading"
> Gofer it
> smalltalkhubUser: 'MartinDias' project: 'AlarmClock';
> package: 'AlarmClock';
> load.
>
>
>
>

Reply via email to