pharo-users@lists.pharo.org

Any question about pharo is welcome

View all threads

Packages

SM
Steffen Märcker
Mon, May 8, 2023 11:40 AM

Hi,

is there a way to create an empty package programatically, and how do I
rename a package programmatically? Is there a documentation about packages
and how exactly their naming scheme relates to tags?

Kind regards,
Steffen

Hi, is there a way to create an empty package programatically, and how do I rename a package programmatically? Is there a documentation about packages and how exactly their naming scheme relates to tags? Kind regards, Steffen
CD
Christophe Demarey
Tue, May 9, 2023 8:18 AM

Hi Steffen,

Le 8 mai 2023 à 13:40, Steffen Märcker merkste@web.de a écrit :

Hi,

is there a way to create an empty package programatically,

RPackageOrganizer default createPackageNamed: #packageName

and how do I
rename a package programmatically?

You can take a look at RBRenamePackageTransformation class comment.

Is there a documentation about packages
and how exactly their naming scheme relates to tags?

You can get tags with:
(RPackageOrganizer default packageNamed: 'RPackage-Core') actualClassTags

Inspecting one tag, you can ask its real name:
self categoryName "#'RPackage-Core-Base’"

As you can see, a package tag is prefixed by the package name and a dash.

There are some comments in RPackageOrganizer and RPackage.

Christophe

Hi Steffen, > Le 8 mai 2023 à 13:40, Steffen Märcker <merkste@web.de> a écrit : > > Hi, > > is there a way to create an empty package programatically, RPackageOrganizer default createPackageNamed: #packageName > and how do I > rename a package programmatically? You can take a look at RBRenamePackageTransformation class comment. > Is there a documentation about packages > and how exactly their naming scheme relates to tags? You can get tags with: (RPackageOrganizer default packageNamed: 'RPackage-Core') actualClassTags Inspecting one tag, you can ask its real name: self categoryName "#'RPackage-Core-Base’" As you can see, a package tag is prefixed by the package name and a dash. There are some comments in RPackageOrganizer and RPackage. Christophe
Balša Šarenac
Tue, May 9, 2023 5:37 PM

Hello,

I would just add: for renaming packages prefer refactoring over transformation. RBRenamePackageRefactoring is the class that's called when you invoke rename package from the UI. RBRenamePackageTransformation is unused class. While it does work it represents code duplication and might not be present in Pharo in the future.

Balša

------- Original Message -------
On Tuesday, May 9th, 2023 at 10:18, Christophe Demarey christophe.demarey@inria.fr wrote:

Hi Steffen,

Le 8 mai 2023 à 13:40, Steffen Märcker merkste@web.de a écrit :

Hi,

is there a way to create an empty package programatically,

RPackageOrganizer default createPackageNamed: #packageName

and how do I
rename a package programmatically?

You can take a look at RBRenamePackageTransformation class comment.

Is there a documentation about packages
and how exactly their naming scheme relates to tags?

You can get tags with:
(RPackageOrganizer default packageNamed: 'RPackage-Core') actualClassTags

Inspecting one tag, you can ask its real name:
self categoryName "#'RPackage-Core-Base’"

As you can see, a package tag is prefixed by the package name and a dash.

There are some comments in RPackageOrganizer and RPackage.

Christophe

Hello, I would just add: for renaming packages prefer refactoring over transformation. `RBRenamePackageRefactoring` is the class that's called when you invoke rename package from the UI. `RBRenamePackageTransformation` is unused class. While it does work it represents code duplication and might not be present in Pharo in the future. Balša ------- Original Message ------- On Tuesday, May 9th, 2023 at 10:18, Christophe Demarey <christophe.demarey@inria.fr> wrote: > Hi Steffen, > > > Le 8 mai 2023 à 13:40, Steffen Märcker merkste@web.de a écrit : > > > > Hi, > > > > is there a way to create an empty package programatically, > > > RPackageOrganizer default createPackageNamed: #packageName > > > and how do I > > rename a package programmatically? > > > You can take a look at RBRenamePackageTransformation class comment. > > > Is there a documentation about packages > > and how exactly their naming scheme relates to tags? > > > > You can get tags with: > (RPackageOrganizer default packageNamed: 'RPackage-Core') actualClassTags > > Inspecting one tag, you can ask its real name: > self categoryName "#'RPackage-Core-Base’" > > As you can see, a package tag is prefixed by the package name and a dash. > > > There are some comments in RPackageOrganizer and RPackage. > > > Christophe