How to define a ConfigurationOf with a #development version that depends on a baseline?
Asked Answered
F

3

6

In Pharo, I want to define a Metacello's ConfigurationOfNand2Tetris that has just one package:

ConfigurationOfNand2Tetris>>baseline01: spec
  <version: '0.1-baseline'>

  spec
    for: #common
    do: [ 
      spec
        blessing: #baseline;
        repository: 'http://www.smalltalkhub.com/mc/DamienCassou/Nand2Tetris/main';
        package: 'Nand2Tetris' ]

ConfigurationOfNand2Tetris>>development: spec
  <symbolicVersion: #development>

  spec for: #common version: '0.1-baseline'.

When I execute MetacelloToolBox validateConfiguration: ConfigurationOfNand2Tetris I always get 2 warnings:

  • Warning: Symbolic version #development refers to a version'0.1-baseline' whose blessing #baseline is not #development { notDevelopmentVersion } [ #validateVersionSpecForSymbolicVersion:symbolicVersion: ]
  • Warning: Only baseline defined (no version defined). { onlyBaselineVersion } [ #validatePragmas ]
Fanion answered 2/4, 2013 at 11:15 Comment(0)
R
6

If you want to just depend on a baseline, the metaphor for that in Metacello is to use the #bleedingEdge blessing. Also, you can explicitly deny other symbolic versions:

ConfigurationOfNand2Tetris>>baseline01: spec
  <version: '0.1-baseline'>

  spec
    for: #common
    do: [ 
      spec
        blessing: #baseline;
        repository: 'http://www.smalltalkhub.com/mc/DamienCassou/Nand2Tetris/main';
        package: 'Nand2Tetris' ]

ConfigurationOfNand2Tetris>>bleedingEdge: spec
  <symbolicVersion: #bleedingEdge>
  spec for: #common version: '0.1-baseline'.

ConfigurationOfNand2Tetris>>development: spec
  <symbolicVersion: #'development'>
  spec for: #'common' version: #'notDefined'.

ConfigurationOfNand2Tetris>>stable: spec
  <symbolicVersion: #'stable'>
  spec for: #'common' version: #'notDefined'.

The idea here is that #stable and #development versions link to explicitely enumbered versions, whereas #bleedingEdge always points to the latest versions.

This should avoid the first warning. I think, as long as you do not have released a version, you can safely ignore the second warning.

Resignation answered 2/4, 2013 at 11:43 Comment(0)
O
3

Usually you'll define your baseline and then also a #versionN: method:

ConfigurationOfNand2Tetris>>version01: spec
  <version: '0.1' imports: #('0.1-baseline')>

  spec
    for: #common do: [ 
      spec
        blessing: #baseline;
        package: 'Nand2Tetris' with: 'Nand2Tetris-yourname.22'].
Orten answered 2/4, 2013 at 11:39 Comment(2)
thank you. The problem is that I'm creating many mcz and I don't want to update the version number all the times.Fanion
That's fine: mark it as #development. Periodically update #version01:, or ignore the warnings until you're ready to release a new version.Orten
G
2

I think you forgot to implement :

ConfigurationOfNand2Tetris>>version01: spec

<version: '0.1' imports: #('0.1-baseline' )>

spec for: #'common' do: [
    spec blessing: #'development'.
    spec description: 'some description'.
    spec author: 'yourName'.
    spec timestamp: '1/15/2013 16:13'.
    spec  
        package: 'Nand2Tetris' with: 'Nand2Tetris-yourName.versionNumber']

Then you should change :

ConfigurationOfNand2Tetris>>development: spec

  <symbolicVersion: #development>

  spec for: #'common' version: '0.1'.
Gropius answered 2/4, 2013 at 11:41 Comment(2)
Thank you Clement. Still I don't want to specify 'versionNumber' because it changes a lot these days :-)Fanion
@DamienCassou if it changes that much, you most definitely want a #bleedingEdgeResignation

© 2022 - 2024 — McMap. All rights reserved.