how to implement a group whose package composition depends on installed code.

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

how to implement a group whose package composition depends on installed code.

Nick
I'd like to be able to do something like:

ConfigurationOfPier3AddOns project stableVersion load: 'Code-
Exporter'.

and depending on the image the configuration will pull in different
packages:

Pier 1:
#('Pier-Exporter-Code' 'Pier-Exporter-Seaside28-Code')

Pier 2:
#('Pier-Exporter-Code')

Pier 3:
#('Pier-Exporter-Code' 'Pier-Exporter-Pier3-Code')

Is there a way to standard way to achieve this with Metacello?

Thanks

Nick
Reply | Threaded
Open this post in threaded view
|

Re: how to implement a group whose package composition depends on installed code.

Nick
I can identify the image with something like:

isPier1
        ^ (Smalltalk at: #WAEntryPoint ifAbsent: [ ]) notNil

isPier3
        ^ isPier3 ifNil: [
                isPier3 := (Smalltalk at: #MAPragmaBuilder ifAbsent: [ ]) notNil ]

so I can make the specification dynamic - I'm asking if there is a
more general mechanism for achieving something similar.

I guess I could just define three groups:

'Code-Exporter-Pier1'
'Code-Exporter-Pier2'
'Code-Exporter-Pier3'

rather than dynamically modifying the group.

thoughts?

On Feb 20, 4:02 pm, Nick Ager <[hidden email]> wrote:

> I'd like to be able to do something like:
>
> ConfigurationOfPier3AddOns project stableVersion load: 'Code-
> Exporter'.
>
> and depending on the image the configuration will pull in different
> packages:
>
> Pier 1:
> #('Pier-Exporter-Code' 'Pier-Exporter-Seaside28-Code')
>
> Pier 2:
> #('Pier-Exporter-Code')
>
> Pier 3:
> #('Pier-Exporter-Code' 'Pier-Exporter-Pier3-Code')
>
> Is there a way to standard way to achieve this with Metacello?
>
> Thanks
>
> Nick
Reply | Threaded
Open this post in threaded view
|

Re: how to implement a group whose package composition depends on installed code.

Frank Shearar-3
On 21 February 2012 10:47, Nick Ager <[hidden email]> wrote:

> I can identify the image with something like:
>
> isPier1
>        ^ (Smalltalk at: #WAEntryPoint ifAbsent: [ ]) notNil
>
> isPier3
>        ^ isPier3 ifNil: [
>                isPier3 := (Smalltalk at: #MAPragmaBuilder ifAbsent: [ ]) notNil ]
>
> so I can make the specification dynamic - I'm asking if there is a
> more general mechanism for achieving something similar.
>
> I guess I could just define three groups:
>
> 'Code-Exporter-Pier1'
> 'Code-Exporter-Pier2'
> 'Code-Exporter-Pier3'
>
> rather than dynamically modifying the group.
>
> thoughts?
>
> On Feb 20, 4:02 pm, Nick Ager <[hidden email]> wrote:
>> I'd like to be able to do something like:
>>
>> ConfigurationOfPier3AddOns project stableVersion load: 'Code-
>> Exporter'.
>>
>> and depending on the image the configuration will pull in different
>> packages:
>>
>> Pier 1:
>> #('Pier-Exporter-Code' 'Pier-Exporter-Seaside28-Code')
>>
>> Pier 2:
>> #('Pier-Exporter-Code')
>>
>> Pier 3:
>> #('Pier-Exporter-Code' 'Pier-Exporter-Pier3-Code')
>>
>> Is there a way to standard way to achieve this with Metacello?
>>
>> Thanks
>>
>> Nick

I'd say that you want exactly no dynamic anything in your spec :). The
three separate group thing sounds good.

frank
Reply | Threaded
Open this post in threaded view
|

Re: how to implement a group whose package composition depends on installed code.

Dale Henrichs
In reply to this post by Nick
Nick,

I am trying to understand what you are trying to accomplish.

I think are saying that you want to be able to use ConfigurationOfPier3AddOns to load a different Code-Exporter group based on which version of Pier is loaded. Is that correct?

Given the fact that there already 3 different ConfigurationOfPier*AddOns configurations floating around I would say that the best answer is to edit each of the configurations and just define the 3 'Code-Exporter' groups to reference the correct version of the package to load.

OTOH, you might be trying to accomplish is to make it possible for someone to take their Pier1 image, load the correct PierExporter and magically have the correct package loaded so that they can then export their code into Pier3 or Pier2, etc.

In that case I would create a separate configuration ConfigurationOfPierExporter. Use the MetacelloConfigTemplate class from the most recent version of Metacello to create the new configuration. Then use your "detection methods" to determine whether Pier1, Pier2 or Pier3 is loaded and add a corresponding custom attribute (#pier1, #pier2, #pier3) ... then you can construct your specification and arrange to load the correct package...

BTW I agree with Frank in general, but when conditional loading is involved (or pre/postload expressions), it better to encode the information in the configuration rather than complicate the loading expressions...

Dale

----- Original Message -----
| From: "Nick Ager" <[hidden email]>
| To: "Metacello" <[hidden email]>
| Sent: Monday, February 20, 2012 8:02:08 AM
| Subject: [Metacello] how to implement a group whose package composition depends on installed code.
|
| I'd like to be able to do something like:
|
| ConfigurationOfPier3AddOns project stableVersion load: 'Code-
| Exporter'.
|
| and depending on the image the configuration will pull in different
| packages:
|
| Pier 1:
| #('Pier-Exporter-Code' 'Pier-Exporter-Seaside28-Code')
|
| Pier 2:
| #('Pier-Exporter-Code')
|
| Pier 3:
| #('Pier-Exporter-Code' 'Pier-Exporter-Pier3-Code')
|
| Is there a way to standard way to achieve this with Metacello?
|
| Thanks
|
| Nick
|
Reply | Threaded
Open this post in threaded view
|

Re: how to implement a group whose package composition depends on installed code.

Frank Shearar-3
On 21 February 2012 19:10, Dale Henrichs <[hidden email]> wrote:

> Nick,
>
> I am trying to understand what you are trying to accomplish.
>
> I think are saying that you want to be able to use ConfigurationOfPier3AddOns to load a different Code-Exporter group based on which version of Pier is loaded. Is that correct?
>
> Given the fact that there already 3 different ConfigurationOfPier*AddOns configurations floating around I would say that the best answer is to edit each of the configurations and just define the 3 'Code-Exporter' groups to reference the correct version of the package to load.
>
> OTOH, you might be trying to accomplish is to make it possible for someone to take their Pier1 image, load the correct PierExporter and magically have the correct package loaded so that they can then export their code into Pier3 or Pier2, etc.
>
> In that case I would create a separate configuration ConfigurationOfPierExporter. Use the MetacelloConfigTemplate class from the most recent version of Metacello to create the new configuration. Then use your "detection methods" to determine whether Pier1, Pier2 or Pier3 is loaded and add a corresponding custom attribute (#pier1, #pier2, #pier3) ... then you can construct your specification and arrange to load the correct package...
>
> BTW I agree with Frank in general, but when conditional loading is involved (or pre/postload expressions), it better to encode the information in the configuration rather than complicate the loading expressions...

Actually, that's exactly what I think - I just couldn't figure out how
to say what I wanted to say, and now I don't have to! Yes, the
configuration should express the "conditional" part.

frank

> Dale
>
> ----- Original Message -----
> | From: "Nick Ager" <[hidden email]>
> | To: "Metacello" <[hidden email]>
> | Sent: Monday, February 20, 2012 8:02:08 AM
> | Subject: [Metacello] how to implement a group whose package composition depends on installed code.
> |
> | I'd like to be able to do something like:
> |
> | ConfigurationOfPier3AddOns project stableVersion load: 'Code-
> | Exporter'.
> |
> | and depending on the image the configuration will pull in different
> | packages:
> |
> | Pier 1:
> | #('Pier-Exporter-Code' 'Pier-Exporter-Seaside28-Code')
> |
> | Pier 2:
> | #('Pier-Exporter-Code')
> |
> | Pier 3:
> | #('Pier-Exporter-Code' 'Pier-Exporter-Pier3-Code')
> |
> | Is there a way to standard way to achieve this with Metacello?
> |
> | Thanks
> |
> | Nick
> |
Reply | Threaded
Open this post in threaded view
|

Re: how to implement a group whose package composition depends on installed code.

stephane ducasse-2
In reply to this post by Dale Henrichs
Yes because any expression is a blackhole when you want then to build analysis tools for configuration.

Stef

On Feb 21, 2012, at 8:10 PM, Dale Henrichs wrote:

> BTW I agree with Frank in general, but when conditional loading is involved (or pre/postload expressions), it better to encode the information in the configuration rather than complicate the loading expressions...