Rewiting code: doc?

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

Rewiting code: doc?

philippeback
Hello,

I'd like to get code rewritten automatically for a number of packages and classes.

Basically I've got a bunch of packages and classes starting with a given prefix (like XXXThis and XXXThat) and I'd like to get them to be ZZZThis and ZZZThat.

Of course, I want all the source code to follow suit.

I saw the option in the Nautilus menu, but that's quite obscure.

I googled around and read the Flamel thing in the book but that didn't helped me.

Clues?

Phil
 

Reply | Threaded
Open this post in threaded view
|

Re: Rewiting code: doc?

Paul DeBruicker
I'm not sure how it works in modern Pharos as I think the class names were changed from Pharo 2.0 but in 1.4 you could do this to rename packages:


ORCategoryRegexRefactoring new
        replace: '^XXX-(.*)$' with: 'ZZZ-$1' ignoreCase: false;
        yourself



and this for renaming classes:

ORClassRegexRefactoring new
        "Example 1: Change class prefixes"
        renameClasses;
        replace: '^XXX(.*)$' with: 'ZZZ$1' ignoreCase: false;
        yourself.



Hope this helps


Paul


philippeback wrote
Hello,

I'd like to get code rewritten automatically for a number of packages and
classes.

Basically I've got a bunch of packages and classes starting with a given
prefix (like XXXThis and XXXThat) and I'd like to get them to be ZZZThis
and ZZZThat.

Of course, I want all the source code to follow suit.

I saw the option in the Nautilus menu, but that's quite obscure.

I googled around and read the Flamel thing in the book but that didn't
helped me.

Clues?

Phil
Reply | Threaded
Open this post in threaded view
|

Re: Rewiting code: doc?

philippeback

I used the RB prefixed versions but nothing happens.

No replacement in my code.

Matches are okay.

Clues?
Phil

Le 2 avr. 2014 06:02, "Paul DeBruicker" <[hidden email]> a écrit :
I'm not sure how it works in modern Pharos as I think the class names were
changed from Pharo 2.0 but in 1.4 you could do this to rename packages:


ORCategoryRegexRefactoring new
        replace: '^XXX-(.*)$' with: 'ZZZ-$1' ignoreCase: false;
        yourself



and this for renaming classes:

ORClassRegexRefactoring new
        "Example 1: Change class prefixes"
        renameClasses;
        replace: '^XXX(.*)$' with: 'ZZZ$1' ignoreCase: false;
        yourself.



Hope this helps


Paul



philippeback wrote
> Hello,
>
> I'd like to get code rewritten automatically for a number of packages and
> classes.
>
> Basically I've got a bunch of packages and classes starting with a given
> prefix (like XXXThis and XXXThat) and I'd like to get them to be ZZZThis
> and ZZZThat.
>
> Of course, I want all the source code to follow suit.
>
> I saw the option in the Nautilus menu, but that's quite obscure.
>
> I googled around and read the Flamel thing in the book but that didn't
> helped me.
>
> Clues?
>
> Phil





--
View this message in context: http://forum.world.st/Rewiting-code-doc-tp4752146p4752162.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Rewiting code: doc?

hernanmd
In reply to this post by philippeback
RBClassRegexRefactoring new
  renameClasses;
  replace: '^XX(.*)$' with: 'ZZ$1' ignoreCase: false;
  execute.

cheers,

Hernán

2014-04-01 16:59 GMT-03:00 [hidden email] <[hidden email]>:

> Hello,
>
> I'd like to get code rewritten automatically for a number of packages and
> classes.
>
> Basically I've got a bunch of packages and classes starting with a given
> prefix (like XXXThis and XXXThat) and I'd like to get them to be ZZZThis and
> ZZZThat.
>
> Of course, I want all the source code to follow suit.
>
> I saw the option in the Nautilus menu, but that's quite obscure.
>
> I googled around and read the Flamel thing in the book but that didn't
> helped me.
>
> Clues?
>
> Phil
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Rewiting code: doc?

philippeback

Now I do have a ton of new symbols in autocompletion but no class has been renamed.

2.0 image...

Le 2 avr. 2014 08:18, "Hernán Morales Durand" <[hidden email]> a écrit :
RBClassRegexRefactoring new
  renameClasses;
  replace: '^XX(.*)$' with: 'ZZ$1' ignoreCase: false;
  execute.

cheers,

Hernán

2014-04-01 16:59 GMT-03:00 [hidden email] <[hidden email]>:
> Hello,
>
> I'd like to get code rewritten automatically for a number of packages and
> classes.
>
> Basically I've got a bunch of packages and classes starting with a given
> prefix (like XXXThis and XXXThat) and I'd like to get them to be ZZZThis and
> ZZZThat.
>
> Of course, I want all the source code to follow suit.
>
> I saw the option in the Nautilus menu, but that's quite obscure.
>
> I googled around and read the Flamel thing in the book but that didn't
> helped me.
>
> Clues?
>
> Phil
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Rewiting code: doc?

hernanmd
2014-04-02 5:05 GMT-03:00 [hidden email] <[hidden email]>:
> Now I do have a ton of new symbols in autocompletion but no class has been
> renamed.
>
> 2.0 image...
>

Works for me here in a clean 2.0 image.