Platform-specific flavors

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

Platform-specific flavors

Sean DeNigris
Hi,

I read all about Metacello and figured it'd be fun to restore SSpec to
working order in both Squeak and Pharo.  The changes were minimal:

1. The following method will now only work in Squeak, as TheWorldMenu
>> registerOpenCommand: has been depreciated in Pharo 1.1:
SpecRunner class >> initialize
        "add this class to world menu"
        (TheWorldMenu respondsTo: #registerOpenCommand:) ifTrue: [
                TheWorldMenu registerOpenCommand:
                        { 'Spec Runner' .  { self . #openDefault }. 'Specification (BDD)
runner' }]

2. This alternate method will do the same thing in Pharo 1.1:
SpecRunner class >> specRunnerOn: aBuilder
        <worldMenu>
        (aBuilder item: #'Spec Runner')
            action: [self openDefault];
                parent: #'MostUsedTools';
            help: 'Specification (BDD) runner';
            icon: MenuIcons smallOkIcon.

So, my question is: how do I handle this in Metacello?  I've read all
the docs and here's where I'm headed (bear with me this is all new):
since Monticello handles whole packages, it seems like I'll have to
either:
 - Move SpecRunner into it's own package
 - or, have the whole SSpec-Runners package be platform-specific

The first one seems to break up the unity of the SSpec package, since
right now the SpecRunner is in the SSpec-Runners package with the
other runner.
Yet, the second one - copying a whole package for one method change -
seems like driving in a nail with a grenade launcher.

What you y'all think?

Thanks.

Sean DeNigris


--
Subscription settings: http://groups.google.com/group/metacello/subscribe?hl=en
Reply | Threaded
Open this post in threaded view
|

Re: Platform-specific flavors

Mariano Martinez Peck


On Tue, Apr 20, 2010 at 5:05 AM, Sean DeNigris <[hidden email]> wrote:
Hi,

I read all about Metacello and figured it'd be fun to restore SSpec to
working order in both Squeak and Pharo.  The changes were minimal:

1. The following method will now only work in Squeak, as TheWorldMenu
>> registerOpenCommand: has been depreciated in Pharo 1.1:
SpecRunner class >> initialize
       "add this class to world menu"
       (TheWorldMenu respondsTo: #registerOpenCommand:) ifTrue: [
               TheWorldMenu registerOpenCommand:
                       { 'Spec Runner' .  { self . #openDefault }. 'Specification (BDD)
runner' }]

2. This alternate method will do the same thing in Pharo 1.1:
SpecRunner class >> specRunnerOn: aBuilder
       <worldMenu>
       (aBuilder item: #'Spec Runner')
           action: [self openDefault];
               parent: #'MostUsedTools';
           help: 'Specification (BDD) runner';
           icon: MenuIcons smallOkIcon.

So, my question is: how do I handle this in Metacello?  I've read all
the docs and here's where I'm headed (bear with me this is all new):
since Monticello handles whole packages, it seems like I'll have to
either:
 - Move SpecRunner into it's own package
 - or, have the whole SSpec-Runners package be platform-specific


A mix of the two ;)
Create a package called Spec-Platform or similar. Then, you can categorize SpecRunner class >> specRunnerOn: aBuilder
with the categorize name '*Spec-Platform'. When you use a *APackageName as a category name, moticello understand that this is an extension to the APackageName package. You can put such categories in any method of any class.
Then, when you commit the package Spec-Platform it will commit all the classes of that package and all the methods of the whole image that as *Spec-Platform as category. Of course, when such package is loaded in another image, it will load the classes but also those methods. This is mechanisim is useful to extend kernel classes like String, Object, Collection, etc. Look to those classes as examples.

 
The first one seems to break up the unity of the SSpec package, since
right now the SpecRunner is in the SSpec-Runners package with the
other runner.
Yet, the second one - copying a whole package for one method change -
seems like driving in a nail with a grenade launcher.

What you y'all think?

Thanks.

Sean DeNigris


--
Subscription settings: http://groups.google.com/group/metacello/subscribe?hl=en