Script to Convert ConfigurationOf to BaselineOf

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Script to Convert ConfigurationOf to BaselineOf

Sean DeNigris
I got tired of manually converting Configs into Baselines, so I wrote a
little script. You pass it the selector of a #baselineXyz: method, and it
converts it (i.e. changes the pragma, removes the blessing and repo, etc)
Hopefully you will find it useful. Cross posting to Pharo Users list...

ConfigurationOf>>#createBaselineFrom: selector

        | projectName baselineName baseline methodTree commonBlockBody repoSetter |
        "Create new class"
        projectName := self name allButFirst: self superclass name size.
        baselineName := 'BaselineOf', projectName.
        baseline := BaselineOf subclass: baselineName asSymbol
        instanceVariableNames: ''
        classVariableNames: ''
        category: baselineName.
        "Convert baseline##: method"
        methodTree := (self methodNamed: selector) parseTree.
        methodTree selector: #baseline:.
        methodTree pragmas at: 1 put: (RBPragmaNode selector: #baseline arguments: #()).
        commonBlockBody := methodTree statements first arguments last body.
        repoSetter := commonBlockBody statements detect: [ :e | e selector = #repository: ].
        commonBlockBody removeNode: repoSetter.
        "Compile baseline method"
        baseline compile: methodTree newSource classified: 'baseline'


You received this message because you are subscribed to the Google Groups "Metacello" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit