Metacello / metacello

Metacello is a package management system for Smalltalk
MIT License
87 stars 43 forks source link

MetacelloVersion should maybe take the projectLabel into account in the #= #437

Open jecisc opened 7 years ago

jecisc commented 7 years ago

I have a problem because I wanted to collect as a set some versions but I lost one project because MetacelloVersion>>#= takes only the species and the version number into account.

Maybe it should also takes the projectLabel into account if there is one?

dalehenrich commented 7 years ago

hmmm the projectLabel is not an attribute of MetacelloVersion .... I can understand your problem, but I'm also reluctant to change such a fundamental thing without quite a bit of testing ... could you provide some context for collecting the set? Maybe there's another way to do what you are attempting without modifying MetacelloVersion>>#=?

jecisc commented 7 years ago

The idea is to build a visualization around the a configuration version.

With the Telescope framework I have this code:

self addNodesFromEntities: self versionsNodes.
    self connectFollowingProperty: [ :each | each projects collect: #version ].
    self styleSheet
        nodeLabel: [ :each | #(#ConfigurationOf #BaselineOf) inject: each asString into: [ :name :toRemove | name copyReplaceAll: toRemove with: '' ] ];
        nodeLabelPosition: #bottom.
    self
        layout:
            (TLTreeLayout rightToLeft
                leavesGap: 100;
                levelGap: 100;
                yourself)

And for now versionsNodes is:

versionsNodes
    ^ (version withDeepCollect: [ :each | each projects collect: #version ])
        inject: OrderedCollection new
        into: [ :coll :vers | 
            coll detect: [ :each | each versionNumber = vers versionNumber and: [ each projectLabel = vers projectLabel ] ] ifNone: [ coll add: vers ].
            coll ]

And originally I wanted to do:

versionsNodes
    ^ version withDeepCollect: [ :each | each projects collect: #version ] as: Set

But then I miss some projects