Nice.  I will give it a try
On Apr 30, 2016 19:03, "Sean P. DeNigris" <s...@clipperadams.com> wrote:

> 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 Metcello 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'
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context:
> http://forum.world.st/Create-BaselineOf-from-ConfigurationOf-tp4893076.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>

Reply via email to